@Override protected void rollbackState(final MasterProcedureEnv env, final CreateTableState state) throws IOException { if (state == CreateTableState.CREATE_TABLE_PRE_OPERATION) { // nothing to rollback, pre-create is just table-state checks. // We can fail if the table does exist or the descriptor is malformed. // TODO: coprocessor rollback semantic is still undefined. DeleteTableProcedure.deleteTableStates(env, getTableName()); final MasterCoprocessorHost cpHost = env.getMasterCoprocessorHost(); if (cpHost != null) { cpHost.postDeleteTable(getTableName()); } releaseSyncLatch(); return; } // The procedure doesn't have a rollback. The execution will succeed, at some point. throw new UnsupportedOperationException("unhandled state=" + state); }
@Override protected void run() throws IOException { getMaster().getMasterCoprocessorHost().preDeleteTable(tableName); LOG.info(getClientIdAuditPrefix() + " delete " + tableName); // TODO: We can handle/merge duplicate request // // 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 DeleteTableProcedure(procedureExecutor.getEnvironment(), tableName, latch)); latch.await(); getMaster().getMasterCoprocessorHost().postDeleteTable(tableName); }
@Override public void deleteTable(final byte [] tableName) throws IOException { checkInitialized(); if (cpHost != null) { cpHost.preDeleteTable(tableName); } this.executorService.submit(new DeleteTableHandler(tableName, this, this)); if (cpHost != null) { cpHost.postDeleteTable(tableName); } }
@Override public long deleteTable( final TableName tableName, final long nonceGroup, final long nonce) throws IOException { checkInitialized(); if (cpHost != null) { cpHost.preDeleteTable(tableName); } LOG.info(getClientIdAuditPrefix() + " delete " + tableName); // TODO: We can handle/merge duplicate request ProcedurePrepareLatch latch = ProcedurePrepareLatch.createLatch(); long procId = this.procedureExecutor.submitProcedure( new DeleteTableProcedure(procedureExecutor.getEnvironment(), tableName, latch), nonceGroup, nonce); latch.await(); if (cpHost != null) { cpHost.postDeleteTable(tableName); } return procId; }