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:
- Migrate DB to postgres
- Restore LND data directory to the state before migration
- 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:
- Migrate DB to postgres for node bob
- Try to migrate the DB to postgres for node charlie, using the same postgres DB server as bob
- I get
!!!Migration of all mandatory db parts completed successfully!!!
In this case, I would have expected either of the following
- Error out and say you can't use the same postgres server for 2 nodes, or
- 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?
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:
In this scenario,
lndinit migrate-dbchecks 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:
!!!Migration of all mandatory db parts completed successfully!!!In this case, I would have expected either of the following
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?