未验证 提交 63464ab7 编写于 作者: L liudezhi 提交者: guangning

Consumer received duplicated deplayed messages upon restart

Fix when send a delayed message ,there is a case when a consumer restarts and pull duplicate messages. #6403

(cherry picked from commit e71b9fc4)
上级 9a8621f4
......@@ -1116,7 +1116,14 @@ public class ManagedCursorImpl implements ManagedCursor {
};
positions.stream().filter(position -> !alreadyAcknowledgedPositions.contains(position))
.forEach(p -> ledger.asyncReadEntry((PositionImpl) p, cb, ctx));
.forEach(p ->{
if (((PositionImpl) p).compareTo(this.readPosition) == 0) {
this.setReadPosition(this.readPosition.getNext());
log.warn("[{}][{}] replayPosition{} equals readPosition{}," + " need set next readPositio",
ledger.getName(), name, (PositionImpl) p, this.readPosition);
}
ledger.asyncReadEntry((PositionImpl) p, cb, ctx);
});
return alreadyAcknowledgedPositions;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册