You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/05/14 18:26:16 UTC

[GitHub] [hbase] bharathv commented on a change in pull request #3264: HBASE-25887 Wait for appendExecutor to shutdown running tasks

bharathv commented on a change in pull request #3264:
URL: https://github.com/apache/hbase/pull/3264#discussion_r632711780



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
##########
@@ -1120,8 +1120,18 @@ public void shutdown() throws IOException {
           this.disruptor.shutdown();
         }
       }
-      // With disruptor down, this is safe to let go.
-      if (this.appendExecutor !=  null) this.appendExecutor.shutdown();
+
+      try {
+        // With disruptor down, this is safe to let go.
+        if (this.appendExecutor != null) {
+          this.appendExecutor.shutdown();
+          // Wait for 60 seconds to complete currently running tasks.
+          this.appendExecutor.awaitTermination(60, TimeUnit.SECONDS);
+        }
+      } catch (InterruptedException e) {
+        LOG.warn("Exception while waiting to shutdown executor ", e);

Review comment:
       Can you propagate the interrupt for completeness.
   
   > Wondering if we should sleep for 5-10s by default here.
   
   Curious why?

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
##########
@@ -1120,8 +1120,18 @@ public void shutdown() throws IOException {
           this.disruptor.shutdown();
         }
       }
-      // With disruptor down, this is safe to let go.
-      if (this.appendExecutor !=  null) this.appendExecutor.shutdown();
+
+      try {
+        // With disruptor down, this is safe to let go.
+        if (this.appendExecutor != null) {
+          this.appendExecutor.shutdown();
+          // Wait for 60 seconds to complete currently running tasks.
+          this.appendExecutor.awaitTermination(60, TimeUnit.SECONDS);

Review comment:
       Don't have a specific preference on hardcoded/configurability, whatever works for everyone.
   
   OTOH, mind handling the return value of awaitTermination()? something like..
   
   > if (!appendExecutor.awaitTermination(...)) {
   >   LOG.error("Error terminating append pool, potential case for aborted append operations...)
   > }




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

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