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

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
Sean Busbey 2019-08-28 11:29:09 -05:00
parent 56980fb097
commit 83e77940c5
4 changed files with 4 additions and 66 deletions

View File

@ -92,7 +92,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.S
public class SplitTableRegionProcedure
extends AbstractStateMachineRegionProcedure<SplitTableRegionState> {
private static final Logger LOG = LoggerFactory.getLogger(SplitTableRegionProcedure.class);
private Boolean traceEnabled = null;
private RegionInfo daughterOneRI;
private RegionInfo daughterTwoRI;
private byte[] bestSplitRow;
@ -341,9 +340,7 @@ public class SplitTableRegionProcedure
@Override
protected void rollbackState(final MasterProcedureEnv env, final SplitTableRegionState state)
throws IOException, InterruptedException {
if (isTraceEnabled()) {
LOG.trace(this + " rollback state=" + state);
}
LOG.trace("{} rollback state={}", this, state);
try {
switch (state) {
@ -887,18 +884,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
protected boolean abort(MasterProcedureEnv env) {
// Abort means rollback. We can't rollback all steps. HBASE-18018 added abort to all

View File

@ -78,8 +78,6 @@ public class CloneSnapshotProcedure
// Monitor
private MonitoredTask monitorStatus = null;
private Boolean traceEnabled = null;
/**
* Constructor (for failover)
*/
@ -130,9 +128,7 @@ public class CloneSnapshotProcedure
@Override
protected Flow executeFromState(final MasterProcedureEnv env, final CloneSnapshotState state)
throws InterruptedException {
if (isTraceEnabled()) {
LOG.trace(this + " execute state=" + state);
}
LOG.trace("{} execute state={}", this, state);
try {
switch (state) {
case CLONE_SNAPSHOT_PRE_OPERATION:
@ -519,15 +515,4 @@ public class CloneSnapshotProcedure
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

@ -52,8 +52,6 @@ public class EnableTableProcedure
private TableName tableName;
private Boolean traceEnabled = null;
public EnableTableProcedure() {
}
@ -80,9 +78,7 @@ public class EnableTableProcedure
@Override
protected Flow executeFromState(final MasterProcedureEnv env, final EnableTableState state)
throws InterruptedException {
if (isTraceEnabled()) {
LOG.trace(this + " execute state=" + state);
}
LOG.trace("{} execute state={}", this, state);
try {
switch (state) {
@ -389,18 +385,6 @@ public class EnableTableProcedure
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.
* @param env MasterProcedureEnv

View File

@ -77,8 +77,6 @@ public class RestoreSnapshotProcedure
// Monitor
private MonitoredTask monitorStatus = null;
private Boolean traceEnabled = null;
/**
* Constructor (for failover)
*/
@ -129,9 +127,7 @@ public class RestoreSnapshotProcedure
@Override
protected Flow executeFromState(final MasterProcedureEnv env, final RestoreSnapshotState state)
throws InterruptedException {
if (isTraceEnabled()) {
LOG.trace(this + " execute state=" + state);
}
LOG.trace("{} execute state={}", this, state);
// Make sure that the monitor status is set up
getMonitorStatus();
@ -549,16 +545,4 @@ public class RestoreSnapshotProcedure
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;
}
}