Skip to content

PHOENIX-7994 Add cross-cluster IT for server-side immutable-index regeneration on the standby - #2608

Draft
lokiore wants to merge 1 commit into
apache:PHOENIX-7562-feature-newfrom
lokiore:PHOENIX-7994-immutable-index-it
Draft

PHOENIX-7994 Add cross-cluster IT for server-side immutable-index regeneration on the standby#2608
lokiore wants to merge 1 commit into
apache:PHOENIX-7562-feature-newfrom
lokiore:PHOENIX-7994-immutable-index-it

Conversation

@lokiore

@lokiore lokiore commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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)

…eneration on the standby

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

Adds ReplicationLogGroupImmutableIndexIT (extends ReplicationLogGroupBaseIT):
creates an IMMUTABLE table + global index with the config enabled on the client
connection, asserts the replication log carries data-table mutations only,
replays the log on cluster 2, and asserts the standby index is fully
regenerated (count served by the index, index in the explain plan, cell-equal
across clusters). The cross-cluster index equality is the config gate: with the
flag disabled the standby index is empty and the assertion fails. Fills the
immutable gap next to the mutable sibling
ReplicationLogGroupIT#testIndexRegenerationOnStandby.

Generated-by: Claude Code (Opus 4.8)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant