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


##########
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestAsyncLogRolling.java:
##########
@@ -51,6 +60,56 @@ public static void setUpBeforeClass() throws Exception {
     AbstractTestLogRolling.setUpBeforeClass();
   }
 
+  public static class SlowSyncLogWriter extends AsyncProtobufLogWriter {
+
+    public SlowSyncLogWriter(EventLoopGroup eventLoopGroup, Class<? extends 
Channel> channelClass) {
+      super(eventLoopGroup, channelClass);
+    }
+
+    @Override
+    public CompletableFuture<Long> sync(boolean forceSync) {
+      try {
+        Thread.sleep(syncLatencyMillis);
+      } catch (InterruptedException e) {
+        throw new RuntimeException(e);
+      }
+      return super.sync(forceSync);

Review Comment:
   For AsyncProtobufLogWriter, we should not block the sync thread, I think 
here, we should return a new CompletableFuture, and when the CompletableFuture 
we get by calling super.sync completes, we add syncLatencyMillis delay and then 
complete it?



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