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


Java InvalidFamilyOperationException类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.InvalidFamilyOperationException的典型用法代码示例。如果您正苦于以下问题:Java InvalidFamilyOperationException类的具体用法?Java InvalidFamilyOperationException怎么用?Java InvalidFamilyOperationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createColumnFamily

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
private void createColumnFamily(HColumnDescriptor family, TableName table)
    throws IOException {
  try {
    admin.addColumn(table, family);
  } catch (InvalidFamilyOperationException e) {
    if (!hasFamily(family, table)) {
      //Schroedinger's cat: InvalidFamilyOperationException (cf exists) but does not exist at the same time
      throw new IllegalStateException("Column family should exist but does not", e);
    }
    //columnFamily was created in the meantime
    return;
  }
  waitForColumnFamilyCreation(family, table);
  log.info("Created column family '{}' in HBase table '{}'", family.getNameAsString(),
      table.getNameAsString());
}
 
开发者ID:bakdata,项目名称:ignite-hbase,代码行数:17,代码来源:AdminContext.java

示例2: modifyColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Modify Column of a table
 * @param tableName
 * @param hcd HColumnDesciptor
 * @return Modified HTableDescriptor with the column modified.
 * @throws IOException
 */
public HTableDescriptor modifyColumn(TableName tableName, HColumnDescriptor hcd)
    throws IOException {
  LOG.info("AddModifyColumn. Table = " + tableName
      + " HCD = " + hcd.toString());

  HTableDescriptor htd = this.services.getTableDescriptors().get(tableName);
  byte [] familyName = hcd.getName();
  if(!htd.hasFamily(familyName)) {
    throw new InvalidFamilyOperationException("Family '" +
      Bytes.toString(familyName) + "' doesn't exists so cannot be modified");
  }
  htd.modifyFamily(hcd);
  this.services.getTableDescriptors().add(htd);
  return htd;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:MasterFileSystem.java

示例3: prepareDelete

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Action before any real action of deleting column family.
 * @param env MasterProcedureEnv
 * @throws IOException
 */
private void prepareDelete(final MasterProcedureEnv env) throws IOException {
  // Checks whether the table is allowed to be modified.
  MasterDDLOperationHelper.checkTableModifiable(env, tableName);

  // In order to update the descriptor, we need to retrieve the old descriptor for comparison.
  unmodifiedHTableDescriptor = env.getMasterServices().getTableDescriptors().get(tableName);
  if (unmodifiedHTableDescriptor == null) {
    throw new IOException("HTableDescriptor missing for " + tableName);
  }
  if (!unmodifiedHTableDescriptor.hasFamily(familyName)) {
    throw new InvalidFamilyOperationException("Family '" + getColumnFamilyName()
        + "' does not exist, so it cannot be deleted");
  }

  if (unmodifiedHTableDescriptor.getColumnFamilies().length == 1) {
    throw new InvalidFamilyOperationException("Family '" + getColumnFamilyName()
      + "' is the only column family in the table, so it cannot be deleted");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:DeleteColumnFamilyProcedure.java

示例4: testDeleteNonExistingColumnFamily

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

  final String cf3 = "cf3";

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

  // delete the column family that does not exist
  long procId1 = procExec.submitProcedure(
    new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf3.getBytes()),
    nonceGroup,
    nonce);
  // Wait the completion
  ProcedureTestingUtility.waitProcedure(procExec, procId1);

  ProcedureInfo result = procExec.getResult(procId1);
  assertTrue(result.isFailed());
  LOG.debug("Delete failed with exception: " + result.getExceptionFullMessage());
  assertTrue(
    ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:TestDeleteColumnFamilyProcedure.java

示例5: modifyColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Modify Column of a table
 * @param tableName
 * @param hcd HColumnDesciptor
 * @return Modified HTableDescriptor with the column modified.
 * @throws IOException
 */
public HTableDescriptor modifyColumn(byte[] tableName, HColumnDescriptor hcd)
    throws IOException {
  LOG.info("AddModifyColumn. Table = " + Bytes.toString(tableName)
      + " HCD = " + hcd.toString());

  HTableDescriptor htd = this.services.getTableDescriptors().get(tableName);
  byte [] familyName = hcd.getName();
  if(!htd.hasFamily(familyName)) {
    throw new InvalidFamilyOperationException("Family '" +
      Bytes.toString(familyName) + "' doesn't exists so cannot be modified");
  }
  htd.addFamily(hcd);
  this.services.getTableDescriptors().add(htd);
  return htd;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:23,代码来源:MasterFileSystem.java

示例6: modifyColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Modify Column of a table
 * @param tableName
 * @param hcd HColumnDesciptor
 * @return Modified HTableDescriptor with the column modified.
 * @throws IOException
 */
public HTableDescriptor modifyColumn(TableName tableName, HColumnDescriptor hcd)
    throws IOException {
  LOG.info("AddModifyColumn. Table = " + tableName
      + " HCD = " + hcd.toString());

  HTableDescriptor htd = this.services.getTableDescriptors().get(tableName);
  byte [] familyName = hcd.getName();
  if(!htd.hasFamily(familyName)) {
    throw new InvalidFamilyOperationException("Family '" +
      Bytes.toString(familyName) + "' doesn't exists so cannot be modified");
  }
  htd.addFamily(hcd);
  this.services.getTableDescriptors().add(htd);
  return htd;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:MasterFileSystem.java

示例7: addColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
@Override
public long addColumn(
    final TableName tableName,
    final ColumnFamilyDescriptor column,
    final long nonceGroup,
    final long nonce)
    throws IOException {
  checkInitialized();
  checkTableExists(tableName);

  TableDescriptor old = getTableDescriptors().get(tableName);
  if (old.hasColumnFamily(column.getName())) {
    throw new InvalidFamilyOperationException("Column family '" + column.getNameAsString()
        + "' in table '" + tableName + "' already exists so cannot be added");
  }

  TableDescriptor newDesc = TableDescriptorBuilder
      .newBuilder(old).addColumnFamily(column).build();
  return modifyTable(tableName, newDesc, nonceGroup, nonce);
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:HMaster.java

示例8: modifyColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
@Override
public long modifyColumn(
    final TableName tableName,
    final ColumnFamilyDescriptor descriptor,
    final long nonceGroup,
    final long nonce)
    throws IOException {
  checkInitialized();
  checkTableExists(tableName);

  TableDescriptor old = getTableDescriptors().get(tableName);
  if (! old.hasColumnFamily(descriptor.getName())) {
    throw new InvalidFamilyOperationException("Family '" + descriptor.getNameAsString()
        + "' does not exist, so it cannot be modified");
  }

  TableDescriptor td = TableDescriptorBuilder
      .newBuilder(old)
      .modifyColumnFamily(descriptor)
      .build();

  return modifyTable(tableName, td, nonceGroup, nonce);
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:HMaster.java

示例9: deleteColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
@Override
public long deleteColumn(
    final TableName tableName,
    final byte[] columnName,
    final long nonceGroup,
    final long nonce)
    throws IOException {
  checkInitialized();
  checkTableExists(tableName);

  TableDescriptor old = getTableDescriptors().get(tableName);

  if (! old.hasColumnFamily(columnName)) {
    throw new InvalidFamilyOperationException("Family '" + Bytes.toString(columnName)
        + "' does not exist, so it cannot be deleted");
  }
  if (old.getColumnFamilyCount() == 1) {
    throw new InvalidFamilyOperationException("Family '" + Bytes.toString(columnName)
        + "' is the only column family in the table, so it cannot be deleted");
  }

  TableDescriptor td = TableDescriptorBuilder
      .newBuilder(old).removeColumnFamily(columnName).build();
  return modifyTable(tableName, td, nonceGroup, nonce);
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:HMaster.java

示例10: addColumn

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Add column to a table
 * @param tableName
 * @param hcd
 * @return Modified HTableDescriptor with new column added.
 * @throws IOException
 */
public HTableDescriptor addColumn(TableName tableName, HColumnDescriptor hcd)
    throws IOException {
  LOG.info("AddColumn. Table = " + tableName + " HCD = " +
    hcd.toString());
  HTableDescriptor htd = this.services.getTableDescriptors().get(tableName);
  if (htd == null) {
    throw new InvalidFamilyOperationException("Family '" +
      hcd.getNameAsString() + "' cannot be modified as HTD is null");
  }
  htd.addFamily(hcd);
  this.services.getTableDescriptors().add(htd);
  return htd;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:MasterFileSystem.java

示例11: hasColumnFamily

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
byte [] hasColumnFamily(final HTableDescriptor htd, final byte [] cf)
throws InvalidFamilyOperationException {
  if (!htd.hasFamily(cf)) {
    throw new InvalidFamilyOperationException("Column family '" +
      Bytes.toString(cf) + "' does not exist");
  }
  return cf;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:TableEventHandler.java

示例12: prepareModify

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Action before any real action of modifying column family.
 * @param env MasterProcedureEnv
 * @throws IOException
 */
private void prepareModify(final MasterProcedureEnv env) throws IOException {
  // Checks whether the table is allowed to be modified.
  MasterDDLOperationHelper.checkTableModifiable(env, tableName);

  unmodifiedHTableDescriptor = env.getMasterServices().getTableDescriptors().get(tableName);
  if (unmodifiedHTableDescriptor == null) {
    throw new IOException("HTableDescriptor missing for " + tableName);
  }
  if (!unmodifiedHTableDescriptor.hasFamily(cfDescriptor.getName())) {
    throw new InvalidFamilyOperationException("Family '" + getColumnFamilyName()
        + "' does not exist, so it cannot be modified");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:ModifyColumnFamilyProcedure.java

示例13: prepareAdd

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
/**
 * Action before any real action of adding column family.
 * @param env MasterProcedureEnv
 * @throws IOException
 */
private void prepareAdd(final MasterProcedureEnv env) throws IOException {
  // Checks whether the table is allowed to be modified.
  MasterDDLOperationHelper.checkTableModifiable(env, tableName);

  // In order to update the descriptor, we need to retrieve the old descriptor for comparison.
  unmodifiedHTableDescriptor = env.getMasterServices().getTableDescriptors().get(tableName);
  if (unmodifiedHTableDescriptor == null) {
    throw new IOException("HTableDescriptor missing for " + tableName);
  }
  if (unmodifiedHTableDescriptor.hasFamily(cfDescriptor.getName())) {
    throw new InvalidFamilyOperationException("Column family '" + getColumnFamilyName()
        + "' in table '" + tableName + "' already exists so cannot be added");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:AddColumnFamilyProcedure.java

示例14: testAddSameColumnFamilyTwice

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的package包/类
@Test
public void testAddSameColumnFamilyTwice() throws IOException {
  Admin admin = TEST_UTIL.getHBaseAdmin();
  // 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);

    // Modify the table removing one family and verify the descriptor
    admin.addColumn(TABLE_NAME, new HColumnDescriptor(FAMILY_1));
    verifyTableDescriptor(TABLE_NAME, FAMILY_0, FAMILY_1);

    try {
      // Add same column family again - expect failure
      admin.addColumn(TABLE_NAME, new HColumnDescriptor(FAMILY_1));
      Assert.fail("Delete a non-exist column family should fail");
    } catch (InvalidFamilyOperationException e) {
      // Expected.
    }

  } finally {
    admin.deleteTable(TABLE_NAME);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:TestTableDescriptorModification.java

示例15: testModifyNonExistingColumnFamily

import org.apache.hadoop.hbase.InvalidFamilyOperationException; //导入依赖的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


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