當前位置: 首頁>>代碼示例>>Java>>正文


Java HColumnDescriptor.getBlocksize方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HColumnDescriptor.getBlocksize方法的典型用法代碼示例。如果您正苦於以下問題:Java HColumnDescriptor.getBlocksize方法的具體用法?Java HColumnDescriptor.getBlocksize怎麽用?Java HColumnDescriptor.getBlocksize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.HColumnDescriptor的用法示例。


在下文中一共展示了HColumnDescriptor.getBlocksize方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testModifyColumnFamily

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test
public void testModifyColumnFamily() throws IOException {
  Admin admin = TEST_UTIL.getHBaseAdmin();

  HColumnDescriptor cfDescriptor = new HColumnDescriptor(FAMILY_0);
  int blockSize = cfDescriptor.getBlocksize();
  // Create a table with one families
  HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
  baseHtd.addFamily(cfDescriptor);
  admin.createTable(baseHtd);
  admin.disableTable(TABLE_NAME);
  try {
    // Verify the table descriptor
    verifyTableDescriptor(TABLE_NAME, FAMILY_0);

    int newBlockSize = 2 * blockSize;
    cfDescriptor.setBlocksize(newBlockSize);

    // Modify colymn family
    admin.modifyColumn(TABLE_NAME, cfDescriptor);

    HTableDescriptor htd = admin.getTableDescriptor(TABLE_NAME);
    HColumnDescriptor hcfd = htd.getFamily(FAMILY_0);
    assertTrue(hcfd.getBlocksize() == newBlockSize);
  } finally {
    admin.deleteTable(TABLE_NAME);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:TestTableDescriptorModification.java

示例2: testModifyNonExistingColumnFamily

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test
public void testModifyNonExistingColumnFamily() throws IOException {
  Admin admin = TEST_UTIL.getHBaseAdmin();

  HColumnDescriptor cfDescriptor = new HColumnDescriptor(FAMILY_1);
  int blockSize = cfDescriptor.getBlocksize();
  // Create a table with one families
  HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
  baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
  admin.createTable(baseHtd);
  admin.disableTable(TABLE_NAME);
  try {
    // Verify the table descriptor
    verifyTableDescriptor(TABLE_NAME, FAMILY_0);

    int newBlockSize = 2 * blockSize;
    cfDescriptor.setBlocksize(newBlockSize);

    // Modify a column family that is not in the table.
    try {
      admin.modifyColumn(TABLE_NAME, cfDescriptor);
      Assert.fail("Modify a non-exist column family should fail");
    } catch (InvalidFamilyOperationException e) {
      // Expected.
    }

  } finally {
    admin.deleteTable(TABLE_NAME);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:TestTableDescriptorModification.java

示例3: testModifyColumnFamily

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test(timeout = 60000)
public void testModifyColumnFamily() throws Exception {
  final TableName tableName = TableName.valueOf("testModifyColumnFamily");
  final String cf1 = "cf1";
  final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf1);
  int oldBlockSize = columnDescriptor.getBlocksize();
  int newBlockSize = 3 * oldBlockSize;

  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  MasterProcedureTestingUtility.createTable(procExec, tableName, null, cf1, "f2");

  // Test 1: modify the column family online
  columnDescriptor.setBlocksize(newBlockSize);
  long procId1 = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup,
    nonce);
  // Wait the completion
  ProcedureTestingUtility.waitProcedure(procExec, procId1);
  ProcedureTestingUtility.assertProcNotFailed(procExec, procId1);
  MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster()
      .getMaster(), tableName, cf1, columnDescriptor);

  // Test 2: modify the column family offline
  UTIL.getHBaseAdmin().disableTable(tableName);
  columnDescriptor.setBlocksize(newBlockSize * 2);
  long procId2 = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup + 1,
    nonce + 1);
  // Wait the completion
  ProcedureTestingUtility.waitProcedure(procExec, procId2);
  ProcedureTestingUtility.assertProcNotFailed(procExec, procId2);
  MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster()
      .getMaster(), tableName, cf1, columnDescriptor);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:38,代碼來源:TestModifyColumnFamilyProcedure.java

示例4: testModifyNonExistingColumnFamily

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test(timeout=60000)
public void testModifyNonExistingColumnFamily() throws Exception {
  final TableName tableName = TableName.valueOf("testModifyExistingColumnFamily");
  final String cf2 = "cf2";
  final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf2);
  int oldBlockSize = columnDescriptor.getBlocksize();
  int newBlockSize = 2 * oldBlockSize;

  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1");

  // Modify the column family that does not exist
  columnDescriptor.setBlocksize(newBlockSize);
  long procId1 = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup,
    nonce);
  // Wait the completion
  ProcedureTestingUtility.waitProcedure(procExec, procId1);

  ProcedureInfo result = procExec.getResult(procId1);
  assertTrue(result.isFailed());
  LOG.debug("Modify failed with exception: " + result.getExceptionFullMessage());
  assertTrue(
    ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:28,代碼來源:TestModifyColumnFamilyProcedure.java

示例5: testRecoveryAndDoubleExecutionOffline

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test(timeout=60000)
public void testRecoveryAndDoubleExecutionOffline() throws Exception {
  final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecutionOffline");
  final String cf3 = "cf3";
  final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf3);
  int oldBlockSize = columnDescriptor.getBlocksize();
  int newBlockSize = 4 * oldBlockSize;

  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf3);
  UTIL.getHBaseAdmin().disableTable(tableName);
  ProcedureTestingUtility.waitNoProcedureRunning(procExec);
  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  // Start the Modify procedure && kill the executor
  columnDescriptor.setBlocksize(newBlockSize);
  long procId = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup,
    nonce);

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

  MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster()
      .getMaster(), tableName, cf3, columnDescriptor);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:35,代碼來源:TestModifyColumnFamilyProcedure.java

示例6: testRecoveryAndDoubleExecutionOnline

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test(timeout = 60000)
public void testRecoveryAndDoubleExecutionOnline() throws Exception {
  final TableName tableName = TableName.valueOf("testRecoveryAndDoubleExecutionOnline");
  final String cf4 = "cf4";
  final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf4);
  int oldBlockSize = columnDescriptor.getBlocksize();
  int newBlockSize = 4 * oldBlockSize;

  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf4);
  ProcedureTestingUtility.waitNoProcedureRunning(procExec);
  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  // Start the Modify procedure && kill the executor
  columnDescriptor.setBlocksize(newBlockSize);
  long procId = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup,
    nonce);

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

  MasterProcedureTestingUtility.validateColumnFamilyModification(UTIL.getHBaseCluster()
      .getMaster(), tableName, cf4, columnDescriptor);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:TestModifyColumnFamilyProcedure.java

示例7: testRollbackAndDoubleExecution

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
@Test(timeout = 60000)
public void testRollbackAndDoubleExecution() throws Exception {
  final TableName tableName = TableName.valueOf("testRollbackAndDoubleExecution");
  final String cf3 = "cf3";
  final HColumnDescriptor columnDescriptor = new HColumnDescriptor(cf3);
  int oldBlockSize = columnDescriptor.getBlocksize();
  int newBlockSize = 4 * oldBlockSize;

  final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();

  // create the table
  MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2", cf3);
  ProcedureTestingUtility.waitNoProcedureRunning(procExec);
  ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, true);

  // Start the Modify procedure && kill the executor
  columnDescriptor.setBlocksize(newBlockSize);
  long procId = procExec.submitProcedure(
    new ModifyColumnFamilyProcedure(procExec.getEnvironment(), tableName, columnDescriptor),
    nonceGroup,
    nonce);

  // Failing in the middle of proc
  int numberOfSteps = ModifyColumnFamilyState.values().length - 2;
  MasterProcedureTestingUtility.testRollbackAndDoubleExecution(
    procExec,
    procId,
    numberOfSteps,
    ModifyColumnFamilyState.values());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:TestModifyColumnFamilyProcedure.java


注:本文中的org.apache.hadoop.hbase.HColumnDescriptor.getBlocksize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。