comnetwork commented on code in PR #4392:
URL: https://github.com/apache/hbase/pull/4392#discussion_r872189343
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java:
##########
@@ -7947,6 +8000,58 @@ private WriteEntry doWALAppend(WALEdit walEdit,
Durability durability, List<UUID
}
throw ioe;
}
+ }
+
+ /**
+ * Attach {@link RegionReplicationSink#add} to the mvcc writeEntry for
replicating to region
+ * replica.
+ */
+ private void attachReplicateRegionReplicaInWALAppend(BatchOperation<?>
batchOp,
+ MiniBatchOperationInProgress<Mutation> miniBatchOp,
+ NonceKey nonceKey, WALKeyImpl walKey, WALEdit walEdit, WriteEntry
writeEntry)
+ throws IOException {
+ if (!regionReplicationSink.isPresent()) {
+ return;
+ }
+ final WALEdit walEditToUse =
+ getWALEditForReplicateRegionReplica(batchOp, miniBatchOp, nonceKey,
walEdit);
+ final ServerCall<?> rpcCall =
RpcServer.getCurrentServerCallWithCellScanner().orElse(null);
+ regionReplicationSink.ifPresent(sink ->
writeEntry.attachCompletionAction(() -> {
+ sink.add(walKey, walEditToUse, rpcCall);
+ }));
+ }
+
+ /**
+ * Here is for HBASE-26993 case 1,partial {@link Mutation}s are {@link
Durability#SKIP_WAL}.In
+ * order to make the new framework for region replication could work for
SKIP_WAL, we must add the
+ * {@link Mutation} which {@link Mutation#getDurability} is {@link
Durability#SKIP_WAL} to the
+ * {@link WALEdit} used for replicating to region replica.
+ */
+ private WALEdit getWALEditForReplicateRegionReplica(BatchOperation<?>
batchOp,
+ MiniBatchOperationInProgress<Mutation> miniBatchOp,
+ NonceKey nonceKey, WALEdit walEdit) throws IOException {
+ /**
+ * Here there is no need to consider there are SKIP_WAL {@link Mutation}s
which are not covered
Review Comment:
@Apache9 , yes , we no need to pass in the nonceKey, I have removed it and
add a
`assert batchOp instanceof MutationBatchOperation`
--
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]