yujun777 opened a new pull request, #64419:
URL: https://github.com/apache/doris/pull/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.
   
   ## JIRA
   
   Closes DORIS-26318
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to