You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ch...@apache.org on 2022/08/24 02:25:52 UTC
[hbase] branch master updated: HBASE-27303 Unnecessary replication to secondary region replicas should avoid when WAL.sync throws Exception (#4707)
This is an automated email from the ASF dual-hosted git repository.
chenglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new a0481d100ff HBASE-27303 Unnecessary replication to secondary region replicas should avoid when WAL.sync throws Exception (#4707)
a0481d100ff is described below
commit a0481d100ff904fbc6613e559731bfecac759cff
Author: chenglei <ch...@apache.org>
AuthorDate: Wed Aug 24 10:25:42 2022 +0800
HBASE-27303 Unnecessary replication to secondary region replicas should avoid when WAL.sync throws Exception (#4707)
Signed-off-by: Duo Zhang <zh...@apache.org>
---
.../main/java/org/apache/hadoop/hbase/regionserver/HRegion.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 004180d39b0..c691afdda68 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -8046,11 +8046,17 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
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) {