tkhurana commented on code in PR #2638:
URL: https://github.com/apache/phoenix/pull/2638#discussion_r4318589527


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java:
##########
@@ -971,39 +977,34 @@ public void 
preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
   }
 
   /**
-   * Resolve the replication writer for this batch, or empty when none should 
be used. Returns empty
-   * unless this is a CLIENT_HA write on a replication-eligible cluster 
({@code replicateTable} =
-   * feature on AND table eligible) — which covers the feature-off rollout 
window and non-eligible
-   * tables. For such a write it then answers the role/policy question: the 
writer when this cluster
-   * is active for the group, empty for a non-active PARALLEL cluster 
(legitimate double-write, skip
-   * re-ship), and throws for a non-active non-PARALLEL (split-brain) live 
write.
+   * Resolve the replication writer for this batch, or empty when none should 
be used. Only a
+   * non-PARALLEL CLIENT_HA write on a replication-eligible cluster ({@code 
replicateTable}) gets a
+   * writer: PARALLEL writes never ride the replication log, since the client 
writes both clusters
+   * itself. A non-PARALLEL write to a non-active cluster is a split-brain 
write and throws.
    * @return the HA group writer, or empty if none should be used
    */
-  private Optional<ReplicationLogGroup> 
getReplicationLogGroup(RegionCoprocessorEnvironment env,
+  @VisibleForTesting
+  Optional<ReplicationLogGroup> 
getReplicationLogGroup(RegionCoprocessorEnvironment env,
     HAGroupStoreManager haGroupStoreManager, BatchOrigin origin, 
Optional<String> haGroupName)
     throws IOException {
     if (!replicateTable || origin != BatchOrigin.CLIENT_HA) {
       return Optional.empty();
     }
     // origin == CLIENT_HA guarantees the HA group name is present.
     String haGroup = haGroupName.get();
+    // PARALLEL: the client double-writes to both clusters, so commit locally 
and skip the

Review Comment:
   PhoenixRegionServerEndpoint also creates the replication log group on region 
server startup as part of its warmup. This only prevents using the log group 
for active writes but the log group is still created in the background which 
means the log files will be created and rotated every interval but those log 
files will be empty.



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