yujun777 commented on code in PR #69896:
URL: https://github.com/apache/doris/pull/69896#discussion_r4462608419


##########
fe/fe-core/src/main/java/org/apache/doris/statistics/analysis/TableStatsMeta.java:
##########
@@ -391,6 +397,12 @@ public long getBaseIndexDeltaRowCount(OlapTable table) {
      * {@link #updatedRows} and reports them as delta rows.
      */
     public synchronized long getRowCountWithDeltaRows(OlapTable table, long 
indexId) {

Review Comment:
   The StatsCalculator shortcut for injected statistics is a consumer-side 
issue to address with explicit wrapper-estimate priority in #69850; this PR 
does not change that shortcut.
   
   In 9fb10c4c0e1 the separate TableStatsMeta accumulator was removed. 
Changelog deltas now update the partition MaterializedIndex row count, which 
the P/Q metadata lookup reads independently of injected base statistics. This 
supplies the source count, while wrapper estimate selection remains in the 
consumer PR.



##########
fe/fe-core/src/main/java/org/apache/doris/statistics/analysis/TableStatsMeta.java:
##########
@@ -414,6 +426,31 @@ public synchronized long 
getRowCountWithDeltaRows(OlapTable table, long indexId)
         return rowCount + getBaseIndexDeltaRowCount(table);
     }
 
+    /**
+     * Add the rows a load wrote to an index which has no collected row count 
of its own.
+     */
+    public synchronized void addIndexUpdatedRows(long indexId, long rows) {
+        if (rows <= 0) {
+            return;

Review Comment:
   Fixed in 9fb10c4c0e1 by removing the lifetime accumulator. Loads now adjust 
the partition's changelog MaterializedIndex estimate, and the existing periodic 
tablet-stat path replaces that estimate with the retained row count, including 
TTL removal. The estimate can still be stale until a fresh report arrives; it 
no longer permanently accumulates expired rows in a separate persisted map.
   
   The new test replaces the estimate with a lower reported retained count and 
verifies that the next load is added to that refreshed baseline.



##########
fe/fe-core/src/main/java/org/apache/doris/statistics/analysis/AnalysisManager.java:
##########
@@ -1525,6 +1535,7 @@ public void replayUpdateRowsRecord(UpdateRowsEvent event) 
{
                         + "rows for all replica {}, tablets count {}",
                         olapTable.getName(), tableUpdateRows, replicaNum, 
rowsForAllReplica, tabletRows.size());

Review Comment:
   Fixed in 9fb10c4c0e1. Each changelog tablet's aggregate delta is divided by 
its owning partition's replica allocation before updating that partition's 
index estimate. It is no longer divided by the table default.
   
   The new test uses a table default of three replicas with one- and 
three-replica partitions: reported totals of 9 and 18 add 9 and 6 rows 
respectively, while changelog rows remain excluded from the base counter.



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