-
Notifications
You must be signed in to change notification settings - Fork 2.2k
backport:allow misson control manager to startup despite errors #10402
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
base: v0.20.x-branch
Are you sure you want to change the base?
backport:allow misson control manager to startup despite errors #10402
Conversation
Summary of ChangesHello @ziggie1984, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness of the LND Mission Control Manager by implementing a mechanism to gracefully handle and recover from corrupted data within its persistent store. Previously, deserialization errors could prevent the manager from starting; now, such problematic entries are identified, logged, and automatically removed, ensuring continuous operation and improving overall system stability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request improves the robustness of the mission control manager during startup by handling deserialization errors gracefully. Instead of failing, corrupted entries are now skipped and deleted from the store, preventing startup failures. The changes in routing/missioncontrol_store.go are well-implemented and include a comprehensive test case. I've added a couple of comments: one for a minor typo in the release notes and another suggesting a performance improvement in fetchAll.
| * [Fix a startup issue in LND when ecounntering a | ||
| deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383) |
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.
There is a typo in the word 'ecounntering'. It should be 'encountering'.
| * [Fix a startup issue in LND when ecounntering a | |
| deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383) | |
| * [Fix a startup issue in LND when encountering a | |
| deserialization issue](https://github.com/lightningnetwork/lnd/pull/10383) |
| for e := b.keys.Front(); e != nil; e = e.Next() { | ||
| keyVal, ok := e.Value.(string) | ||
| if !ok { | ||
| continue | ||
| } | ||
| if keyVal == keyStr { | ||
| b.keys.Remove(e) | ||
| break | ||
| } | ||
| } |
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.
This loop to remove a key from b.keys has a time complexity of O(N) for each corrupted key, where N is the total number of keys. This results in a total complexity of O(C*N) for C corrupted keys.
While corrupted keys are expected to be rare, this could be made more efficient. Consider changing b.keysMap to store *list.Element pointers instead of an empty struct{}. This would allow finding and removing elements from b.keys in O(1) time, reducing the complexity of this cleanup operation to O(C).
This would require changes in newMissionControlStore and other places where keys and keysMap are modified, but would improve performance if a large number of corrupted entries need to be cleaned up.
We now allow the mission control manager to skip over deserializable errors. We cannot repair this these results but we just skip over it so we can startup properly. When fetchAll() encounters entries that fail to deserialize, in addition to skipping them, now also: - Delete the corrupted entries from the database - Remove them from the in-memory keysMap and keys tracking structures This prevents corrupted entries from: - Being counted toward maxRecords, which would cause valid entries to be pruned prematurely - Persisting in the database indefinitely - Causing inaccurate entry counts in startup logs
46299f4 to
bec8327
Compare
backports #10383