Closed marsu-dev closed 3 years ago
@michel-foucault
This is the result of an error that is fixed in c-lightning with #4090.
The problem was that when expanding the DB statement in order to pass
it to the db_write
hook we would expand them without checking that
they are still valid SQL.
However, if the backup was created before the fix was applied they might still have incorrectly expanded statements. So we can either build a tool to update the queries contained in the backup (iterate through the backup file and copy over statements to a new file, then swap it into place with the original file) or we rewrite on-the-fly while restoring.
FWIW, there is just a space missing between 1891733
and the WHERE
,
so depending on the size of the file this could be done manually as
well. @michel-foucault if you're happy to share the backup (for testnet
that should not be much of a concern, and we can't actually move coins
without hsm_secret
) we can build the rewrite tool and provide a
durable solution for you :-)
I added a fix in the form of PR #172 which will rewrite the statements
that have been expanded wrongly on the fly, so once you update to that
branch backup-cli restore
should work out of the box.
@michel-foucault: could you try that branch and see if it fixes the issue?
Great, Thanks for the fix.
Since I have used Postgres backend, with multiple database for multiple nodes, that cover my needs for the backup in production.
I have the backup and I will try to upgrade the code and restore from the backup (w & w/o patching it) for report.
Setup:
testnet
alpine:3.11
(amd64)3.8.2
SQLite
3.30.1
Steps to reproduce:
/var/lib/lightning/testnet/lightningd.sqlite3
is removed.Error:
The
lightningd.sqlite3
file is not restored,backup-cli
crashed with error:Traceback: