Commit Graph

14 Commits

Author SHA1 Message Date
Christian Decker
a1f005012a backup: Perform preflight checks before entering the plugin loop 2020-05-18 22:44:49 +02:00
Christian Decker
fbc494ec23 backup: Kill lightningd instead of the roundabout way around
Looking up the process parents and searching for `lightnignd` allows us to
kill directly. It also means we no longer have to wait for the RPC to be
enabled to abort.
2020-05-18 22:44:49 +02:00
Christian Decker
9b5a9076d4 backup: Fix flaky test due to logs being dropped on shutdown
We were writing logs directly before killing `lightningd` which resulted in
the logs being lost. The subsequent check for the log-lines then would fail
obviously.
2020-05-18 22:44:49 +02:00
Michal Rostecki
e7c1ae60a1 backup: Remove duplicate call of initialize()
Before this change, backup backend was initialized twice - in on_init()
and get_backend() functions. This change leaves only one call in
get_backend() and adds a kwarg determining whether init failure should
be fatal.

Signed-off-by: Michal Rostecki <mrostecki@mailfence.com>
2020-04-15 21:00:30 +02:00
Christian Decker
ef31a4ac85 backup: Refuse to create a new FileBakend if the backing file exists 2020-04-12 19:35:21 +02:00
Christian Decker
ce49404eb4 backup: Add PRAGMA foreign_keys=on when restoring so cascades work
We heavily rely on foreign key constraints to keep the DB consistent and drop
dependent objects such as UTXO set entries when we roll back a block. We also
need to enable the foreign key constraints when restoring otherwise these
dependents are not removed and we run into constraint violations.
2020-04-12 19:35:21 +02:00
Christian Decker
a68758b1d0 backup: Implement the restore method for all backends
Also implements the `stream_changes` function in the FileBackend which is used
by `restore` to get all the changes.
2020-04-12 19:35:21 +02:00
Christian Decker
caa5c0a16b backup: Add the version to the FileBackend format 2020-04-12 19:35:21 +02:00
Christian Decker
8f2eea2840 backend: Make sure that initialize initializes the metadata 2020-04-12 19:35:21 +02:00
Christian Decker
4c146bf2a4 backend: Use th backup URL in backup-cli and add snapshot type to FileBackend 2020-04-12 19:35:21 +02:00
Christian Decker
c58e675877 backup: Ensure at startup that the backup backend was initialized 2020-04-12 19:35:21 +02:00
Christian Decker
97c702731a backup: Add a bit more documentation to the abstract backend class 2020-04-12 19:35:21 +02:00
Christian Decker
4e19c32444 backup: Add backup-cli tool and use it to initialize the backups 2020-04-12 19:35:21 +02:00
Christian Decker
c049069cff backup: Initial version of the backup plugin 2020-04-12 19:35:21 +02:00