001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.hadoop.hbase.regionserver; 020 021import java.util.HashMap; 022import java.util.Map; 023 024public class MetricsRegionWrapperStub implements MetricsRegionWrapper { 025 int replicaid = 0; 026 027 /** 028 * Replica ID set to 0 029 */ 030 public MetricsRegionWrapperStub() { 031 this.replicaid = 0; 032 } 033 034 /** 035 * Pass in replica ID 036 */ 037 public MetricsRegionWrapperStub(int replicaid) { 038 this.replicaid = replicaid; 039 } 040 041 @Override 042 public String getTableName() { 043 return "MetricsRegionWrapperStub"; 044 } 045 046 @Override 047 public String getNamespace() { 048 return "TestNS"; 049 } 050 051 @Override 052 public String getRegionName() { 053 return "DEADBEEF001"; 054 } 055 056 @Override 057 public long getNumStores() { 058 return 101; 059 } 060 061 @Override 062 public long getNumStoreFiles() { 063 return 102; 064 } 065 066 @Override 067 public long getStoreRefCount() { 068 return 0; 069 } 070 071 @Override 072 public long getMaxCompactedStoreFileRefCount() { 073 return 0; 074 } 075 076 @Override 077 public long getMemStoreSize() { 078 return 103; 079 } 080 081 @Override 082 public long getStoreFileSize() { 083 return 104; 084 } 085 086 @Override 087 public long getReadRequestCount() { 088 return 105; 089 } 090 091 @Override 092 public long getFilteredReadRequestCount() { 093 return 107; 094 } 095 096 @Override 097 public long getMaxStoreFileAge() { 098 return 2; 099 } 100 101 @Override 102 public long getMinStoreFileAge() { 103 return 2; 104 } 105 106 @Override 107 public long getAvgStoreFileAge() { 108 return 2; 109 } 110 111 @Override 112 public long getNumReferenceFiles() { 113 return 2; 114 } 115 116 @Override 117 public long getWriteRequestCount() { 118 return 106; 119 } 120 121 @Override 122 public long getNumFilesCompacted() { 123 return 0; 124 } 125 126 @Override 127 public long getNumBytesCompacted() { 128 return 0; 129 } 130 131 @Override 132 public long getNumCompactionsCompleted() { 133 return 0; 134 } 135 136 @Override 137 public long getLastMajorCompactionAge() { 138 return 0; 139 } 140 141 @Override 142 public long getNumCompactionsFailed() { 143 return 0; 144 } 145 146 @Override 147 public int getRegionHashCode() { 148 return 42; 149 } 150 151 /** 152 * Get the replica id of this region. 153 */ 154 @Override 155 public int getReplicaId() { 156 return replicaid; 157 } 158 159 @Override 160 public long getNumCompactionsQueued() { 161 return 4; 162 } 163 164 @Override 165 public long getNumFlushesQueued() { 166 return 6; 167 } 168 169 @Override 170 public long getMaxCompactionQueueSize() { 171 return 4; 172 } 173 174 @Override 175 public long getMaxFlushQueueSize() { 176 return 6; 177 } 178 179 @Override 180 public long getTotalRequestCount() { 181 return 0; 182 } 183 184 @Override 185 public Map<String, Long> getMemstoreOnlyRowReadsCount() { 186 Map<String, Long> map = new HashMap<>(); 187 map.put("info", 0L); 188 return map; 189 } 190 191 @Override 192 public Map<String, Long> getMixedRowReadsCount() { 193 Map<String, Long> map = new HashMap<>(); 194 map.put("info", 0L); 195 return map; 196 } 197}