ctubbsii commented on code in PR #2990:
URL: https://github.com/apache/accumulo/pull/2990#discussion_r984865063


##########
server/manager/src/main/java/org/apache/accumulo/manager/Manager.java:
##########
@@ -225,6 +230,36 @@ public boolean stillManager() {
     return getManagerState() != ManagerState.STOP;
   }
 
+  /**
+   * Retrieve the Fate object, blocking until it is ready. This could cause 
problems if Fate
+   * operations are attempted to be used prior to the Manager being ready for 
them. If these
+   * operations are triggered by a client side request from a tserver or 
client, it should be safe
+   * to wait to handle those until Fate is ready, but if it occurs during an 
upgrade, or some other
+   * time in the Manager before Fate is started, that may result in a deadlock 
and will need to be
+   * fixed.
+   *
+   * @return the Fate object, only after the fate components are running and 
ready
+   */
+  Fate<Manager> fate() {
+    // if it's not ready, then wait for it to be ready, but with some 
informative logging
+    if (fateReadyLatch.getCount() != 0) {
+      String msgPrefix = "Unexpected use of fate in thread " + 
Thread.currentThread().getName()
+          + " at time " + System.currentTimeMillis();
+      // include stack trace so we know where it's coming from, in case we 
need to troubleshoot it
+      log.warn("{} blocked until fate starts", msgPrefix,
+          new IllegalStateException("Attempted fate action before fate was 
started; "

Review Comment:
   The IllegalStateException is just an exception we need to create in order to 
build a stack trace we can show in the logs. It could be any new exception. If 
we remove it, we remove the stack trace in the logs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to