github-actions[bot] commented on code in PR #62453:
URL: https://github.com/apache/doris/pull/62453#discussion_r3086223742
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/OlapTableStream.java:
##########
@@ -154,4 +163,56 @@ void fillTableStreamConsumptionInfo(List<TRow> dataBatch) {
}
}
}
+
+ public boolean hasData(Partition partition) {
+ // if all available visible data has been consumed, return false
+ // todo(TsukiokaKogane): change offset from partition version to
commit tso
+ return !partitionOffset.containsKey(partition.getId())
+ ||
!partitionOffset.get(partition.getId()).equals(partition.getVisibleVersion())
+ || historicalPartitionOffset.containsKey(partition.getId());
+ }
+
+ public OlapTableStreamUpdate getStreamUpdate(List<Long>
selectedPartitionIds) {
+ if (selectedPartitionIds.isEmpty()) {
+ return null;
+ }
Review Comment:
This keeps `next` at the already-consumed offset for the normal incremental
path. A stream created with `show_initial_rows = false` initializes
`partitionOffset` to the table's then-current visible version. When new data
arrives later, `hasData()` returns `true`, but `next` is still set to the old
offset here, so `OlapScanNode` scans the old snapshot
(`addScanRangeLocations()` uses `streamUpdate.next` as the partition version)
and commit writes the same offset back again. The stream never advances to the
newly visible data. `next` needs to capture the snapshot version selected for
this query, not the previous consumed offset.
##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -433,6 +436,10 @@ private void addScanRangeLocations(Partition partition,
// assign a snapshot version of all partitions.
if (!(Config.isCloudMode() && Config.enable_cloud_snapshot_version)) {
Review Comment:
This only affects the non-cloud branch. In cloud mode,
`ScanNode.setVisibleVersionForOlapScanNodes()` later overwrites every
`OlapScanNode`'s scan ranges with the latest snapshot fetched from
`CloudPartition`, and that code has no notion of `streamUpdate`. So stream
scans in cloud mode ignore the stored offset and read the current table
snapshot instead of the intended stream window. Since different scans may need
different versions for the same partition id, the cloud visible-version
propagation needs a per-scan override rather than the current global
partition-id map.
--
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]