@Override protected void run() throws IOException { TableDescriptor oldDescriptor = getMaster().getTableDescriptors().get(tableName); TableDescriptor newDescriptor = getMaster().getMasterCoprocessorHost() .preModifyTable(tableName, oldDescriptor, newDescriptorGetter.get()); sanityCheckTableDescriptor(newDescriptor); LOG.info("{} modify table {} from {} to {}", getClientIdAuditPrefix(), tableName, oldDescriptor, newDescriptor); // Execute the operation synchronously - wait for the operation completes before // continuing. // // We need to wait for the procedure to potentially fail due to "prepare" sanity // checks. This will block only the beginning of the procedure. See HBASE-19953. ProcedurePrepareLatch latch = ProcedurePrepareLatch.createBlockingLatch(); submitProcedure( new ModifyTableProcedure(procedureExecutor.getEnvironment(), newDescriptor, latch)); latch.await(); getMaster().getMasterCoprocessorHost().postModifyTable(tableName, oldDescriptor, newDescriptor); }
@Override public void modifyTable(final byte[] tableName, HTableDescriptor htd) throws IOException { checkInitialized(); if (cpHost != null) { cpHost.preModifyTable(tableName, htd); } TableEventHandler tblHandler = new ModifyTableHandler(tableName, htd, this, this); this.executorService.submit(tblHandler); // prevent client from querying status even before the event is being handled. tblHandler.waitForEventBeingHandled(); if (cpHost != null) { cpHost.postModifyTable(tableName, htd); } }
@Override public void modifyTable( final TableName tableName, final HTableDescriptor descriptor, final long nonceGroup, final long nonce) throws IOException { checkInitialized(); sanityCheckTableDescriptor(descriptor); if (cpHost != null) { cpHost.preModifyTable(tableName, descriptor); } LOG.info(getClientIdAuditPrefix() + " modify " + tableName); // Execute the operation synchronously - wait for the operation completes before continuing. long procId = this.procedureExecutor.submitProcedure( new ModifyTableProcedure(procedureExecutor.getEnvironment(), descriptor), nonceGroup, nonce); ProcedureSyncWait.waitForProcedureToComplete(procedureExecutor, procId); if (cpHost != null) { cpHost.postModifyTable(tableName, descriptor); } }