HBASE-22943 Various procedures should not cache log trace level (#557)

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 84cc511742)
This commit is contained in:
Sean Busbey 2019-08-28 11:29:09 -05:00
parent 29d168d90f
commit 3b6f6b623d
4 changed files with 4 additions and 66 deletions

View File

@ -97,7 +97,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.S
public class SplitTableRegionProcedure public class SplitTableRegionProcedure
extends AbstractStateMachineRegionProcedure<SplitTableRegionState> { extends AbstractStateMachineRegionProcedure<SplitTableRegionState> {
private static final Logger LOG = LoggerFactory.getLogger(SplitTableRegionProcedure.class); private static final Logger LOG = LoggerFactory.getLogger(SplitTableRegionProcedure.class);
private Boolean traceEnabled = null;
private RegionInfo daughter_1_RI; private RegionInfo daughter_1_RI;
private RegionInfo daughter_2_RI; private RegionInfo daughter_2_RI;
private byte[] bestSplitRow; private byte[] bestSplitRow;
@ -320,9 +319,7 @@ public class SplitTableRegionProcedure
@Override @Override
protected void rollbackState(final MasterProcedureEnv env, final SplitTableRegionState state) protected void rollbackState(final MasterProcedureEnv env, final SplitTableRegionState state)
throws IOException, InterruptedException { throws IOException, InterruptedException {
if (isTraceEnabled()) { LOG.trace("{} rollback state={}", this, state);
LOG.trace(this + " rollback state=" + state);
}
try { try {
switch (state) { switch (state) {
@ -915,18 +912,6 @@ public class SplitTableRegionProcedure
} }
} }
/**
* The procedure could be restarted from a different machine. If the variable is null, we need to
* retrieve it.
* @return traceEnabled
*/
private boolean isTraceEnabled() {
if (traceEnabled == null) {
traceEnabled = LOG.isTraceEnabled();
}
return traceEnabled;
}
@Override @Override
protected boolean abort(MasterProcedureEnv env) { protected boolean abort(MasterProcedureEnv env) {
// Abort means rollback. We can't rollback all steps. HBASE-18018 added abort to all // Abort means rollback. We can't rollback all steps. HBASE-18018 added abort to all

View File

@ -76,8 +76,6 @@ public class CloneSnapshotProcedure
// Monitor // Monitor
private MonitoredTask monitorStatus = null; private MonitoredTask monitorStatus = null;
private Boolean traceEnabled = null;
/** /**
* Constructor (for failover) * Constructor (for failover)
*/ */
@ -128,9 +126,7 @@ public class CloneSnapshotProcedure
@Override @Override
protected Flow executeFromState(final MasterProcedureEnv env, final CloneSnapshotState state) protected Flow executeFromState(final MasterProcedureEnv env, final CloneSnapshotState state)
throws InterruptedException { throws InterruptedException {
if (isTraceEnabled()) { LOG.trace("{} execute state={}", this, state);
LOG.trace(this + " execute state=" + state);
}
try { try {
switch (state) { switch (state) {
case CLONE_SNAPSHOT_PRE_OPERATION: case CLONE_SNAPSHOT_PRE_OPERATION:
@ -498,15 +494,4 @@ public class CloneSnapshotProcedure
metaChanges.updateMetaParentRegions(env.getMasterServices().getConnection(), newRegions); metaChanges.updateMetaParentRegions(env.getMasterServices().getConnection(), newRegions);
} }
/**
* The procedure could be restarted from a different machine. If the variable is null, we need to
* retrieve it.
* @return traceEnabled
*/
private Boolean isTraceEnabled() {
if (traceEnabled == null) {
traceEnabled = LOG.isTraceEnabled();
}
return traceEnabled;
}
} }

View File

@ -54,8 +54,6 @@ public class EnableTableProcedure
private TableName tableName; private TableName tableName;
private boolean skipTableStateCheck; private boolean skipTableStateCheck;
private Boolean traceEnabled = null;
public EnableTableProcedure() { public EnableTableProcedure() {
super(); super();
} }
@ -88,9 +86,7 @@ public class EnableTableProcedure
@Override @Override
protected Flow executeFromState(final MasterProcedureEnv env, final EnableTableState state) protected Flow executeFromState(final MasterProcedureEnv env, final EnableTableState state)
throws InterruptedException { throws InterruptedException {
if (isTraceEnabled()) { LOG.trace("{} execute state={}", this, state);
LOG.trace(this + " execute state=" + state);
}
try { try {
switch (state) { switch (state) {
@ -402,18 +398,6 @@ public class EnableTableProcedure
runCoprocessorAction(env, state); runCoprocessorAction(env, state);
} }
/**
* The procedure could be restarted from a different machine. If the variable is null, we need to
* retrieve it.
* @return traceEnabled
*/
private Boolean isTraceEnabled() {
if (traceEnabled == null) {
traceEnabled = LOG.isTraceEnabled();
}
return traceEnabled;
}
/** /**
* Coprocessor Action. * Coprocessor Action.
* @param env MasterProcedureEnv * @param env MasterProcedureEnv

View File

@ -77,8 +77,6 @@ public class RestoreSnapshotProcedure
// Monitor // Monitor
private MonitoredTask monitorStatus = null; private MonitoredTask monitorStatus = null;
private Boolean traceEnabled = null;
/** /**
* Constructor (for failover) * Constructor (for failover)
*/ */
@ -129,9 +127,7 @@ public class RestoreSnapshotProcedure
@Override @Override
protected Flow executeFromState(final MasterProcedureEnv env, final RestoreSnapshotState state) protected Flow executeFromState(final MasterProcedureEnv env, final RestoreSnapshotState state)
throws InterruptedException { throws InterruptedException {
if (isTraceEnabled()) { LOG.trace("{} execute state={}", this, state);
LOG.trace(this + " execute state=" + state);
}
// Make sure that the monitor status is set up // Make sure that the monitor status is set up
getMonitorStatus(); getMonitorStatus();
@ -549,16 +545,4 @@ public class RestoreSnapshotProcedure
env.getMasterServices().getConfiguration()); env.getMasterServices().getConfiguration());
} }
} }
/**
* The procedure could be restarted from a different machine. If the variable is null, we need to
* retrieve it.
* @return traceEnabled
*/
private Boolean isTraceEnabled() {
if (traceEnabled == null) {
traceEnabled = LOG.isTraceEnabled();
}
return traceEnabled;
}
} }