lokiore opened a new pull request, #2608:
URL: https://github.com/apache/phoenix/pull/2608

   ### What changes were proposed in this pull request?
   
   Adds `ReplicationLogGroupImmutableIndexIT` 
(`@Category(NeedsOwnMiniClusterTest.class)`, extending 
`ReplicationLogGroupBaseIT`) — a cross-cluster integration test for server-side 
immutable-index maintenance (`phoenix.server.side.immutable.indexes.enabled`) 
under Consistent Failover replication.
   
   The single test `testImmutableIndexRegeneratedOnStandby`:
   - Creates an `IMMUTABLE_ROWS=true` table + global index on cluster 1 with 
the config enabled on the client connection, and upserts 10 rows.
   - Asserts (structurally) that the replication log carries the data table's 
mutations but **no** index-table entries — index tables have no capture 
coprocessor.
   - Recreates the schema on cluster 2 and replays the log via 
`ReplicationLogProcessor`.
   - Asserts the standby index was regenerated: `COUNT(*)` served by the index 
returns all rows, the index appears in the explain plan, and both the data 
table and the index are cell-equal across clusters.
   
   Test-only change; no product code is touched.
   
   ### Why are the changes needed?
   
   Consistent Failover replicates only data-table mutations — secondary-index 
tables carry no capture coprocessor, so an index is never shipped as 
index-table entries. For an IMMUTABLE table the standby therefore has to 
regenerate the index from the replayed data mutations via 
`IndexRegionObserver`, and that only happens when index maintenance is deferred 
to the server via `phoenix.server.side.immutable.indexes.enabled`. With that 
config disabled, an immutable table's index is maintained client-side; those 
index writes land only on the active's index table (never replicated) and the 
data batch is not marked for server-side regeneration — so after replay the 
standby index is left empty and diverges from the data table.
   
   Existing immutable-index coverage (`ServerSideImmutableIndexIT`) is 
single-cluster only. There was no cross-cluster test proving the standby index 
is regenerated when the config is enabled. The cross-cluster index equality in 
this test is the config gate — with the flag disabled on the client the standby 
index is empty and the assertion fails. The sibling mutable-table case already 
exists as `ReplicationLogGroupIT#testIndexRegenerationOnStandby`; this fills 
the immutable gap.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only.
   
   ### How was this patch tested?
   
   New integration test `ReplicationLogGroupImmutableIndexIT`. `mvn -pl 
phoenix-core test-compile` passes and `mvn spotless:check` is clean. The test 
spins up two mini-clusters (`NeedsOwnMiniClusterTest`) and is intended to run 
under the failsafe integration-test phase in CI.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


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