Skip to content

Commit

Permalink
HBASE-22943 Various procedures should not cache log trace level (apac…
Browse files Browse the repository at this point in the history
…he#557)

Signed-off-by: Peter Somogyi <[email protected]>
(cherry picked from commit 83e7794)

 Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/SplitTableRegionProcedure.java
  • Loading branch information
busbey committed Aug 29, 2019
1 parent 7a90c1a commit 84cc511
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
public class SplitTableRegionProcedure
extends AbstractStateMachineRegionProcedure<SplitTableRegionState> {
private static final Logger LOG = LoggerFactory.getLogger(SplitTableRegionProcedure.class);
private Boolean traceEnabled = null;
private RegionInfo daughter_1_RI;
private RegionInfo daughter_2_RI;
private byte[] bestSplitRow;
Expand Down Expand Up @@ -331,9 +330,7 @@ protected Flow executeFromState(MasterProcedureEnv env, SplitTableRegionState st
@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) {
Expand Down Expand Up @@ -877,18 +874,6 @@ private void writeMaxSequenceIdFile(MasterProcedureEnv env) throws IOException {
}
}

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public class CloneSnapshotProcedure
// Monitor
private MonitoredTask monitorStatus = null;

private Boolean traceEnabled = null;

/**
* Constructor (for failover)
*/
Expand Down Expand Up @@ -130,9 +128,7 @@ private void restoreSnapshotAcl(MasterProcedureEnv env) throws IOException {
@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:
Expand Down Expand Up @@ -519,15 +515,4 @@ private void addRegionsToMeta(final MasterProcedureEnv env) throws IOException {
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public class EnableTableProcedure

private TableName tableName;

private Boolean traceEnabled = null;

public EnableTableProcedure() {
}

Expand All @@ -80,9 +78,7 @@ public EnableTableProcedure(MasterProcedureEnv env, TableName tableName,
@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) {
Expand Down Expand Up @@ -389,18 +385,6 @@ private void postEnable(final MasterProcedureEnv env, final EnableTableState sta
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ public class RestoreSnapshotProcedure
// Monitor
private MonitoredTask monitorStatus = null;

private Boolean traceEnabled = null;

/**
* Constructor (for failover)
*/
Expand Down Expand Up @@ -129,9 +127,7 @@ private MonitoredTask getMonitorStatus() {
@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();
Expand Down Expand Up @@ -549,16 +545,4 @@ private void restoreSnapshotAcl(final MasterProcedureEnv env) throws IOException
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;
}
}

0 comments on commit 84cc511

Please sign in to comment.