branch-4.1: fix(regression): Make test_analyze_mv row_count assertion stable after truncate #64419#64503
Merged
Merged
Conversation
…r truncate (#64419) ## Problem `statistics/test_analyze_mv.groovy` line 614 asserts `assertEquals("-1", result_row[0][4])` immediately after `truncate table`, expecting `report_row_count_for_nereids` to be -1 (unreported). This is a race condition: BE asynchronously reports new tablet stats (0 rows for empty table) to FE, and if the report arrives before the assertion, the value is 0 instead of -1. On cloud, this is amplified by `CloudTabletStatMgr` unconditionally setting `rowCountReported=true`, making the -1 state exceptionally short-lived or unobservable. ## Root Cause After `truncate table`, the FE stat manager (`CloudTabletStatMgr` / `TabletStatMgr`) updates `MaterializedIndex.rowCount` and sets `rowCountReported=true`. The test assertion races with this update: - If BE hasn't reported yet → `getRowCountForIndex(id, true)` returns -1 ✓ - If BE has reported → returns 0 ✗ (test fails) ## Fix Change the assertion to accept both -1 and 0, since both are valid states for an empty table after truncate: - -1: tablet row count not yet reported - 0: tablet row count reported as 0 (empty table) Add assertion message with actual value for debuggability. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
|
run p0 |
Contributor
|
run nonConcurrent |
yiguolei
approved these changes
Jun 16, 2026
Contributor
Author
|
PR approved by at least one committer and no changes requested. |
Contributor
Author
|
PR approved by anyone and no changes requested. |
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.
Cherry-picked from #64419