当前位置: 首页>>代码示例>>Java>>正文


Java HTableDescriptor.isCompactionEnabled方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.HTableDescriptor.isCompactionEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java HTableDescriptor.isCompactionEnabled方法的具体用法?Java HTableDescriptor.isCompactionEnabled怎么用?Java HTableDescriptor.isCompactionEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.HTableDescriptor的用法示例。


在下文中一共展示了HTableDescriptor.isCompactionEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRecoveryAndDoubleExecutionOnline

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testRecoveryAndDoubleExecutionOnline() throws Exception {
  final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecutionOnline");
  final String cf2 = "cf2";
  final String cf3 = "cf3";
  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  HRegionInfo[] regions = MasterProcedureTestingUtility.createTable(
    procExec, tableName, null, "cf1", cf3);

  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  // Modify multiple properties of the table.
  HTableDescriptor htd = new HTableDescriptor(UTIL.getHBaseAdmin().getTableDescriptor(tableName));
  boolean newCompactionEnableOption = htd.isCompactionEnabled() ? false : true;
  htd.setCompactionEnabled(newCompactionEnableOption);
  htd.addFamily(new HColumnDescriptor(cf2));
  htd.removeFamily(cf3.getBytes());

  // Start the Modify procedure && kill the executor
  long procId = procExec.submitProcedure(
    new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce);

  // Restart the executor and execute the step twice
  int numberOfSteps = ModifyTableState.values().length;
  MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(procExec, procId, numberOfSteps,
    ModifyTableState.values());

  // Validate descriptor
  HTableDescriptor currentHtd = UTIL.getHBaseAdmin().getTableDescriptor(tableName);
  assertEquals(newCompactionEnableOption, currentHtd.isCompactionEnabled());
  assertEquals(2, currentHtd.getFamiliesKeys().size());
  assertTrue(currentHtd.hasFamily(cf2.getBytes()));
  assertFalse(currentHtd.hasFamily(cf3.getBytes()));

  // cf2 should be added cf3 should be removed
  MasterProcedureTestingUtility.validateTableCreation(UTIL.getHBaseCluster().getMaster(),
    tableName, regions, "cf1", cf2);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:TestModifyTableProcedure.java

示例2: testRollbackAndDoubleExecutionOnline

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testRollbackAndDoubleExecutionOnline() throws Exception {
  final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecution");
  final String familyName = "cf2";
  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  HRegionInfo[] regions = MasterProcedureTestingUtility.createTable(
    procExec, tableName, null, "cf1");

  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  HTableDescriptor htd = new HTableDescriptor(UTIL.getHBaseAdmin().getTableDescriptor(tableName));
  boolean newCompactionEnableOption = htd.isCompactionEnabled() ? false : true;
  htd.setCompactionEnabled(newCompactionEnableOption);
  htd.addFamily(new HColumnDescriptor(familyName));

  // Start the Modify procedure && kill the executor
  long procId = procExec.submitProcedure(
    new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce);

  // Restart the executor and rollback the step twice
  int numberOfSteps = ModifyTableState.values().length - 4; // failing in the middle of proc
  MasterProcedureTestingUtility.testRollbackAndDoubleExecution(
    procExec,
    procId,
    numberOfSteps,
    ModifyTableState.values());

  // cf2 should not be present
  MasterProcedureTestingUtility.validateTableCreation(UTIL.getHBaseCluster().getMaster(),
    tableName, regions, "cf1");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:TestModifyTableProcedure.java

示例3: testRollbackAndDoubleExecutionOffline

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testRollbackAndDoubleExecutionOffline() throws Exception {
  final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecution");
  final String familyName = "cf2";
  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  HRegionInfo[] regions = MasterProcedureTestingUtility.createTable(
    procExec, tableName, null, "cf1");
  UTIL.getHBaseAdmin().disableTable(tableName);

  ProcedureTestingUtility.waitNoProcedureRunning(procExec);
  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  HTableDescriptor htd = new HTableDescriptor(UTIL.getHBaseAdmin().getTableDescriptor(tableName));
  boolean newCompactionEnableOption = htd.isCompactionEnabled() ? false : true;
  htd.setCompactionEnabled(newCompactionEnableOption);
  htd.addFamily(new HColumnDescriptor(familyName));
  htd.setRegionReplication(3);

  // Start the Modify procedure && kill the executor
  long procId = procExec.submitProcedure(
    new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce);

  // Restart the executor and rollback the step twice
  int numberOfSteps = ModifyTableState.values().length - 4; // failing in the middle of proc
  MasterProcedureTestingUtility.testRollbackAndDoubleExecution(
    procExec,
    procId,
    numberOfSteps,
    ModifyTableState.values());

  // cf2 should not be present
  MasterProcedureTestingUtility.validateTableCreation(UTIL.getHBaseCluster().getMaster(),
    tableName, regions, "cf1");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:37,代码来源:TestModifyTableProcedure.java

示例4: testRecoveryAndDoubleExecutionOffline

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testRecoveryAndDoubleExecutionOffline() throws Exception {
  final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecutionOffline");
  final String cf2 = "cf2";
  final String cf3 = "cf3";
  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  HRegionInfo[] regions = MasterProcedureTestingUtility.createTable(
    procExec, tableName, null, "cf1", cf3);
  UTIL.getHBaseAdmin().disableTable(tableName);

  ProcedureTestingUtility.waitNoProcedureRunning(procExec);
  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  // Modify multiple properties of the table.
  HTableDescriptor htd = new HTableDescriptor(UTIL.getHBaseAdmin().getTableDescriptor(tableName));
  boolean newCompactionEnableOption = htd.isCompactionEnabled() ? false : true;
  htd.setCompactionEnabled(newCompactionEnableOption);
  htd.addFamily(new HColumnDescriptor(cf2));
  htd.removeFamily(cf3.getBytes());
  htd.setRegionReplication(3);

  // Start the Modify procedure && kill the executor
  long procId = procExec.submitProcedure(
    new ModifyTableProcedure(procExec.getEnvironment(), htd), nonceGroup, nonce);

  // Restart the executor and execute the step twice
  int numberOfSteps = ModifyTableState.values().length;
  MasterProcedureTestingUtility.testRecoveryAndDoubleExecution(
    procExec,
    procId,
    numberOfSteps,
    ModifyTableState.values());

  // Validate descriptor
  HTableDescriptor currentHtd = UTIL.getHBaseAdmin().getTableDescriptor(tableName);
  assertEquals(newCompactionEnableOption, currentHtd.isCompactionEnabled());
  assertEquals(2, currentHtd.getFamiliesKeys().size());

  // cf2 should be added cf3 should be removed
  MasterProcedureTestingUtility.validateTableCreation(UTIL.getHBaseCluster().getMaster(),
    tableName, regions, false, "cf1", cf2);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:45,代码来源:TestModifyTableProcedure.java


注:本文中的org.apache.hadoop.hbase.HTableDescriptor.isCompactionEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。