-
Notifications
You must be signed in to change notification settings - Fork 816
Flush tokens to disk #1750
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
Flush tokens to disk #1750
Conversation
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
And it is ready for review |
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
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.
@codesome I left few comments, I would be glad you could take a look. I will do a deeper review as next step 🙏
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
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.
Thanks @codesome for re-iterating based on my feedback.
A couple of things:
- Can you rebase with
master
? I think there have been several changes related to the ring in the meanwhile. - Please add unit tests for your logic (serialization / deserialization / changes to lifecycler)
I tried to have type Token uint32 but that would have led to a lot of changes and I would like to keep that for a separate PR in itself.
Actually it's what I see you did. I left my comments based on this, but I've some feeling it may be limiting in the future. The main problem is that you're binding the serialization to the list of tokens. What if we need to store the state as well? The current design will break. My suggestion was actually more simple, and to just create a new struct which is the "persisted state" of the ring (currently containing only the tokens), then to marshal/unmarshal it adding a version (no need to add the code to support multiple versions at this stage, but once you've a version written inside you can add multiple versions in the future). If you follow this path, it means:
- Rollback the tokens to
[]uint32
- Add something like
type PersistedLifecyclerState struct
with functions like:Marshal()
Unmarshal()
LoadFromFile()
StoreToFile()
I will let you pick the path you believe it's the most appropriate, and I will do the next review accordingly.
I had already rebased with
I had added
Yeah. I made some changes following @gouthamve's suggestion after I put that comment :) Regarding persisting the lifecycler state, that would include more than just the tokens. I would prefer restoring other states (like the |
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
Signed-off-by: Ganesh Vernekar <[email protected]>
42cde03
to
7d73e07
Compare
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.
Thanks @codesome for addressing my previous feedback. The overall design looks better to me, yet I left few comments and here there about things that I believe should be improved.
Signed-off-by: Ganesh Vernekar <[email protected]>
6354fcf
to
7a16142
Compare
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.
Thanks @codesome for patiently addressing my feeback. LGTM!
Just out of curiosity... cannot ingester simply reuse its own tokens from the ring? That would assume that it keeps its identity, but otherwise it should already work. [Update: after reading design document, I'm even more convinced that this is not necessary, as with stateful sets, ingesters keep their identity.] |
There was some discussion about this. It would work, but, it would be dependant on how reliable is the ring, as it's possible that the ring can go away for a while or it might be restarted sometime. Having it in the file beside the WAL would also make it easy to relate the tokens with the WAL beside it, and makes those tokens on disk as reliable as WAL being present on the disk. Though the ring is reliable enough, I would personally push forward having the tokens on disk. (If ring, we need to have some state other than the current ones while upgrading the ingester else it is likely to mess up with other operations. Playing with local file feels less complex than playing with the ring. UPDATE: Apparently the change required for using the ring is pretty small!) |
Fair enough. I just wanted to make sure this option was considered. Thanks. |
Signed-off-by: Ganesh Vernekar <[email protected]>
@pstibrany I have addressed all your reviews |
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.
Thanks for updates. I have few more small comments.
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.
Thanks for your patience with my feedback!
Signed-off-by: Ganesh Vernekar <[email protected]>
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
This PR implements flushing of tokens to the disk and reading them back again when a pod is restarted/upgraded. This goes with this design of retaining tokens required for WAL in ingesters.