• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MasterCoprocessorHost类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env,
    final ModifyColumnFamilyState state) throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case MODIFY_COLUMN_FAMILY_PRE_OPERATION:
          cpHost.preModifyColumnHandler(tableName, cfDescriptor);
          break;
        case MODIFY_COLUMN_FAMILY_POST_OPERATION:
          cpHost.postModifyColumnHandler(tableName, cfDescriptor);
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:ModifyColumnFamilyProcedure.java


示例2: preCreate

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
private void preCreate(final MasterProcedureEnv env)
    throws IOException, InterruptedException {
  if (!getTableName().isSystemTable()) {
    ProcedureSyncWait.getMasterQuotaManager(env)
      .checkNamespaceTableAndRegionQuota(getTableName(), newRegions.size());
  }

  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    final HRegionInfo[] regions = newRegions == null ? null :
      newRegions.toArray(new HRegionInfo[newRegions.size()]);
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        cpHost.preCreateTableHandler(hTableDescriptor, regions);
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:CreateTableProcedure.java


示例3: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env, final DisableTableState state)
    throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case DISABLE_TABLE_PRE_OPERATION:
          cpHost.preDisableTableHandler(tableName);
          break;
        case DISABLE_TABLE_POST_OPERATION:
          cpHost.postDisableTableHandler(tableName);
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:DisableTableProcedure.java


示例4: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env, final AddColumnFamilyState state)
    throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case ADD_COLUMN_FAMILY_PRE_OPERATION:
          cpHost.preAddColumnHandler(tableName, cfDescriptor);
          break;
        case ADD_COLUMN_FAMILY_POST_OPERATION:
          cpHost.postAddColumnHandler(tableName, cfDescriptor);
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:AddColumnFamilyProcedure.java


示例5: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env, final EnableTableState state)
    throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case ENABLE_TABLE_PRE_OPERATION:
          cpHost.preEnableTableHandler(getTableName());
          break;
        case ENABLE_TABLE_POST_OPERATION:
          cpHost.postEnableTableHandler(getTableName());
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:EnableTableProcedure.java


示例6: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env,
    final DeleteColumnFamilyState state) throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case DELETE_COLUMN_FAMILY_PRE_OPERATION:
          cpHost.preDeleteColumnHandler(tableName, familyName);
          break;
        case DELETE_COLUMN_FAMILY_POST_OPERATION:
          cpHost.postDeleteColumnHandler(tableName, familyName);
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:DeleteColumnFamilyProcedure.java


示例7: runCoprocessorAction

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
/**
 * Coprocessor Action.
 * @param env MasterProcedureEnv
 * @param state the procedure state
 * @throws IOException
 * @throws InterruptedException
 */
private void runCoprocessorAction(final MasterProcedureEnv env, final ModifyTableState state)
    throws IOException, InterruptedException {
  final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost();
  if (cpHost != null) {
    user.doAs(new PrivilegedExceptionAction<Void>() {
      @Override
      public Void run() throws Exception {
        switch (state) {
        case MODIFY_TABLE_PRE_OPERATION:
          cpHost.preModifyTableHandler(getTableName(), modifiedHTableDescriptor);
          break;
        case MODIFY_TABLE_POST_OPERATION:
          cpHost.postModifyTableHandler(getTableName(), modifiedHTableDescriptor);
          break;
        default:
          throw new UnsupportedOperationException(this + " unhandled state=" + state);
        }
        return null;
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:ModifyTableProcedure.java


示例8: testStarted

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test (timeout=180000)
public void testStarted() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  assertTrue("Master should be active", master.isActiveMaster());
  MasterCoprocessorHost host = master.getMasterCoprocessorHost();
  assertNotNull("CoprocessorHost should not be null", host);
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  assertNotNull("CPMasterObserver coprocessor not found or not installed!", cp);

  // check basic lifecycle
  assertTrue("MasterObserver should have been started", cp.wasStarted());
  assertTrue("preMasterInitialization() hook should have been called",
      cp.wasMasterInitializationCalled());
  assertTrue("postStartMaster() hook should have been called",
      cp.wasStartMasterCalled());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:TestMasterObserver.java


示例9: testTableDescriptorsEnumeration

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test (timeout=180000)
public void testTableDescriptorsEnumeration() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getMasterCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  cp.resetStates();

  GetTableDescriptorsRequest req =
      RequestConverter.buildGetTableDescriptorsRequest((List<TableName>)null);
  master.getMasterRpcServices().getTableDescriptors(null, req);

  assertTrue("Coprocessor should be called on table descriptors request",
    cp.wasGetTableDescriptorsCalled());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestMasterObserver.java


示例10: testStarted

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test
public void testStarted() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  assertTrue("Master should be active", master.isActiveMaster());
  MasterCoprocessorHost host = master.getCoprocessorHost();
  assertNotNull("CoprocessorHost should not be null", host);
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  assertNotNull("CPMasterObserver coprocessor not found or not installed!", cp);

  // check basic lifecycle
  assertTrue("MasterObserver should have been started", cp.wasStarted());
  assertTrue("postStartMaster() hook should have been called",
      cp.wasStartMasterCalled());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:18,代码来源:TestMasterObserver.java


示例11: handleTableOperation

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> hris)
throws IOException {
  MasterCoprocessorHost cpHost = ((HMaster) this.server).getMasterCoprocessorHost();
  if (cpHost != null) {
    cpHost.preModifyTableHandler(this.tableName, this.htd);
  }
  // Update descriptor
  HTableDescriptor oldHtd = getTableDescriptor();
  this.masterServices.getTableDescriptors().add(this.htd);
  deleteFamilyFromFS(hris, oldHtd.getFamiliesKeys());
  removeReplicaColumnsIfNeeded(this.htd.getRegionReplication(), oldHtd.getRegionReplication(),
      htd.getTableName());
  if (cpHost != null) {
    cpHost.postModifyTableHandler(this.tableName, this.htd);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:18,代码来源:ModifyTableHandler.java


示例12: handleTableOperation

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException {
  MasterCoprocessorHost cpHost = ((HMaster) this.server)
      .getMasterCoprocessorHost();
  if (cpHost != null) {
    cpHost.preDeleteColumnHandler(this.tableName, this.familyName);
  }
  // Update table descriptor
  this.masterServices.getMasterFileSystem().deleteColumn(tableName, familyName);
  // Remove the column family from the file system
  MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
  for (HRegionInfo hri : hris) {
    // Delete the family directory in FS for all the regions one by one
    mfs.deleteFamilyFromFS(hri, familyName);
  }
  if (cpHost != null) {
    cpHost.postDeleteColumnHandler(this.tableName, this.familyName);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:20,代码来源:TableDeleteFamilyHandler.java


示例13: handleTableOperation

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> regions)
    throws IOException, CoordinatedStateException {
  MasterCoprocessorHost cpHost = ((HMaster) this.server).getMasterCoprocessorHost();
  if (cpHost != null) {
    cpHost.preTruncateTableHandler(this.tableName);
  }

  // 1. Wait because of region in transition
  waitRegionInTransition(regions);

  // 2. Remove table from hbase:meta and HDFS
  removeTableData(regions);

  // -----------------------------------------------------------------------
  // PONR: At this point the table is deleted.
  //       If the recreate fails, the user can only re-create the table.
  // -----------------------------------------------------------------------

  // 3. Recreate the regions
  recreateTable(regions);

  if (cpHost != null) {
    cpHost.postTruncateTableHandler(this.tableName);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:TruncateTableHandler.java


示例14: process

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
public void process() {
  TableName tableName = this.hTableDescriptor.getTableName();
  LOG.info("Create table " + tableName);

  try {
    final MasterCoprocessorHost cpHost = ((HMaster) this.server).getMasterCoprocessorHost();
    if (cpHost != null) {
      cpHost.preCreateTableHandler(this.hTableDescriptor, this.newRegions);
    }
    handleCreateTable(tableName);
    completed(null);
    if (cpHost != null) {
      this.activeUser.runAs(new PrivilegedExceptionAction<Void>() {
        @Override
        public Void run() throws Exception {
          cpHost.postCreateTableHandler(hTableDescriptor, newRegions);
          return null;
        }
      });
    }
  } catch (Throwable e) {
    LOG.error("Error trying to create the table " + tableName, e);
    completed(e);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:27,代码来源:CreateTableHandler.java


示例15: testStarted

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test
public void testStarted() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  assertTrue("Master should be active", master.isActiveMaster());
  MasterCoprocessorHost host = master.getMasterCoprocessorHost();
  assertNotNull("CoprocessorHost should not be null", host);
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  assertNotNull("CPMasterObserver coprocessor not found or not installed!", cp);

  // check basic lifecycle
  assertTrue("MasterObserver should have been started", cp.wasStarted());
  assertTrue("preMasterInitialization() hook should have been called",
      cp.wasMasterInitializationCalled());
  assertTrue("postStartMaster() hook should have been called",
      cp.wasStartMasterCalled());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:20,代码来源:TestMasterObserver.java


示例16: testTableDescriptorsEnumeration

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test
public void testTableDescriptorsEnumeration() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getMasterCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  cp.resetStates();

  GetTableDescriptorsRequest req =
      RequestConverter.buildGetTableDescriptorsRequest((List<TableName>)null);
  master.getMasterRpcServices().getTableDescriptors(null, req);

  assertTrue("Coprocessor should be called on table descriptors request",
    cp.wasGetTableDescriptorsCalled());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:18,代码来源:TestMasterObserver.java


示例17: handleTableOperation

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
protected void handleTableOperation(List<HRegionInfo> hris) throws IOException {
  MasterCoprocessorHost cpHost = ((HMaster) this.server)
      .getCoprocessorHost();
  if (cpHost != null) {
    cpHost.preDeleteColumnHandler(this.tableName, this.familyName);
  }
  // Update table descriptor
  this.masterServices.getMasterFileSystem().deleteColumn(tableName, familyName);
  // Remove the column family from the file system
  MasterFileSystem mfs = this.masterServices.getMasterFileSystem();
  for (HRegionInfo hri : hris) {
    // Delete the family directory in FS for all the regions one by one
    mfs.deleteFamilyFromFS(hri, familyName);
  }
  if (cpHost != null) {
    cpHost.postDeleteColumnHandler(this.tableName, this.familyName);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:20,代码来源:TableDeleteFamilyHandler.java


示例18: process

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Override
public void process() {
  TableName tableName = this.hTableDescriptor.getTableName();
  LOG.info("Create table " + tableName);

  try {
    MasterCoprocessorHost cpHost = ((HMaster) this.server).getCoprocessorHost();
    if (cpHost != null) {
      cpHost.preCreateTableHandler(this.hTableDescriptor, this.newRegions);
    }
    handleCreateTable(tableName);
    completed(null);
    if (cpHost != null) {
      cpHost.postCreateTableHandler(this.hTableDescriptor, this.newRegions);
    }
  } catch (Throwable e) {
    LOG.error("Error trying to create the table " + tableName, e);
    completed(e);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:CreateTableHandler.java


示例19: testStarted

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test
public void testStarted() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  assertTrue("Master should be active", master.isActiveMaster());
  MasterCoprocessorHost host = master.getCoprocessorHost();
  assertNotNull("CoprocessorHost should not be null", host);
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  assertNotNull("CPMasterObserver coprocessor not found or not installed!", cp);

  // check basic lifecycle
  assertTrue("MasterObserver should have been started", cp.wasStarted());
  assertTrue("preMasterInitialization() hook should have been called",
      cp.wasMasterInitializationCalled());
  assertTrue("postStartMaster() hook should have been called",
      cp.wasStartMasterCalled());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:20,代码来源:TestMasterObserver.java


示例20: testTableDescriptorsEnumeration

import org.apache.hadoop.hbase.master.MasterCoprocessorHost; //导入依赖的package包/类
@Test
public void testTableDescriptorsEnumeration() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();

  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  cp.resetStates();

  GetTableDescriptorsRequest req =
      RequestConverter.buildGetTableDescriptorsRequest((List<TableName>)null);
  master.getTableDescriptors(null, req);

  assertTrue("Coprocessor should be called on table descriptors request",
    cp.wasGetTableDescriptorsCalled());
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:TestMasterObserver.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MixerProvider类代码示例发布时间:2022-05-21
下一篇:
Java LayoutConstants类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap