Skip to content

Commit

Permalink
[fix](routine-load) fix routine load lag is negative (#33846)
Browse files Browse the repository at this point in the history
  • Loading branch information
sollhui authored and Doris-Extras committed Apr 24, 2024
1 parent cc3decf commit f88093e
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,27 @@ protected boolean checkCommitInfo(RLTaskTxnCommitAttachment rlTaskTxnCommitAttac
return false;
}

private void updateProgressAndOffsetsCache(RLTaskTxnCommitAttachment attachment) {
((KafkaProgress) attachment.getProgress()).getOffsetByPartition().entrySet().stream()
.forEach(entity -> {
if (cachedPartitionWithLatestOffsets.containsKey(entity.getKey())
&& cachedPartitionWithLatestOffsets.get(entity.getKey()) < entity.getValue() + 1) {
cachedPartitionWithLatestOffsets.put(entity.getKey(), entity.getValue() + 1);
}
});
this.progress.update(attachment);
}

@Override
protected void updateProgress(RLTaskTxnCommitAttachment attachment) throws UserException {
super.updateProgress(attachment);
this.progress.update(attachment);
updateProgressAndOffsetsCache(attachment);
}

@Override
protected void replayUpdateProgress(RLTaskTxnCommitAttachment attachment) {
super.replayUpdateProgress(attachment);
this.progress.update(attachment);
updateProgressAndOffsetsCache(attachment);
}

@Override
Expand Down

0 comments on commit f88093e

Please sign in to comment.