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


##########
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:
   I like this message better first, as the msgPrefix and I don't think you 
need the IllegalStateException. 
   ```suggestion
             "Attempted fate action before manager finished starting up; "
   ```



-- 
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