[fix](cloud) skip stale tablet cache check for STOP_TOKEN to fix spurious schema change failure#61380
Open
Hastyshell wants to merge 2 commits intoapache:masterfrom
Open
Conversation
STOP_TOKEN is a lock marker registered by schema change (MOW tables) to block concurrent compactions during delete bitmap recalculation. It does not perform any actual compaction work, so checking whether the BE's cached compaction counts are up-to-date is meaningless for it. Before this fix, when a concurrent compaction on another BE advanced the cumulative_compaction_cnt in the meta-service (e.g. from 8 to 9) while a schema change was in progress, the subsequent STOP_TOKEN registration would be rejected with STALE_TABLET_CACHE and propagate back as an ALTER task failure, even though no stale-cache hazard actually existed for the lock operation. Fix: guard the stale-cache check with a type != STOP_TOKEN condition so that STOP_TOKEN registrations always proceed regardless of cached counts. Add a regression test (StopTokenSkipsStaleTabletCacheCheck) that reproduces the exact scenario from CORE-5964.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Collaborator
Author
|
run buildall |
Contributor
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In cloud mode, schema change on MOW (Merge-on-Write) tables intermittently fails with:
Root Cause
Schema change on a MOW table calls
_process_delete_bitmap(), which registers aSTOP_TOKENcompaction job viaCloudCompactionStopToken::do_register(). TheSTOP_TOKENis not a real compaction — it is a lock marker that blocks concurrent compactions during delete bitmap recalculation.However,
start_compaction_job()in the meta-service applies the stale tablet cache check unconditionally to all compaction types, includingSTOP_TOKEN. If a concurrent compaction on another BE node advancescumulative_compaction_cntin the meta-service while the schema change BE still holds its old cached value, theSTOP_TOKENregistration is rejected withSTALE_TABLET_CACHE. This error propagates back to the FE as a fatal ALTER task failure.Fix
Skip the stale tablet cache check when the compaction job type is
STOP_TOKEN. SinceSTOP_TOKENdoes not read or compact any rowsets, verifying the freshness of cached compaction counts is meaningless for it.Testing
Added regression test
StopTokenSkipsStaleTabletCacheCheckincloud/test/meta_service_job_test.cppthat:cumulative_compaction_cnt=9on the meta-service sideCUMULATIVEcompaction with stale count=8 is still correctly rejected withSTALE_TABLET_CACHESTOP_TOKENwith the same stale count=8 succeeds withOK