Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

/**
* Abstract base class for all HBase event handlers. Subclasses should implement the
Expand Down Expand Up @@ -94,10 +95,15 @@ public EventHandler prepare() throws Exception {

@Override
public void run() {
// assume that this is the top of an execution on a new or reused thread, that we're safe to
// blast any existing MDC state.
try (TraceScope scope = TraceUtil.createTrace(this.getClass().getSimpleName(), parent)) {
MDC.put("event_type", eventType.toString());
process();
} catch (Throwable t) {
handleException(t);
} finally {
MDC.clear();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;

Expand Down Expand Up @@ -93,6 +94,7 @@ private void cleanUpAndReportFailure(IOException error) throws IOException {

@Override
public void process() throws IOException {
MDC.put("pid", Long.toString(openProcId));
HRegionServer rs = getServer();
String encodedName = regionInfo.getEncodedName();
byte[] encodedNameBytes = regionInfo.getEncodedNameAsBytes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

/**
* A event handler for running procedure.
Expand All @@ -46,6 +47,7 @@ public RSProcedureHandler(HRegionServer rs, long procId, RSProcedureCallable cal
public void process() {
Throwable error = null;
try {
MDC.put("pid", Long.toString(procId));
callable.call();
} catch (Throwable t) {
LOG.error("pid=" + this.procId, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;

Expand Down Expand Up @@ -78,6 +79,7 @@ private HRegionServer getServer() {

@Override
public void process() throws IOException {
MDC.put("pid", Long.toString(closeProcId));
HRegionServer rs = getServer();
byte[] encodedNameBytes = Bytes.toBytes(encodedName);
Boolean previous = rs.getRegionsInTransitionInRS().putIfAbsent(encodedNameBytes, Boolean.FALSE);
Expand Down