github-actions[bot] commented on code in PR #69896:
URL: https://github.com/apache/doris/pull/69896#discussion_r4661836851


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java:
##########
@@ -84,6 +89,12 @@ public enum IndexExtState {
 
     private boolean rowCountReported = false;
 
+    // Local estimates need no replay. Consecutive partition versions coalesce 
into a single range;
+    // a complete periodic report retires the versions it supersedes. Unlike a 
last-version check,
+    // this also counts distinct commit responses delivered out of order, e.g. 
version 4 before 3.
+    private transient RangeSet<Long> changelogRowCountVersions;
+    private transient long changelogRowCountReportVersion = -1;
+
     public MaterializedIndex() {
         this.state = IndexState.NORMAL;

Review Comment:
   [P2] Preserve pending changelog deltas when applying retained row reports. 
`setReportedRowCount` replaces the accumulated estimate but only removes ranges 
at or below `version`; it does not reapply pending ranges newer than that 
baseline. The local and cloud stat managers pass the current partition version 
even when the replica/RPC row count was fetched before a newer commit. A v4 
commit can add 10 rows and record range v4, then a stale report with the pre-v4 
count can set the index back to 0 and tag it as v4; the v4 response is 
suppressed by `version <= changelogRowCountReportVersion`/`contains`, so the 10 
rows disappear until a later full report. Carry the report's actual snapshot 
version (or reject stale reports) and preserve/reapply deltas newer than the 
retained baseline.



##########
cloud/src/meta-service/meta_service_txn.cpp:
##########
@@ -441,6 +441,38 @@ static void calc_table_stats(std::unordered_map<int64_t, 
TabletIndexPB>& tablet_
     }
 }
 
+// Use the transaction's final rowset counters, not the tablet's retained-row 
statistics. A
+// changelog tablet is logical in cloud mode, so its rows must not be divided 
by replicas.
+static void fill_changelog_stats(const std::unordered_map<int64_t, 
TabletIndexPB>& tablet_indexes,

Review Comment:
   [P2] Preserve changelog stats across incomplete lazy commits. When the lazy 
visibility task fails, this guard omits `changelog_stats`; FE also skips the 
incomplete response. A later commit retry can wait for that task to succeed, 
but the next loop sees `TXN_STATUS_VISIBLE` and returns only `txn_info` through 
the existing early-return branch, so no response carries this transaction's 
changelog delta. The BE sends only the original response to 
`reportCommitTxnResult`, leaving the index undercounted until periodic tablet 
stats. Retain or regenerate the rowset metadata for the successful retry and 
test incomplete-then-successful retry so the delta is applied exactly once.



-- 
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