You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "lokiore (via GitHub)" <gi...@apache.org> on 2026/10/15 07:10:07 UTC
[PR] PHOENIX-8025 Skip consistent-failover log replication for PARALLEL HA groups on the active cluster [phoenix]
lokiore opened a new pull request, #2638:
URL: https://github.com/apache/phoenix/pull/2638
JIRA: https://issues.apache.org/jira/browse/PHOENIX-8025
### What changes were proposed in this pull request?
`IndexRegionObserver#getReplicationLogGroup` now checks for the PARALLEL HA policy before it resolves the `ReplicationLogGroup`. A CLIENT_HA write for a PARALLEL group gets no replication writer on any cluster role: it commits locally and is never shipped through the consistent-failover replication log. Before this change, the policy was checked only after `ReplicationLogGroup.get()` returned empty, which happens only on a non-active cluster.
- PARALLEL, active cluster: commits locally with no replication-log append (previously shipped to the peer).
- PARALLEL, non-active cluster: commits locally (unchanged).
- FAILOVER, active cluster: resolves the writer and ships (unchanged).
- FAILOVER, non-active cluster: rejected by the split-brain guard (unchanged).
Because a PARALLEL batch resolves no writer, its WAL key carries no HA group, so the WAL-restore path (`getHAGroupFromWALKey`) never re-ships it either.
`isParallelPolicy` now treats an unreadable HA group record (an `IOException` from the store) the same way it already treated a missing one: as not PARALLEL. The method moved ahead of writer resolution, so this keeps the existing behavior when the store can't be read. A FAILOVER group on the active cluster still gets its cached writer, and a write with no writer still fails through the existing paths.
### Why are the changes needed?
A PARALLEL HA group doesn't need consistent-failover log replication. The PARALLEL client writes every mutation to both clusters, and PARALLEL tables use HBase native replication to keep the clusters converged. Shipping the active cluster's PARALLEL writes through the replication log as well:
- adds a synchronous write to the peer's replication log before each PARALLEL write on the active cluster can return;
- makes the standby apply each write three times: the client's direct write, HBase native replication, and the replication-log replay;
- exposes PARALLEL groups to the replication log's failure modes. For example, a failure writing to the peer's file system can fail-stop the region server, even though PARALLEL never relies on the log.
### Does this PR introduce _any_ user-facing change?
Not in any released version. The change is limited to the unreleased PHOENIX-7562 feature branch. On that branch, PARALLEL writes on the active cluster are no longer written to the consistent-failover replication log or replayed on the peer. They reach the peer through the client's own write and HBase native replication. FAILOVER behavior doesn't change.
### How was this patch tested?
- New unit test `IndexRegionObserverReplicationLogGroupTest` (9 tests) for `getReplicationLogGroup`:
- PARALLEL on the active or non-active cluster returns no writer.
- FAILOVER on the active cluster returns the writer.
- FAILOVER on a non-active cluster throws.
- A missing HA group record keeps the existing resolution.
- An unreadable store still returns the cached FAILOVER writer, and still fails when there is no writer.
- Non-CLIENT_HA origins and non-replicated tables return no writer without looking up the store.
- New IT case `ReplicationLogGroupParallelIT#testParallelWriteOnActiveClusterIsNotShippedToReplicationLog`: a PARALLEL client writes rows that land on both clusters, and the active cluster's replication log has no records for that table. The existing PARALLEL non-active case still passes.
- Negative control: with the PARALLEL check temporarily moved back below the writer lookup (the old ordering), `testParallelOnActiveReturnsNoWriter` fails. The new IT case also fails because it finds the PARALLEL table's write in the replication log (`{T_N000001=1}`). Both pass with the fix.
```
mvn verify -pl phoenix-core -am -Dtest=IndexRegionObserverReplicationLogGroupTest \
-Dit.test=ReplicationLogGroupParallelIT -Dsurefire.failIfNoSpecifiedTests=false \
-Dfailsafe.failIfNoSpecifiedTests=false
```
### Was this patch authored or co-authored using generative AI tooling?
Yes. Authored with Claude Code (Opus 4.8); reviewed and tested by the author.
Generated-by: Claude Code (Opus 4.8)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-8025 Skip consistent-failover log replication for PARALLEL HA groups on the active cluster [phoenix]
Posted by "tkhurana (via GitHub)" <gi...@apache.org>.
tkhurana commented on PR #2638:
URL: https://github.com/apache/phoenix/pull/2638#issuecomment-6449744973
Superseded by #2648
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-8025 Skip consistent-failover log replication for PARALLEL HA groups on the active cluster [phoenix]
Posted by "tkhurana (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] PHOENIX-8025 Skip consistent-failover log replication for PARALLEL HA groups on the active cluster [phoenix]
Posted by "tkhurana (via GitHub)" <gi...@apache.org>.
tkhurana closed pull request #2638: PHOENIX-8025 Skip consistent-failover log replication for PARALLEL HA groups on the active cluster
URL: https://github.com/apache/phoenix/pull/2638
--
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: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org