-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lncfg: don't warn user about existing bbolt DB if SQLite files exist #9744
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: master
Are you sure you want to change the base?
lncfg: don't warn user about existing bbolt DB if SQLite files exist #9744
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
d204fa4
to
39dc89d
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.
Please read the contribution guidelines.
https://github.com/lightningnetwork/lnd/blob/master/docs/development_guidelines.md#ideal-git-commit-structure
a309cb7
to
6ef656c
Compare
I've updated my commit messages as per the contribution guidelines.Thank you for pointing this out! |
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.
Have you tested the PR locally? I tried testing it, and here are the results:
- Running with SQLite only (no bbolt and no existing SQLite data) → warning does not show up (test passed).
- Running with SQLite only (no bbolt but with existing SQLite data) → warning does not show up (test passed).
- Running with SQLite (with bbolt data and no existing SQLite data) → warning does not show up (test failed).
- Running with SQLite (with bbolt data and with existing SQLite data) → warning does not show up (test passed).
The warning does not appear in any of these cases. I believe that, if the .sqlite
file does not exist, it is created automatically, so your check !lnrpc.FileExists(sqlitePath)
is never executed.
Additionally, I noticed that we are only checking here:
Lines 604 to 609 in 7e50b84
warnExistingBoltDBs( | |
logger, "sqlite", walletDBPath, WalletDBName, | |
) | |
warnExistingBoltDBs( | |
logger, "sqlite", chanDBPath, ChannelDBName, | |
) |
So, currently no warnings are thrown for macaroons.db
and sphinxreplay.db
.
You're right about those points. I was worried about the FileExists check, but I wasn't sure if the SQLite files would be auto-created. Based on your testing, it seems like my implementation isn't behaving as expected. |
Signed-off-by: Dhiren-Mhatre <[email protected]>
Signed-off-by: Dhiren-Mhatre <[email protected]>
6ef656c
to
4db2891
Compare
Did a quick pass: Could you explain what Also, I think the code shouldn't be specific to migration but should handle general scenarios (including the migration case as well). wdyt? |
The I agree the code shouldn't be migration-specific. The simple approach in my second commit (just adding checks for macaroons.db and sphinxreplay.db) addresses what's actually needed:
I can update the PR to remove the migration-specific code and focus only on adding the additional file checks, which is what users need right now. Would that approach work better? |
I think it would be better if the approach focused on solving the original issue:
I believe there are some straightforward ways to solve this issue using general logic. Suggestion: It would be better if you push fully working and tested code that reflects the intended behavior. |
Change Description
Fix issue #9708 by checking for existing SQLite database files before warning about bbolt files.
Currently, when users start LND with the SQLite backend, they see warnings about existing bbolt database files even if they've already migrated their data using
lndinit migrate-db
. This PR enhances the warning system to only display these messages when a SQLite file doesn't exist yet, reducing confusion for users who have already completed migration.Steps to Test
Create a test environment with bbolt database files:
Migrate to SQLite:
Run with SQLite backend before applying this fix:
Observe the warnings about existing bbolt files.
Run with SQLite backend after applying this fix:
No warnings should appear since SQLite files exist.
Delete the SQLite files and run again:
Warnings should reappear because bbolt files exist but SQLite files don't.
Pull Request Checklist
Testing
Code Style and Documentation