Skip to content

PHOENIX-8122 IndexMetadataIT.testAsyncRebuildAll races the rebuild job on the task status - #2754

Open
apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:PHOENIX-8122
Open

apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:PHOENIX-8122

Conversation

@apurtell

@apurtell apurtell commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

IndexMetadataIT.testAsyncRebuildAll fails sometimes in precommit. It expects the rebuild task to be COMPLETED, but it finds STARTED.

When the asynchronous rebuild job finishes, it makes two separate writes. First it sets the index ACTIVE, and then it marks the rebuild task COMPLETED. The test waited only for the index to become ACTIVE and then read the task status once. A read between the two writes saw STARTED. In the failed run, the window was about 50 ms, and the test read the status inside it.

The test now also waits for the task to become COMPLETED before it checks the task, with the helper that other task tests already use. The product code does not change.

🤖 Generated with Claude Code

…b on the task status

The rebuild job sets the index ACTIVE before it marks the rebuild task
COMPLETED. The test waited only for the index state and then read the task
status once, so it sometimes saw STARTED. The test now also waits for the task
status COMPLETED with the existing task state helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apurtell
apurtell requested a balanced review from Copilot December 6, 2026 02:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@apurtell
apurtell requested a balanced review from Copilot December 6, 2026 02:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@apurtell

apurtell commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

This is an objective self-review by independent Claude Code review agents, because Copilot had no review quota for this PR.

Verdict: The diagnosis is correct and the fix is right. The rebuild job's reducer makes two separate writes, in a fixed order. First it sets the index ACTIVE, and then, in its cleanup step, it marks the rebuild task COMPLETED. The test waited only for the index state and then read the task status once, so a read that fell between the two writes saw STARTED. The CI log for the failed run shows this. The ACTIVE write, then the test's single read of SYSTEM.TASK, then the COMPLETED write all happen within about 50 ms. In the mini cluster the reducer is the only writer that can set COMPLETED. The self-healing check cannot see local MapReduce jobs, so it skips the task. The new wait is therefore the right signal. It filters on the task type and on this test's own table name, and the test deletes that table's task rows beforehand, so it cannot match a stale row or another test's row. The change touches only the test, which is correct because the product's order is intended: the index becomes usable first, and the bookkeeping follows. It reuses the existing task state helper, which another IT already imports across packages, and the new comment is accurate.

Findings: None need a code change, so there will be no addendum commit. Reviewers raised these notes:

Out of scope: Some related problems are left alone because they have other causes. The CREATED check earlier in this test can still race the scheduler; #2446 fixes that. The unfiltered SYSTEM.TASK queries depend on test order. The rebuild task writes STARTED after it submits the job, so on a heavily loaded runner that write could overwrite COMPLETED, but none of these showed up in this failure.

🤖 Generated with Claude Code

@apurtell

apurtell commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

CI note: IndexMetadataIT passed in this run. The three failing jobs are not related to this change, and each one has an open fix. GlobalMutableTxIndexIT fails on a closed Omid client (#2435). A permissions test checks a revoke before the access control caches refresh (#2750). The test coverage check finds two classes that run in two jobs (#2736).

🤖 Generated with Claude Code

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.

2 participants