本文整理汇总了Java中org.apache.hadoop.hbase.master.MasterCoprocessorHost类的典型用法代码示例。如果您正苦于以下问题:Java MasterCoprocessorHost类的具体用法?Java MasterCoprocessorHost怎么用?Java MasterCoprocessorHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MasterCoprocessorHost类属于org.apache.hadoop.hbase.master包,在下文中一共展示了MasterCoprocessorHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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());
}