sunhelly commented on code in PR #4641:
URL: https://github.com/apache/hbase/pull/4641#discussion_r928082525


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java:
##########
@@ -8037,16 +8040,35 @@ private WriteEntry doWALAppend(WALEdit walEdit, 
BatchOperation<?> batchOp,
     try {
       long txid = this.wal.appendData(this.getRegionInfo(), walKey, walEdit);
       WriteEntry writeEntry = walKey.getWriteEntry();
-      this.attachRegionReplicationInWALAppend(batchOp, miniBatchOp, walKey, 
walEdit, writeEntry);
       // Call sync on our edit.
       if (txid != 0) {
         sync(txid, batchOp.durability);
       }
+      /**
+       * If above {@link HRegion#sync} throws Exception, the RegionServer 
should be aborted and
+       * following {@link BatchOperation#writeMiniBatchOperationsToMemStore} 
will not be executed,
+       * so there is no need to replicate to secondary replica, for this 
reason here we attach the
+       * region replication action after the {@link HRegion#sync} is 
successful.
+       */
+      this.attachRegionReplicationInWALAppend(batchOp, miniBatchOp, walKey, 
walEdit, writeEntry);
       return writeEntry;
     } catch (IOException ioe) {
       if (walKey.getWriteEntry() != null) {
         mvcc.complete(walKey.getWriteEntry());
       }
+
+      /**
+       * If {@link WAL#sync} get a timeout exception, the only correct way is 
to abort the region
+       * server, as the design of {@link WAL#sync}, is to succeed or die, 
there is no 'failure'. It

Review Comment:
   Got it, agree with the point 'no failure for WAL sync', whenever WAL.sync 
throws exception(no matter it is timeout or other), the regionserver should 
abort. This is a common logic.



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