TsukiokaKogane commented on code in PR #63850:
URL: https://github.com/apache/doris/pull/63850#discussion_r3361815917
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/OlapTableStream.java:
##########
@@ -201,12 +213,57 @@ public void
unprotectedUpdateStreamUpdate(AbstractTableStreamUpdate update, Long
for (Map.Entry<Long, Long> entry : next.entrySet()) {
if (historicalPartitionOffset.containsKey(entry.getKey())) {
historicalPartitionOffset.remove(entry.getKey());
- partitionOffset.put(entry.getKey(), entry.getValue());
+ if (historicalPartitionTSO == null) {
+ partitionOffset.put(entry.getKey(), entry.getValue());
+ } else {
+ partitionOffset.put(entry.getKey(),
historicalPartitionTSO.get(entry.getKey()));
+ historicalPartitionTSO.remove(entry.getKey());
+ }
} else {
- // todo(TsukiokaKogane): update partition offset with tso
partitionOffset.put(entry.getKey(), entry.getValue());
}
partitionConsumptionTime.put(entry.getKey(), ts);
}
}
+
+ Set<Long> unprotectedCollectStalePartitionOffsetIds(Set<Long>
validPartitionIds) {
+ Preconditions.checkState(isWriteLockHeldByCurrentThread());
+ Set<Long> stalePartitionIds = new HashSet<>();
+ for (Long partitionId : partitionOffset.keySet()) {
+ if (!validPartitionIds.contains(partitionId)) {
+ stalePartitionIds.add(partitionId);
+ }
+ }
+ for (Long partitionId : partitionConsumptionTime.keySet()) {
+ if (!validPartitionIds.contains(partitionId)) {
+ stalePartitionIds.add(partitionId);
+ }
+ }
+ for (Long partitionId : historicalPartitionOffset.keySet()) {
+ if (!validPartitionIds.contains(partitionId)) {
+ stalePartitionIds.add(partitionId);
+ }
+ }
+ if (historicalPartitionTSO != null) {
+ for (Long partitionId : historicalPartitionTSO.keySet()) {
+ if (!validPartitionIds.contains(partitionId)) {
+ stalePartitionIds.add(partitionId);
+ }
+ }
+ }
+ return stalePartitionIds;
+ }
+
+ int unprotectedPrunePartitionOffsets(Set<Long> partitionIds) {
+ Preconditions.checkState(isWriteLockHeldByCurrentThread());
Review Comment:
ok
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/OlapTableStream.java:
##########
@@ -201,12 +213,57 @@ public void
unprotectedUpdateStreamUpdate(AbstractTableStreamUpdate update, Long
for (Map.Entry<Long, Long> entry : next.entrySet()) {
if (historicalPartitionOffset.containsKey(entry.getKey())) {
historicalPartitionOffset.remove(entry.getKey());
- partitionOffset.put(entry.getKey(), entry.getValue());
+ if (historicalPartitionTSO == null) {
+ partitionOffset.put(entry.getKey(), entry.getValue());
+ } else {
+ partitionOffset.put(entry.getKey(),
historicalPartitionTSO.get(entry.getKey()));
+ historicalPartitionTSO.remove(entry.getKey());
+ }
} else {
- // todo(TsukiokaKogane): update partition offset with tso
partitionOffset.put(entry.getKey(), entry.getValue());
}
partitionConsumptionTime.put(entry.getKey(), ts);
}
}
+
+ Set<Long> unprotectedCollectStalePartitionOffsetIds(Set<Long>
validPartitionIds) {
+ Preconditions.checkState(isWriteLockHeldByCurrentThread());
Review Comment:
ok
--
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]