Java 类org.apache.hadoop.hbase.regionserver.metrics.RegionMetricsStorage 实例源码

项目:LCIndex-HBase-0.94.16    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:LCIndex-HBase-0.94.16    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:IRIndex    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:IRIndex    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:HBase-Research    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:HBase-Research    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:hindex    文件:TestRegionServerMetrics.java   
private void assertTimeVaryingMetricCount(int expectedCount, String table, String cf,
    String regionName, String metricPrefix) {

  Integer expectedCountInteger = new Integer(expectedCount);

  if (cf != null) {
    String cfKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.CF_PREFIX + cf + "."
            + metricPrefix;
    Pair<Long, Integer> cfPair = RegionMetricsStorage.getTimeVaryingMetric(cfKey);
    assertEquals(expectedCountInteger, cfPair.getSecond());
  }

  if (regionName != null) {
    String rKey =
        SchemaMetrics.TABLE_PREFIX + table + "." + SchemaMetrics.REGION_PREFIX + regionName + "."
            + metricPrefix;

    Pair<Long, Integer> regionPair = RegionMetricsStorage.getTimeVaryingMetric(rKey);
    assertEquals(expectedCountInteger, regionPair.getSecond());
  }
}
项目:hindex    文件:TestRegionServerMetrics.java   
private void assertSizeMetric(String table, String[] cfs, int[] metrics) {
  // we have getsize & nextsize for each column family
  assertEquals(cfs.length * 2, metrics.length);

  for (int i =0; i < cfs.length; ++i) {
    String prefix = SchemaMetrics.generateSchemaMetricsPrefix(table, cfs[i]);
    String getMetric = prefix + SchemaMetrics.METRIC_GETSIZE;
    String nextMetric = prefix + SchemaMetrics.METRIC_NEXTSIZE;

    // verify getsize and nextsize matches
    int getSize = RegionMetricsStorage.getNumericMetrics().containsKey(getMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(getMetric).intValue() : 0;
    int nextSize = RegionMetricsStorage.getNumericMetrics().containsKey(nextMetric) ?
        RegionMetricsStorage.getNumericMetrics().get(nextMetric).intValue() : 0;

    assertEquals(metrics[i], getSize);
    assertEquals(metrics[cfs.length + i], nextSize);
  }
}
项目:LCIndex-HBase-0.94.16    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:LCIndex-HBase-0.94.16    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}
项目:IRIndex    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:IRIndex    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}
项目:HBase-Research    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:HBase-Research    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:hbase-0.94.8-qod    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}
项目:hindex    文件:TestRegionServerMetrics.java   
private void assertStoreMetricEquals(long expected,
    SchemaMetrics schemaMetrics, StoreMetricType storeMetricType) {
  final String storeMetricName =
      schemaMetrics.getStoreMetricName(storeMetricType);
  Long startValue = startingMetrics.get(storeMetricName);
  assertEquals("Invalid value for store metric " + storeMetricName
      + " (type " + storeMetricType + ")", expected,
      RegionMetricsStorage.getNumericMetric(storeMetricName)
          - (startValue != null ? startValue : 0));
}
项目:hindex    文件:TestRegionServerMetrics.java   
@Test
public void testMultipleRegions() throws IOException, InterruptedException {

  TEST_UTIL.createRandomTable(
      TABLE_NAME,
      Arrays.asList(FAMILIES),
      MAX_VERSIONS, NUM_COLS_PER_ROW, NUM_FLUSHES, NUM_REGIONS, 1000);

  final HRegionServer rs =
      TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);

  assertEquals(NUM_REGIONS + META_AND_ROOT, rs.getOnlineRegions().size());

  rs.doMetrics();
  for (HRegion r : TEST_UTIL.getMiniHBaseCluster().getRegions(
      Bytes.toBytes(TABLE_NAME))) {
    for (Map.Entry<byte[], Store> storeEntry : r.getStores().entrySet()) {
      LOG.info("For region " + r.getRegionNameAsString() + ", CF " +
          Bytes.toStringBinary(storeEntry.getKey()) + " found store files " +
          ": " + storeEntry.getValue().getStorefiles());
    }
  }

  assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS * FAMILIES.length
      + META_AND_ROOT, ALL_METRICS, StoreMetricType.STORE_FILE_COUNT);

  for (String cf : FAMILIES) {
    SchemaMetrics schemaMetrics = SchemaMetrics.getInstance(TABLE_NAME, cf);
    assertStoreMetricEquals(NUM_FLUSHES * NUM_REGIONS, schemaMetrics,
        StoreMetricType.STORE_FILE_COUNT);
  }

  // ensure that the max value is also maintained
  final String storeMetricName = ALL_METRICS
      .getStoreMetricNameMax(StoreMetricType.STORE_FILE_COUNT);
  assertEquals("Invalid value for store metric " + storeMetricName,
      NUM_FLUSHES, RegionMetricsStorage.getNumericMetric(storeMetricName));
}