Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] [broker] Expire messages according to ledger close time to avoid client clock skew #21940

Merged
merged 15 commits into from
Feb 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public boolean expireMessages(int messageTTLInSeconds) {
if (expirationCheckInProgressUpdater.compareAndSet(this, FALSE, TRUE)) {
log.info("[{}][{}] Starting message expiry check, ttl= {} seconds", topicName, subName,
messageTTLInSeconds);
if (checkExpiryByLedgerClosureTime(cursor, messageTTLInSeconds)) {
return true;
}
// First filter the entire Ledger reached TTL based on the Ledger closing time to avoid client clock skew
checkExpiryByLedgerClosureTime(cursor, messageTTLInSeconds);
315157973 marked this conversation as resolved.
Show resolved Hide resolved
// Some part of entries in active Ledger may have reached TTL, so we need to continue searching.
cursor.asyncFindNewestMatching(ManagedCursor.FindPositionConstraint.SearchActiveEntries, entry -> {
try {
long entryTimestamp = Commands.getEntryTimestamp(entry.getDataBuffer());
Expand Down
Loading