-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Log truncation and committing #123
Comments
From what I understand, you're talking about the WAL, which as you note is used to remove uncommitted entries. I believe this is message log truncation so that you don't fill up your hdd and crash. |
Yeah @kempjeng has it, the recovery may not match up 100% yet and the replication I'm working on now. But we need that truncation is needed to periodically remove old segments. |
Isn't the Line 56 in e2a8d10
The problem I see is that upon becoming a follower, the broker is deleting all of its log messages because it truncates to its newest offset starting from the beginning of the log. hw := replica.Log.NewestOffset()
if err := replica.Log.Truncate(hw); err != nil {
return protocol.ErrUnknown.WithErr(err)
} This happens inside |
Ahhh. Yes we need to truncate from the head here rather than truncate from the tail. |
My understanding of Kafka is that a follower truncates its log up to the high watermark on recovery to remove any potentially uncommitted messages (this might no longer be the case with the leader epoch changes).
jocko/jocko/broker.go
Lines 1166 to 1169 in e2a8d10
However, the implementation of
Truncate
here looks like it deletes messages from the oldest offset up to the given offset rather than from the newest.From looking through some of the code, it looks like Jocko isn't implementing the normal ISR commit "flow", i.e. in Kafka when a message is written to the log, it's not committed until the ISR has replicated.
Is this truncation in Jocko serving a different purpose, am I misunderstanding Kafka, or am I just misreading the code?
Thanks!
The text was updated successfully, but these errors were encountered: