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

项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeDropDeletes() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(conf);
  Long[] toSplit = new Long[] { defaultSplitSize / 2, defaultSplitSize / 2 };
  Long[] noSplit = new Long[] { 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);

  // Verify the deletes can be dropped if there are no L0 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    true, null, splitTargetSize);
  // But cannot be dropped if there are.
  si = createStripesWithSizes(2, 2, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    false, null, splitTargetSize);
}
项目:ditb    文件:StripeCompactionsPerformanceEvaluation.java   
private HTableDescriptor createHtd(boolean isStripe) throws Exception {
  HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  String noSplitsPolicy = DisabledRegionSplitPolicy.class.getName();
  htd.setConfiguration(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, noSplitsPolicy);
  if (isStripe) {
    htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName());
    if (initialStripeCount != null) {
      htd.setConfiguration(
          StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialStripeCount.toString());
      htd.setConfiguration(
          HStore.BLOCKING_STOREFILES_KEY, Long.toString(10 * initialStripeCount));
    } else {
      htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "500");
    }
    if (splitSize != null) {
      htd.setConfiguration(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize.toString());
    }
    if (splitParts != null) {
      htd.setConfiguration(StripeStoreConfig.SPLIT_PARTS_KEY, splitParts.toString());
    }
  } else {
    htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "10"); // default
  }
  return htd;
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeDropDeletes() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(conf);
  Long[] toSplit = new Long[] { defaultSplitSize / 2, defaultSplitSize / 2 };
  Long[] noSplit = new Long[] { 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);

  // Verify the deletes can be dropped if there are no L0 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    true, null, splitTargetSize);
  // But cannot be dropped if there are.
  si = createStripesWithSizes(2, 2, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    false, null, splitTargetSize);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeDropDeletes() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(conf);
  Long[] toSplit = new Long[] { defaultSplitSize / 2, defaultSplitSize / 2 };
  Long[] noSplit = new Long[] { 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);

  // Verify the deletes can be dropped if there are no L0 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    true, null, splitTargetSize);
  // But cannot be dropped if there are.
  si = createStripesWithSizes(2, 2, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    false, null, splitTargetSize);
}
项目:HIndex    文件:StripeCompactionsPerformanceEvaluation.java   
private HTableDescriptor createHtd(boolean isStripe) throws Exception {
  HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  String noSplitsPolicy = DisabledRegionSplitPolicy.class.getName();
  htd.setConfiguration(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, noSplitsPolicy);
  if (isStripe) {
    htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName());
    if (initialStripeCount != null) {
      htd.setConfiguration(
          StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialStripeCount.toString());
      htd.setConfiguration(
          HStore.BLOCKING_STOREFILES_KEY, Long.toString(10 * initialStripeCount));
    } else {
      htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "500");
    }
    if (splitSize != null) {
      htd.setConfiguration(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize.toString());
    }
    if (splitParts != null) {
      htd.setConfiguration(StripeStoreConfig.SPLIT_PARTS_KEY, splitParts.toString());
    }
  } else {
    htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "10"); // default
  }
  return htd;
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeOffPeak() throws Exception {
  // for HBASE-11439
  Configuration conf = HBaseConfiguration.create();

  // Test depends on this not being set to pass.  Default breaks test.  TODO: Revisit.
  conf.unset("hbase.hstore.compaction.min.size");

  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  // Select the last 2 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 1L, 1L });
  assertEquals(2, createPolicy(conf).selectCompaction(si, al(), false).getRequest().getFiles()
      .size());
  // Make sure everything is eligible in offpeak.
  conf.setFloat("hbase.hstore.compaction.ratio.offpeak", 500f);
  assertEquals(3, createPolicy(conf).selectCompaction(si, al(), true).getRequest().getFiles()
      .size());
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeDropDeletes() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(conf);
  Long[] toSplit = new Long[] { defaultSplitSize / 2, defaultSplitSize / 2 };
  Long[] noSplit = new Long[] { 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);

  // Verify the deletes can be dropped if there are no L0 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    true, null, splitTargetSize);
  // But cannot be dropped if there are.
  si = createStripesWithSizes(2, 2, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    false, null, splitTargetSize);
}
项目:hbase    文件:StripeCompactionsPerformanceEvaluation.java   
private HTableDescriptor createHtd(boolean isStripe) throws Exception {
  HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  String noSplitsPolicy = DisabledRegionSplitPolicy.class.getName();
  htd.setConfiguration(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, noSplitsPolicy);
  if (isStripe) {
    htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName());
    if (initialStripeCount != null) {
      htd.setConfiguration(
          StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialStripeCount.toString());
      htd.setConfiguration(
          HStore.BLOCKING_STOREFILES_KEY, Long.toString(10 * initialStripeCount));
    } else {
      htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "500");
    }
    if (splitSize != null) {
      htd.setConfiguration(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize.toString());
    }
    if (splitParts != null) {
      htd.setConfiguration(StripeStoreConfig.SPLIT_PARTS_KEY, splitParts.toString());
    }
  } else {
    htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "10"); // default
  }
  return htd;
}
项目:PyroDB    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeDropDeletes() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(conf);
  Long[] toSplit = new Long[] { defaultSplitSize / 2, defaultSplitSize / 2 };
  Long[] noSplit = new Long[] { 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);

  // Verify the deletes can be dropped if there are no L0 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    true, null, splitTargetSize);
  // But cannot be dropped if there are.
  si = createStripesWithSizes(2, 2, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1,    false, null, splitTargetSize);
}
项目:PyroDB    文件:StripeCompactionsPerformanceEvaluation.java   
private HTableDescriptor createHtd(boolean isStripe) throws Exception {
  HTableDescriptor htd = new HTableDescriptor(TABLE_NAME);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  String noSplitsPolicy = DisabledRegionSplitPolicy.class.getName();
  htd.setConfiguration(HConstants.HBASE_REGION_SPLIT_POLICY_KEY, noSplitsPolicy);
  if (isStripe) {
    htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName());
    if (initialStripeCount != null) {
      htd.setConfiguration(
          StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialStripeCount.toString());
      htd.setConfiguration(
          HStore.BLOCKING_STOREFILES_KEY, Long.toString(10 * initialStripeCount));
    } else {
      htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "500");
    }
    if (splitSize != null) {
      htd.setConfiguration(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize.toString());
    }
    if (splitParts != null) {
      htd.setConfiguration(StripeStoreConfig.SPLIT_PARTS_KEY, splitParts.toString());
    }
  } else {
    htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "10"); // default
  }
  return htd;
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testNoStripesFromFlush() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setBoolean(StripeStoreConfig.FLUSH_TO_L0_KEY, true);
  StripeCompactionPolicy policy = createPolicy(conf);
  StripeInformationProvider si = createStripesL0Only(0, 0);

  KeyValue[] input = new KeyValue[] { KV_A, KV_B, KV_C, KV_D, KV_E };
  KeyValue[][] expected = new KeyValue[][] { input };
  verifyFlush(policy, si, input, expected, null);
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testInitialCountFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(
      conf, defaultSplitSize, defaultSplitCount, 2, false);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
  verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
  si = createStripesL0Only(3, 10); // If result would be too large, split into smaller parts.
  verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
  policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
  verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testExistingStripesFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 3);
  StripeCompactionPolicy.StripeInformationProvider si = createStripes(3, KEY_A);
  verifyCompaction(
      createPolicy(conf), si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testNothingToCompactFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyNoCompaction(policy, si);

  si = createStripes(3, KEY_A);
  verifyNoCompaction(policy, si);
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripe() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  // First test everything with default split count of 2, then split into more.
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  Long[] toSplit = new Long[] { defaultSplitSize - 2, 1L, 1L };
  Long[] noSplit = new Long[] { defaultSplitSize - 2, 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);
  // Don't split if not eligible for compaction.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 2L });
  assertNull(createPolicy(conf).selectCompaction(si, al(), false));
  // Make sure everything is eligible.
  conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 500f);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyWholeStripesCompaction(policy, si, 0, 0, null, 2, splitTargetSize);
  // Add some extra stripes...
  si = createStripesWithSizes(0, 0, noSplit, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 2, 2, null, 2, splitTargetSize);
  // In the middle.
  si = createStripesWithSizes(0, 0, noSplit, toSplit, noSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1, null, 2, splitTargetSize);
  // No split-off with different config (larger split size).
  // However, in this case some eligible stripe will just be compacted alone.
  StripeCompactionPolicy specPolicy = createPolicy(
      conf, defaultSplitSize + 1, defaultSplitCount, defaultInitialCount, false);
  verifySingleStripeCompaction(specPolicy, si, 1, null);
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeOffPeak() throws Exception {
  // for HBASE-11439
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  // Select the last 2 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 1L, 1L });
  assertEquals(2, createPolicy(conf).selectCompaction(si, al(), false).getRequest().getFiles()
      .size());
  // Make sure everything is eligible in offpeak.
  conf.setFloat("hbase.hstore.compaction.ratio.offpeak", 500f);
  assertEquals(3, createPolicy(conf).selectCompaction(si, al(), true).getRequest().getFiles()
      .size());
}
项目:ditb    文件:TestStripeCompactionPolicy.java   
private static StripeCompactionPolicy createPolicy(Configuration conf,
    long splitSize, float splitCount, int initialCount, boolean hasTtl) throws Exception {
  conf.setLong(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize);
  conf.setFloat(StripeStoreConfig.SPLIT_PARTS_KEY, splitCount);
  conf.setInt(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialCount);
  StoreConfigInformation sci = mock(StoreConfigInformation.class);
  when(sci.getStoreFileTtl()).thenReturn(hasTtl ? defaultTtl : Long.MAX_VALUE);
  StripeStoreConfig ssc = new StripeStoreConfig(conf, sci);
  return new StripeCompactionPolicy(conf, sci, ssc);
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testNoStripesFromFlush() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setBoolean(StripeStoreConfig.FLUSH_TO_L0_KEY, true);
  StripeCompactionPolicy policy = createPolicy(conf);
  StripeInformationProvider si = createStripesL0Only(0, 0);

  KeyValue[] input = new KeyValue[] { KV_A, KV_B, KV_C, KV_D, KV_E };
  KeyValue[][] expected = new KeyValue[][] { input };
  verifyFlush(policy, si, input, expected, null);
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testInitialCountFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(
      conf, defaultSplitSize, defaultSplitCount, 2, false);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
  verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
  si = createStripesL0Only(3, 10); // If result would be too large, split into smaller parts.
  verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
  policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
  verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testExistingStripesFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 3);
  StripeCompactionPolicy.StripeInformationProvider si = createStripes(3, KEY_A);
  verifyCompaction(
      createPolicy(conf), si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testNothingToCompactFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyNoCompaction(policy, si);

  si = createStripes(3, KEY_A);
  verifyNoCompaction(policy, si);
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripe() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  // First test everything with default split count of 2, then split into more.
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  Long[] toSplit = new Long[] { defaultSplitSize - 2, 1L, 1L };
  Long[] noSplit = new Long[] { defaultSplitSize - 2, 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);
  // Don't split if not eligible for compaction.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 2L });
  assertNull(createPolicy(conf).selectCompaction(si, al(), false));
  // Make sure everything is eligible.
  conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 500f);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyWholeStripesCompaction(policy, si, 0, 0, null, 2, splitTargetSize);
  // Add some extra stripes...
  si = createStripesWithSizes(0, 0, noSplit, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 2, 2, null, 2, splitTargetSize);
  // In the middle.
  si = createStripesWithSizes(0, 0, noSplit, toSplit, noSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1, null, 2, splitTargetSize);
  // No split-off with different config (larger split size).
  // However, in this case some eligible stripe will just be compacted alone.
  StripeCompactionPolicy specPolicy = createPolicy(
      conf, defaultSplitSize + 1, defaultSplitCount, defaultInitialCount, false);
  verifySingleStripeCompaction(specPolicy, si, 1, null);
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripeOffPeak() throws Exception {
  // for HBASE-11439
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  // Select the last 2 files.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 1L, 1L });
  assertEquals(2, createPolicy(conf).selectCompaction(si, al(), false).getRequest().getFiles()
      .size());
  // Make sure everything is eligible in offpeak.
  conf.setFloat("hbase.hstore.compaction.ratio.offpeak", 500f);
  assertEquals(3, createPolicy(conf).selectCompaction(si, al(), true).getRequest().getFiles()
      .size());
}
项目:pbase    文件:TestStripeCompactionPolicy.java   
private static StripeCompactionPolicy createPolicy(Configuration conf,
    long splitSize, float splitCount, int initialCount, boolean hasTtl) throws Exception {
  conf.setLong(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize);
  conf.setFloat(StripeStoreConfig.SPLIT_PARTS_KEY, splitCount);
  conf.setInt(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialCount);
  StoreConfigInformation sci = mock(StoreConfigInformation.class);
  when(sci.getStoreFileTtl()).thenReturn(hasTtl ? defaultTtl : Long.MAX_VALUE);
  StripeStoreConfig ssc = new StripeStoreConfig(conf, sci);
  return new StripeCompactionPolicy(conf, sci, ssc);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testNoStripesFromFlush() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setBoolean(StripeStoreConfig.FLUSH_TO_L0_KEY, true);
  StripeCompactionPolicy policy = createPolicy(conf);
  StripeInformationProvider si = createStripesL0Only(0, 0);

  KeyValue[] input = new KeyValue[] { KV_A, KV_B, KV_C, KV_D, KV_E };
  KeyValue[][] expected = new KeyValue[][] { input };
  verifyFlush(policy, si, input, expected, null);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testInitialCountFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(
      conf, defaultSplitSize, defaultSplitCount, 2, false);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
  verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
  si = createStripesL0Only(3, 10); // If result would be too large, split into smaller parts.
  verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
  policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
  verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testExistingStripesFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 3);
  StripeCompactionPolicy.StripeInformationProvider si = createStripes(3, KEY_A);
  verifyCompaction(
      createPolicy(conf), si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testNothingToCompactFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyNoCompaction(policy, si);

  si = createStripes(3, KEY_A);
  verifyNoCompaction(policy, si);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripe() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  // First test everything with default split count of 2, then split into more.
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  Long[] toSplit = new Long[] { defaultSplitSize - 2, 1L, 1L };
  Long[] noSplit = new Long[] { defaultSplitSize - 2, 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);
  // Don't split if not eligible for compaction.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 2L });
  assertNull(createPolicy(conf).selectCompaction(si, al(), false));
  // Make sure everything is eligible.
  conf.setFloat(CompactionConfiguration.RATIO_KEY, 500f);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyWholeStripesCompaction(policy, si, 0, 0, null, 2, splitTargetSize);
  // Add some extra stripes...
  si = createStripesWithSizes(0, 0, noSplit, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 2, 2, null, 2, splitTargetSize);
  // In the middle.
  si = createStripesWithSizes(0, 0, noSplit, toSplit, noSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1, null, 2, splitTargetSize);
  // No split-off with different config (larger split size).
  // However, in this case some eligible stripe will just be compacted alone.
  StripeCompactionPolicy specPolicy = createPolicy(
      conf, defaultSplitSize + 1, defaultSplitCount, defaultInitialCount, false);
  verifySingleStripeCompaction(specPolicy, si, 1, null);
}
项目:HIndex    文件:TestStripeCompactionPolicy.java   
private static StripeCompactionPolicy createPolicy(Configuration conf,
    long splitSize, float splitCount, int initialCount, boolean hasTtl) throws Exception {
  conf.setLong(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize);
  conf.setFloat(StripeStoreConfig.SPLIT_PARTS_KEY, splitCount);
  conf.setInt(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialCount);
  StoreConfigInformation sci = mock(StoreConfigInformation.class);
  when(sci.getStoreFileTtl()).thenReturn(hasTtl ? defaultTtl : Long.MAX_VALUE);
  StripeStoreConfig ssc = new StripeStoreConfig(conf, sci);
  return new StripeCompactionPolicy(conf, sci, ssc);
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testNoStripesFromFlush() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setBoolean(StripeStoreConfig.FLUSH_TO_L0_KEY, true);
  StripeCompactionPolicy policy = createPolicy(conf);
  StripeInformationProvider si = createStripesL0Only(0, 0);

  KeyValue[] input = new KeyValue[] { KV_A, KV_B, KV_C, KV_D, KV_E };
  KeyValue[][] expected = new KeyValue[][] { input };
  verifyFlush(policy, si, input, expected, null);
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testInitialCountFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(
      conf, defaultSplitSize, defaultSplitCount, 2, false);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
  verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
  si = createStripesL0Only(3, 10); // If result would be too large, split into smaller parts.
  verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
  policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
  verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testExistingStripesFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 3);
  StripeCompactionPolicy.StripeInformationProvider si = createStripes(3, KEY_A);
  verifyCompaction(
      createPolicy(conf), si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testNothingToCompactFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyNoCompaction(policy, si);

  si = createStripes(3, KEY_A);
  verifyNoCompaction(policy, si);
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
@Test
public void testSplitOffStripe() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  // Test depends on this not being set to pass.  Default breaks test.  TODO: Revisit.
  conf.unset("hbase.hstore.compaction.min.size");
  // First test everything with default split count of 2, then split into more.
  conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
  Long[] toSplit = new Long[] { defaultSplitSize - 2, 1L, 1L };
  Long[] noSplit = new Long[] { defaultSplitSize - 2, 1L };
  long splitTargetSize = (long)(defaultSplitSize / defaultSplitCount);
  // Don't split if not eligible for compaction.
  StripeCompactionPolicy.StripeInformationProvider si =
      createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 2L });
  assertNull(createPolicy(conf).selectCompaction(si, al(), false));
  // Make sure everything is eligible.
  conf.setFloat(CompactionConfiguration.HBASE_HSTORE_COMPACTION_RATIO_KEY, 500f);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyWholeStripesCompaction(policy, si, 0, 0, null, 2, splitTargetSize);
  // Add some extra stripes...
  si = createStripesWithSizes(0, 0, noSplit, noSplit, toSplit);
  verifyWholeStripesCompaction(policy, si, 2, 2, null, 2, splitTargetSize);
  // In the middle.
  si = createStripesWithSizes(0, 0, noSplit, toSplit, noSplit);
  verifyWholeStripesCompaction(policy, si, 1, 1, null, 2, splitTargetSize);
  // No split-off with different config (larger split size).
  // However, in this case some eligible stripe will just be compacted alone.
  StripeCompactionPolicy specPolicy = createPolicy(
      conf, defaultSplitSize + 1, defaultSplitCount, defaultInitialCount, false);
  verifySingleStripeCompaction(specPolicy, si, 1, null);
}
项目:hbase    文件:TestStripeCompactionPolicy.java   
private static StripeCompactionPolicy createPolicy(Configuration conf,
    long splitSize, float splitCount, int initialCount, boolean hasTtl) throws Exception {
  conf.setLong(StripeStoreConfig.SIZE_TO_SPLIT_KEY, splitSize);
  conf.setFloat(StripeStoreConfig.SPLIT_PARTS_KEY, splitCount);
  conf.setInt(StripeStoreConfig.INITIAL_STRIPE_COUNT_KEY, initialCount);
  StoreConfigInformation sci = mock(StoreConfigInformation.class);
  when(sci.getStoreFileTtl()).thenReturn(hasTtl ? defaultTtl : Long.MAX_VALUE);
  StripeStoreConfig ssc = new StripeStoreConfig(conf, sci);
  return new StripeCompactionPolicy(conf, sci, ssc);
}
项目:PyroDB    文件:TestStripeCompactionPolicy.java   
@Test
public void testNoStripesFromFlush() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setBoolean(StripeStoreConfig.FLUSH_TO_L0_KEY, true);
  StripeCompactionPolicy policy = createPolicy(conf);
  StripeInformationProvider si = createStripesL0Only(0, 0);

  KeyValue[] input = new KeyValue[] { KV_A, KV_B, KV_C, KV_D, KV_E };
  KeyValue[][] expected = new KeyValue[][] { input };
  verifyFlush(policy, si, input, expected, null);
}
项目:PyroDB    文件:TestStripeCompactionPolicy.java   
@Test
public void testInitialCountFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 2);
  StripeCompactionPolicy policy = createPolicy(
      conf, defaultSplitSize, defaultSplitCount, 2, false);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 8);
  verifyCompaction(policy, si, si.getStorefiles(), true, 2, 12L, OPEN_KEY, OPEN_KEY, true);
  si = createStripesL0Only(3, 10); // If result would be too large, split into smaller parts.
  verifyCompaction(policy, si, si.getStorefiles(), true, 3, 10L, OPEN_KEY, OPEN_KEY, true);
  policy = createPolicy(conf, defaultSplitSize, defaultSplitCount, 6, false);
  verifyCompaction(policy, si, si.getStorefiles(), true, 6, 5L, OPEN_KEY, OPEN_KEY, true);
}
项目:PyroDB    文件:TestStripeCompactionPolicy.java   
@Test
public void testExistingStripesFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 3);
  StripeCompactionPolicy.StripeInformationProvider si = createStripes(3, KEY_A);
  verifyCompaction(
      createPolicy(conf), si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
}
项目:PyroDB    文件:TestStripeCompactionPolicy.java   
@Test
public void testNothingToCompactFromL0() throws Exception {
  Configuration conf = HBaseConfiguration.create();
  conf.setInt(StripeStoreConfig.MIN_FILES_L0_KEY, 4);
  StripeCompactionPolicy.StripeInformationProvider si = createStripesL0Only(3, 10);
  StripeCompactionPolicy policy = createPolicy(conf);
  verifyNoCompaction(policy, si);

  si = createStripes(3, KEY_A);
  verifyNoCompaction(policy, si);
}