Skip to content

PHOENIX-8075 Disable ALTER INDEX ... CONSISTENCY - #2710

Open
Divneet18 wants to merge 1 commit into
apache:masterfrom
Divneet18:PHOENIX-8075
Open

Divneet18 wants to merge 1 commit into
apache:masterfrom
Divneet18:PHOENIX-8075

Conversation

@Divneet18

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • ALTER INDEX ... CONSISTENCY = STRONG | EVENTUAL now fails on the client with a new error, ALTER_INDEX_CONSISTENCY_NOT_SUPPORTED (ERROR 917 (43M28)). The check is the first statement in MetaDataClient#alterIndex, so nothing is written to SYSTEM.CATALOG and no CDC objects are created.
  • The grammar still accepts the CONSISTENCY clause, so users get a clear error and not a syntax error. Removing the check enables the existing consistency handling again.
  • CREATE INDEX ... CONSISTENCY and the other ALTER INDEX statements, such as REBUILD and DISABLE, work as before.
  • IndexMaintainerConsistencyIT#testAlterIndexConsistency is the only test that runs ALTER INDEX ... CONSISTENCY. It is ignored until PHOENIX-8046 is fixed, and the new testAlterIndexConsistencyNotSupported covers the error.

Why are the changes needed?

ALTER INDEX ... CONSISTENCY (PHOENIX-7794) writes the new consistency only to the index row in SYSTEM.CATALOG. Other clients and the region servers keep cached metadata with the old consistency, the client that ran the ALTER can lose the index from its cache and skip index maintenance, and the change is not coordinated with the eventually consistent index consumers. The index can then get out of sync with the data table. PHOENIX-8046 (#2658) fixes this. Until it lands, the statement should be rejected. #2658 changes the same block of alterIndex, so it can remove this check and the @Ignore.

Does this PR introduce any user-facing change?

Yes. On master and in the 5.3.1 and 5.3.2 releases, ALTER INDEX ... CONSISTENCY changes the consistency of the index. With this PR, ALTER INDEX IDX ON S.T CONSISTENCY = EVENTUAL fails with:

ERROR 917 (43M28): Changing index consistency with ALTER INDEX is not supported yet. tableName=S.IDX

The check runs before the index is looked up, so an index that does not exist gets the same error, also with IF EXISTS.

How was this patch tested?

  • New IndexMaintainerConsistencyIT#testAlterIndexConsistencyNotSupported. It creates a table and an index, and runs ALTER INDEX ... CONSISTENCY=STRONG and CONSISTENCY=EVENTUAL. It checks that both fail with ALTER_INDEX_CONSISTENCY_NOT_SUPPORTED. It then reads the index and the data table from SYSTEM.CATALOG, bypassing the client cache, and checks that the index consistency is still unset and that no CDC index was created.
  • With the check removed, the new test fails at the first ALTER (ALTER INDEX ... CONSISTENCY=STRONG should not be supported).
  • IndexMaintainerConsistencyIT passes locally: 2 tests pass and testAlterIndexConsistency is skipped. testIndexMaintainerConsistencyFromPTable covers CREATE INDEX ... CONSISTENCY.
mvn install -DskipTests -pl phoenix-core-client,phoenix-core-server -am
mvn verify -pl phoenix-core -Dit.test=IndexMaintainerConsistencyIT -Dtest=skip -Dsurefire.failIfNoSpecifiedTests=false -Dit.failIfNoSpecifiedTests=false

Was this patch authored or co-authored using generative AI tooling?

Co-authored-by: Claude Code (Claude Opus 5.5)

🤖 Co-authored with Claude Code

Co-Authored-By: Claude Opus 5.5 <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