Skip to content

Commit

Permalink
Revert "HBASE-28215 CreateTableProcedure and DeleteTableProcedure sho…
Browse files Browse the repository at this point in the history
…uld sleep a while before retrying (apache#5502)"

This reverts commit aaeef2d.
  • Loading branch information
Apache9 authored and mnpoonia committed Apr 24, 2024
1 parent 6389e37 commit fd20867
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
import org.apache.hadoop.hbase.master.MasterFileSystem;
import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer;
import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException;
import org.apache.hadoop.hbase.procedure2.ProcedureUtil;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerValidationUtils;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.FSTableDescriptors;
import org.apache.hadoop.hbase.util.ModifyRegionUtils;
import org.apache.hadoop.hbase.util.RetryCounter;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -54,7 +51,6 @@
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.CreateTableState;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos;

@InterfaceAudience.Private
public class CreateTableProcedure extends AbstractStateMachineTableProcedure<CreateTableState> {
Expand All @@ -64,7 +60,6 @@ public class CreateTableProcedure extends AbstractStateMachineTableProcedure<Cre

private TableDescriptor tableDescriptor;
private List<RegionInfo> newRegions;
private RetryCounter retryCounter;

public CreateTableProcedure() {
// Required by the Procedure framework to create the procedure on replay
Expand All @@ -85,7 +80,7 @@ public CreateTableProcedure(final MasterProcedureEnv env, final TableDescriptor

@Override
protected Flow executeFromState(final MasterProcedureEnv env, final CreateTableState state)
throws InterruptedException, ProcedureSuspendedException {
throws InterruptedException {
LOG.info("{} execute state={}", this, state);
try {
switch (state) {
Expand Down Expand Up @@ -136,7 +131,6 @@ protected Flow executeFromState(final MasterProcedureEnv env, final CreateTableS
break;
case CREATE_TABLE_POST_OPERATION:
postCreate(env);
retryCounter = null;
return Flow.NO_MORE_STATE;
default:
throw new UnsupportedOperationException("unhandled state=" + state);
Expand All @@ -145,26 +139,12 @@ protected Flow executeFromState(final MasterProcedureEnv env, final CreateTableS
if (isRollbackSupported(state)) {
setFailure("master-create-table", e);
} else {
if (retryCounter == null) {
retryCounter = ProcedureUtil.createRetryCounter(env.getMasterConfiguration());
}
long backoff = retryCounter.getBackoffTimeAndIncrementAttempts();
LOG.warn("Retriable error trying to create table={},state={},suspend {}secs.",
getTableName(), state, backoff / 1000, e);
throw suspend(Math.toIntExact(backoff), true);
LOG.warn("Retriable error trying to create table=" + getTableName() + " state=" + state, e);
}
}
retryCounter = null;
return Flow.HAS_MORE_STATE;
}

@Override
protected synchronized boolean setTimeoutFailure(MasterProcedureEnv env) {
setState(ProcedureProtos.ProcedureState.RUNNABLE);
env.getProcedureScheduler().addFront(this);
return false;
}

@Override
protected void rollbackState(final MasterProcedureEnv env, final CreateTableState state)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@
import org.apache.hadoop.hbase.mob.MobConstants;
import org.apache.hadoop.hbase.mob.MobUtils;
import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer;
import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException;
import org.apache.hadoop.hbase.procedure2.ProcedureUtil;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.util.RetryCounter;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -57,15 +54,13 @@
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.DeleteTableState;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos;

@InterfaceAudience.Private
public class DeleteTableProcedure extends AbstractStateMachineTableProcedure<DeleteTableState> {
private static final Logger LOG = LoggerFactory.getLogger(DeleteTableProcedure.class);

private List<RegionInfo> regions;
private TableName tableName;
private RetryCounter retryCounter;

public DeleteTableProcedure() {
// Required by the Procedure framework to create the procedure on replay
Expand All @@ -84,7 +79,7 @@ public DeleteTableProcedure(final MasterProcedureEnv env, final TableName tableN

@Override
protected Flow executeFromState(final MasterProcedureEnv env, DeleteTableState state)
throws InterruptedException, ProcedureSuspendedException {
throws InterruptedException {
if (LOG.isTraceEnabled()) {
LOG.trace(this + " execute state=" + state);
}
Expand Down Expand Up @@ -129,7 +124,6 @@ protected Flow executeFromState(final MasterProcedureEnv env, DeleteTableState s
break;
case DELETE_TABLE_POST_OPERATION:
postDelete(env);
retryCounter = null;
LOG.debug("Finished {}", this);
return Flow.NO_MORE_STATE;
default:
Expand All @@ -139,26 +133,12 @@ protected Flow executeFromState(final MasterProcedureEnv env, DeleteTableState s
if (isRollbackSupported(state)) {
setFailure("master-delete-table", e);
} else {
if (retryCounter == null) {
retryCounter = ProcedureUtil.createRetryCounter(env.getMasterConfiguration());
}
long backoff = retryCounter.getBackoffTimeAndIncrementAttempts();
LOG.warn("Retriable error trying to delete table={},state={},suspend {}secs.",
getTableName(), state, backoff / 1000, e);
throw suspend(Math.toIntExact(backoff), true);
LOG.warn("Retriable error trying to delete table=" + getTableName() + " state=" + state, e);
}
}
retryCounter = null;
return Flow.HAS_MORE_STATE;
}

@Override
protected synchronized boolean setTimeoutFailure(MasterProcedureEnv env) {
setState(ProcedureProtos.ProcedureState.RUNNABLE);
env.getProcedureScheduler().addFront(this);
return false;
}

@Override
protected boolean abort(MasterProcedureEnv env) {
// TODO: Current behavior is: with no rollback and no abort support, procedure may get stuck
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.hadoop.hbase.master.MasterFileSystem;
import org.apache.hadoop.hbase.procedure2.Procedure;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException;
import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerFactory;
import org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerForTest;
Expand Down Expand Up @@ -245,8 +244,7 @@ public CreateTableProcedureOnHDFSFailure(final MasterProcedureEnv env,

@Override
protected Flow executeFromState(MasterProcedureEnv env,
MasterProcedureProtos.CreateTableState state)
throws InterruptedException, ProcedureSuspendedException {
MasterProcedureProtos.CreateTableState state) throws InterruptedException {

if (
!failOnce && state == MasterProcedureProtos.CreateTableState.CREATE_TABLE_WRITE_FS_LAYOUT
Expand Down

0 comments on commit fd20867

Please sign in to comment.