Apache9 commented on code in PR #5816:
URL: https://github.com/apache/hbase/pull/5816#discussion_r1609630113


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerRemoteProcedure.java:
##########
@@ -80,17 +82,25 @@ public abstract class ServerRemoteProcedure extends 
Procedure<MasterProcedureEnv
   protected ServerName targetServer;
   protected boolean dispatched;
   protected boolean succ;
+  // after remoteProcedureDone we require error field to decide the next state
+  protected Throwable remoteError;
+  protected MasterProcedureProtos.ServerRemoteProcedureState state =
+    
MasterProcedureProtos.ServerRemoteProcedureState.SERVER_REMOTE_PROCEDURE_DISPATCH;
 
   protected abstract void complete(MasterProcedureEnv env, Throwable error);
 
   @Override
   protected synchronized Procedure<MasterProcedureEnv>[] 
execute(MasterProcedureEnv env)
     throws ProcedureYieldException, ProcedureSuspendedException, 
InterruptedException {
-    if (dispatched) {
+    if (
+      state != 
MasterProcedureProtos.ServerRemoteProcedureState.SERVER_REMOTE_PROCEDURE_DISPATCH
+    ) {
+      complete(env, this.remoteError);
       if (succ) {
         return null;
       }
-      dispatched = false;
+      state = 
MasterProcedureProtos.ServerRemoteProcedureState.SERVER_REMOTE_PROCEDURE_DISPATCH;
+      ;

Review Comment:
   Remove this extra ';'?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerRemoteProcedure.java:
##########
@@ -80,17 +82,25 @@ public abstract class ServerRemoteProcedure extends 
Procedure<MasterProcedureEnv
   protected ServerName targetServer;
   protected boolean dispatched;
   protected boolean succ;
+  // after remoteProcedureDone we require error field to decide the next state
+  protected Throwable remoteError;
+  protected MasterProcedureProtos.ServerRemoteProcedureState state =
+    
MasterProcedureProtos.ServerRemoteProcedureState.SERVER_REMOTE_PROCEDURE_DISPATCH;
 
   protected abstract void complete(MasterProcedureEnv env, Throwable error);
 
   @Override
   protected synchronized Procedure<MasterProcedureEnv>[] 
execute(MasterProcedureEnv env)
     throws ProcedureYieldException, ProcedureSuspendedException, 
InterruptedException {
-    if (dispatched) {
+    if (
+      state != 
MasterProcedureProtos.ServerRemoteProcedureState.SERVER_REMOTE_PROCEDURE_DISPATCH
+    ) {
+      complete(env, this.remoteError);
       if (succ) {

Review Comment:
   So here we expect the sub classes to set the succ flag? Can we just 
determine this by ourselves? If remoteError is null, then we are succeeded?



-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to