Skip to content

migrate-db: no checking if the existing postgres database matches the bbolt database being converted #47

@ZZiigguurraatt

Description

@ZZiigguurraatt

This issue relates to the https://github.com/lightninglabs/lndinit/tree/migrate-db branch, which has not yet been merged with master.

So, here's the scenario I've tested:

  1. Migrate DB to postgres
  2. Restore LND data directory to the state before migration
  3. Try to migrate again to postgres

In this scenario, lndinit migrate-db checks to see if there is a tombstone marker on source DB and when it does not see it, it then checks the postgres database for indication of successful completion. The postgres database sees the successful completion has been marked and then reports !!!Migration of all mandatory db parts completed successfully!!!. In this situation, it did not actually verify anything, it just assumed the old database matches the new one and I don't think it add a tombstone marker to the old database. I think in this scenario, there should be an error message because the old and new DB should both be in agreement on if the conversion happened or not.

Here is another scenario I've tested:

  1. Migrate DB to postgres for node bob
  2. Try to migrate the DB to postgres for node charlie, using the same postgres DB server as bob
  3. I get !!!Migration of all mandatory db parts completed successfully!!!

In this case, I would have expected either of the following

  1. Error out and say you can't use the same postgres server for 2 nodes, or
  2. Create a separate DB inside the same postgres server for the second node.

I can see a situation where one might be running multiple nodes and accidentally use the wrong postgres server when running the conversion tool and I think we need some kind of checking for that. What does LND do if you accidentally point 2 nodes to the same postgres server? Does it have any kind of check?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions