core-lightning/tests
Christian Decker 3f3a48dae9 db: Turn the transaction counter into an optimistic lock
The optimistic lock prevents multiple instances of c-lightning making
concurrent modifications to the database. That would be unsafe as it messes up
the state in the DB. The optimistic lock is implemented by checking whether a
gated update on the previous value of the `data_version` actually results in
an update. If that's not the case the DB has been changed under our feet.

The lock provides linearizability of DB modifications: if a database is
changed under the feet of a running process that process will `abort()`, which
from a global point of view is as if it had crashed right after the last
successful commit. Any process that also changed the DB must've started
between the last successful commit and the unsuccessful one since otherwise
its counters would not have matched (which would also have aborted that
transaction). So this reduces all the possible timelines to an equivalent
where the first process died, and the second process recovered from the DB.

This is not that interesting for `sqlite3` where we are also protected via the
PID file, but when running on multiple hosts against the same DB, e.g., with
`postgres`, this protection becomes important.

Changelog-Added: DB: Optimistic logging prevents instances from running concurrently against the same database, providing linear consistency to changes.
2020-01-02 14:12:59 -06:00
..
data pytest: test db upgrade. 2019-09-06 14:19:14 +02:00
plugins pytest: demonstrate failing rpc_command hook rewrite to plugin. 2019-12-07 21:26:31 +01:00
benchmark.py py-tests: rename 'announce' to 'wait_for_announce' 2018-12-08 15:15:55 -08:00
conftest.py pytest: Pass result to fixtures and keep directories of failed tests 2018-08-07 00:54:19 +00:00
db.py pytest: Have the DB provider search for the postgres binary 2019-09-22 02:03:43 +00:00
fixtures.py pyln: Allow users to override the LightningNode class 2019-11-12 21:23:55 +01:00
requirements.txt fix: pip dependency version for psycopg2-binary 2019-12-19 13:26:13 +01:00
test_closing.py pytest: Skip test_closing_torture under valgrind 2020-01-02 16:05:52 +01:00
test_connection.py funding: enable push_msat 2019-12-24 12:04:01 -06:00
test_db.py db: Turn the transaction counter into an optimistic lock 2020-01-02 14:12:59 -06:00
test_gossip.py Protocol: make var_onion, payment_secret and basic_mpp non-EXPERIMENTAL. 2019-12-12 22:16:03 +01:00
test_invoices.py pytest: Mark some tests as skippable that are too bitcoin-specific 2019-10-03 04:32:57 +00:00
test_misc.py pyln: Work around the socket path length on Linux OSs 2020-01-02 16:05:52 +01:00
test_pay.py channeld: treat all incoming errors as "soft", so we retry. 2019-12-13 16:36:18 +01:00
test_plugin.py plugin_control: more descriptive key for 'plugin stop' result 2019-12-29 06:44:22 +08:00
test_wallet.py pytest: Stabilize the hsm_encryption test 2019-12-11 16:18:34 +01:00
utils.py Protocol: make var_onion, payment_secret and basic_mpp non-EXPERIMENTAL. 2019-12-12 22:16:03 +01:00