comnetwork commented on code in PR #4641:
URL: https://github.com/apache/hbase/pull/4641#discussion_r927571468
##########
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:
@sunhelly , thank you for review, yes , I could catch your point, here
means after we does what you said, such as roll WALs and open a new writer and
try to write the WAL entries again and again, and finally WAL.sync still
timeout, we abort the RS. We set a very large default value here, 5 minutes,
usually the WAL system will abort the region server if it can not finish the
sync within 5 minutes, see HBASE-27233 and
https://github.com/apache/hbase/pull/4633 for more discussion.
--
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]