Skip to content

[sql-68] multi: add conf option to remove bbolt tombstone#1293

Draft
ViktorT-11 wants to merge 2 commits into
lightninglabs:tombstone-bbolt-on-migfrom
ViktorT-11:2026-03-add-kvdb-deprecation-override
Draft

[sql-68] multi: add conf option to remove bbolt tombstone#1293
ViktorT-11 wants to merge 2 commits into
lightninglabs:tombstone-bbolt-on-migfrom
ViktorT-11:2026-03-add-kvdb-deprecation-override

Conversation

@ViktorT-11

Copy link
Copy Markdown
Contributor

Based on #1272

This PR adds a config option unsafe-remove-kvdb-deprecation that removes the bbolt tombstone on the next startup the tombstone is added after a kvdb-> SQL migration.

Pushing this in draft for now, so that we can decide if we actually want to go ahead with this PR or not.

Add an explicit config option to remove kvdb deprecation markers from
the accounts, session, and firewall stores so the legacy bbolt files can
be reopened when an operator intentionally wants to bypass the
tombstones.

Wire that behavior into dev config through an unsafe startup flag that
clears the markers before NewStores opens the bbolt backend. This keeps
the override explicit and local to startup instead of weakening the
normal deprecation checks.

Add coverage for both parts of the flow: the store-specific deprecation
tests now verify reopening works again after marker removal, and a new
config test verifies startup fails before the unsafe flag and succeeds
once the markers are cleared.
Extend the kvdb -> SQL migration itest to cover the unsafe startup flag
that clears kvdb deprecation markers before reopening the bbolt stores.

Verify that starting litd with the unsafe flag allows the migrated kvdb
files to be opened again, that the migrated data is still readable over
RPC, and that a later plain bbolt restart also succeeds once the
markers have been removed.

Rerun the SQL migration after that unsafe path so the deprecated-file
startup-order checks can still run against freshly recreated
tombstones.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, 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 introduces an opt-in, unsafe mechanism to remove bbolt database deprecation markers that are typically set after a migration to SQL. This provides a way to recover or reuse legacy bbolt files if necessary, while explicitly requiring the user to acknowledge the potential risks of such an action.

Highlights

  • New Configuration Option: Added an unsafe configuration flag unsafe-remove-kvdb-deprecation to allow removal of bbolt database deprecation markers.
  • Database Marker Removal: Implemented RemoveKVDBDeprecation functions across accounts, session, and firewall modules to programmatically clear deprecation tombstones.
  • Integration Testing: Added comprehensive tests and updated existing integration tests to verify the behavior of the new unsafe removal flag.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 introduces functionality to remove KVDB deprecation markers from legacy bbolt database files, allowing them to be reopened if necessary. This is controlled by a new unsafe configuration flag. The changes include the implementation of removal functions for accounts, session, and firewall databases, updates to the configuration, and comprehensive integration tests. I have no other feedback to provide, but please address the grammatical error in the configuration description as suggested.

Comment thread config_dev.go
// markers from the legacy bbolt database files before opening them.
// This should only be used if the caller fully understands the
// consequences of reusing kvdb files that were already migrated to SQL.
UnsafeRemoveDeprecatedKVDBMarkers bool `long:"unsafe-remove-kvdb-deprecation" description:"Remove the kvdb deprecation markers if set from accounts.db, session.db and rules.db before opening the bbolt backend. Only set this if you know fully understands the consequences of reusing kvdb files that were already migrated to SQL."`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description contains a grammatical error: 'if you know fully understands'. It should be 'if you fully understand'.

Suggested change
UnsafeRemoveDeprecatedKVDBMarkers bool `long:"unsafe-remove-kvdb-deprecation" description:"Remove the kvdb deprecation markers if set from accounts.db, session.db and rules.db before opening the bbolt backend. Only set this if you know fully understands the consequences of reusing kvdb files that were already migrated to SQL."`
UnsafeRemoveDeprecatedKVDBMarkers bool `long:"unsafe-remove-kvdb-deprecation" description:"Remove the kvdb deprecation markers if set from accounts.db, session.db and rules.db before opening the bbolt backend. Only set this if you fully understand the consequences of reusing kvdb files that were already migrated to SQL."`

@ViktorT-11
ViktorT-11 changed the base branch from tombstone-bbolt-on-mig to master May 19, 2026 10:57
@ViktorT-11
ViktorT-11 changed the base branch from master to tombstone-bbolt-on-mig May 19, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants