-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Account trimAboveSeqNo in committed translog generation #50205
Conversation
Pinging @elastic/es-distributed (:Distributed/Engine) |
final long maxSeqNo = reader.getCheckpoint().maxSeqNo; | ||
return maxSeqNo == SequenceNumbers.UNASSIGNED_SEQ_NO || maxSeqNo >= minSeqNo; | ||
}); | ||
.filter(reader -> minSeqNo <= SequenceNumbers.min(reader.getCheckpoint().trimmedAboveSeqNo, reader.getCheckpoint().maxSeqNo)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to account for the case where trimmedAboveSeqNo is equal to SequenceNumbers.UNASSIGNED_SEQ_NO
. Perhaps we can add a method to checkpoint called getMaxEffectiveSeqNo
which is:
if (trimmedAboveSeqNo == SequenceNumbers.UNASSIGNED_SEQ_NO)
return maxSeqNo;
else
return Math.min(maxSeqNo, trimmedAboveSeqNo);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SequenceNumbers.min
should handle this case:
elasticsearch/server/src/main/java/org/elasticsearch/index/seqno/SequenceNumbers.java
Lines 84 to 85 in 044139a
} else if (minSeqNo == UNASSIGNED_SEQ_NO) { | |
return seqNo; |
But having an explicit method is better. I pushed 563545c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah lol, I did not see that a special min
method was used (I read it as Math.min).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks Yannick. |
Today we do not consider trimAboveSeqNo when calculating the translog generation of an index commit. If there is no new indexing after the primary promotion, then we won't be able to clean up the translog.
Today we do not consider trimAboveSeqNo when calculating the translog generation of an index commit. If there is no new indexing after the primary promotion, then we won't be able to clean up the translog.
Today we do not consider trimAboveSeqNo when calculating the translog generation of an index commit. If there is no new indexing after the primary promotion, then we won't be able to clean up the translog.
While working on the fix for #49970, I found that we do not consider trimAboveSeqNo when calculating the translog generation of an index commit. If there is no new indexing after the primary promotion, then we won't be able to clean up the translog.