Skip to content

Commit fbe236d

Browse files
committed
Merge branch '2.1' into 3.1
2 parents a23b832 + aa7944b commit fbe236d

File tree

1 file changed

+19
-4
lines changed
  • core/src/main/java/org/apache/accumulo/core/fate

1 file changed

+19
-4
lines changed

core/src/main/java/org/apache/accumulo/core/fate/Fate.java

+19-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.accumulo.core.fate;
2020

2121
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
22+
import static java.util.concurrent.TimeUnit.MILLISECONDS;
2223
import static java.util.concurrent.TimeUnit.MINUTES;
2324
import static java.util.concurrent.TimeUnit.SECONDS;
2425
import static org.apache.accumulo.core.fate.ReadOnlyTStore.TStatus.FAILED;
@@ -45,6 +46,7 @@
4546
import org.apache.accumulo.core.fate.ReadOnlyTStore.TStatus;
4647
import org.apache.accumulo.core.logging.FateLogger;
4748
import org.apache.accumulo.core.util.ShutdownUtil;
49+
import org.apache.accumulo.core.util.Timer;
4850
import org.apache.accumulo.core.util.UtilWaitThread;
4951
import org.apache.accumulo.core.util.threads.ThreadPools;
5052
import org.apache.thrift.TApplicationException;
@@ -88,7 +90,7 @@ public void run() {
8890
} else {
8991
Repo<T> prevOp = null;
9092
try {
91-
deferTime = op.isReady(tid, environment);
93+
deferTime = executeIsReady(tid, op);
9294

9395
// Here, deferTime is only used to determine success (zero) or failure (non-zero),
9496
// proceeding on success and returning to the while loop on failure.
@@ -98,7 +100,7 @@ public void run() {
98100
if (status == SUBMITTED) {
99101
store.setStatus(tid, IN_PROGRESS);
100102
}
101-
op = op.call(tid, environment);
103+
op = executeCall(tid, op);
102104
} else {
103105
continue;
104106
}
@@ -219,11 +221,24 @@ private void undo(long tid, Repo<T> op) {
219221
}
220222

221223
protected long executeIsReady(Long tid, Repo<T> op) throws Exception {
222-
return op.isReady(tid, environment);
224+
var startTime = Timer.startNew();
225+
var deferTime = op.isReady(tid, environment);
226+
if (log.isTraceEnabled()) {
227+
log.trace("Running {}.isReady() {} took {} ms and returned {}", op.getName(),
228+
FateTxId.formatTid(tid), startTime.elapsed(MILLISECONDS), deferTime);
229+
}
230+
return deferTime;
223231
}
224232

225233
protected Repo<T> executeCall(Long tid, Repo<T> op) throws Exception {
226-
return op.call(tid, environment);
234+
var startTime = Timer.startNew();
235+
var next = op.call(tid, environment);
236+
if (log.isTraceEnabled()) {
237+
log.trace("Running {}.call() {} took {} ms and returned {}", op.getName(),
238+
FateTxId.formatTid(tid), startTime.elapsed(MILLISECONDS),
239+
next == null ? "null" : next.getName());
240+
}
241+
return next;
227242
}
228243

229244
/**

0 commit comments

Comments
 (0)