github-actions[bot] commented on code in PR #69896:
URL: https://github.com/apache/doris/pull/69896#discussion_r4425423961
##########
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) {
+ if (isChangelogIndex(table, indexId)) {
+ // The changelog index has no collected row count: the rows a load
wrote to it are the
+ // only count this record keeps, and they are added rather than
taken as a lower bound
+ // of the table's rows.
Review Comment:
[P2] Route changelog scans through the new row-count fallback.
StatsCalculator calls TableStatsMeta.getRowCountWithDeltaRows only when
getRowCountForIndex(..., true) returns -1, but OlapChangelogTableWrapper
inherits OlapTable.getRowCountForIndex without overriding it and its inherited
idToPartition is empty, so that method returns 0. Every real changelog scan
therefore bypasses this branch and is planned as an empty table despite
indexUpdatedRows. Delegate the lookup to the origin table or override the
wrapper so the accumulated changelog count is reachable.
##########
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:
[P2] Use the partition's replica allocation for changelog deltas. This code
divides every changelog tablet's aggregate by the table default replica count,
but MODIFY PARTITION allows a changelog partition to use a different
allocation. With default 3 replicas and a one-replica partition, nine emitted
rows are recorded as 3, so update/delete-only loads permanently undercount the
changelog estimate. Divide per tablet/partition (or carry the producer
cardinality) instead.
##########
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:
[P2] Account for changelog TTL expiration in this accumulator. Each load is
merged permanently into indexUpdatedRows, but BE changelog TTL compaction
removes expired rowsets and no FE path subtracts or invalidates those rows.
During the interval when the changelog index row count is still unknown,
getRowCountWithDeltaRows reports expired rows as readable, overestimating the
scan. Invalidate this fallback on TTL-driven removal or tie it to a current
reported baseline.
##########
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:
[P2] Keep the changelog accumulator reachable with injected stats. When
userInjected is true, StatsCalculator returns getRowCount(selectedIndexId)
without the fallback. ALTER STATS normally injects only the base index, so a
changelog scan receives UNKNOWN and ignores the rows accumulated by this new
field. Apply the changelog branch before the userInjected shortcut or otherwise
supply a changelog-index value.
--
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]