lnd/kvdb
Olaoluwa Osuntokun 01c64712a3
multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927)
* lnwallet: fix log output msg

The log message is off by one.

* htlcswitch: fail channel when revoking it fails.

When the revocation of a channel state fails after receiving a new
CommitmentSigned msg we have to fail the channel otherwise we
continue with an unclean state.

* docs: update release-docs

* htlcswitch: tear down connection if revocation processing fails

If we couldn't revoke due to a DB error, then we want to also tear down
the connection, as we don't want the other party to continue to send
updates. That may lead to de-sync'd state an eventual force close.
Otherwise, the database might be able to recover come the next
reconnection attempt.

* kvdb: use sql.LevelSerializable for all backends

In this commit, we modify the default isolation level to be
`sql.LevelSerializable. This is the strictness isolation type for
postgres. For sqlite, there's only ever a single writer, so this doesn't
apply directly.

* kvdb/sqlbase: add randomized exponential backoff for serialization failures

In this commit, we add randomized exponential backoff for serialization
failures. For postgres, we''ll his this any time a transaction set fails
to be linearized. For sqlite, we'll his this if we have many writers
trying to grab the write lock at time same time, manifesting as a
`SQLITE_BUSY` error code.

As is, we'll retry up to 10 times, waiting a minimum of 50 miliseconds
between each attempt, up to 5 seconds without any delay at all. For
sqlite, this is also bounded by the busy timeout set, which applies on
top of this retry logic (block for busy timeout seconds, then apply this
back off logic).

* docs/release-notes: add entry for sqlite/postgres tx retry

---------

Co-authored-by: ziggie <ziggie1984@protonmail.com>
2023-08-30 16:48:00 -07:00
..
etcd kvdb+docs: remove etcd test fixture cleanup calls 2023-01-24 09:23:50 +02:00
postgres kvdb+refactor: move all general sqlite code to seprate dir 2023-01-23 09:05:11 +02:00
sqlbase multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927) 2023-08-30 16:48:00 -07:00
sqlite kvdb: add sqlite 2023-01-23 09:14:08 +02:00
backend_js.go kvdb: exclude anything bbolt related from JS builds 2021-07-22 09:47:37 +02:00
backend.go kvdb: add sqlite 2023-01-23 09:14:08 +02:00
bolt_compact.go kvdb/bolt_compact: have log message take account space multiplier 2021-11-21 21:52:30 -08:00
bolt_fixture.go kvdb: use T.TempDir to create temporary test directory 2022-08-24 09:03:04 +08:00
bolt_test.go kvdb: use T.TempDir to create temporary test directory 2022-08-24 09:03:04 +08:00
config.go kvdb: add sqlite 2023-01-23 09:14:08 +02:00
debug.go multi: add golang 1.17 compatible build tags 2021-09-29 17:31:37 -07:00
etcd_test.go kvdb+docs: remove etcd test fixture cleanup calls 2023-01-24 09:23:50 +02:00
go.mod build(deps): bump google.golang.org/grpc from 1.41.0 to 1.53.0 in /kvdb 2023-07-05 21:12:10 +00:00
go.sum build(deps): bump google.golang.org/grpc from 1.41.0 to 1.53.0 in /kvdb 2023-07-05 21:12:10 +00:00
interface.go kvdb: add ForAll 2022-01-12 19:11:53 +01:00
kvdb_etcd.go kvdb: unify how the db backend for tests is set 2023-01-23 09:05:11 +02:00
kvdb_no_etcd.go kvdb: unify how the db backend for tests is set 2023-01-23 09:05:11 +02:00
kvdb_no_postgres.go multi: run go fmt with go 1.17 2021-11-08 22:39:41 +01:00
kvdb_no_sqlite.go kvdb: add sqlite 2023-01-23 09:14:08 +02:00
kvdb_postgres.go multi: run go fmt with go 1.17 2021-11-08 22:39:41 +01:00
kvdb_sqlite.go kvdb: add sqlite 2023-01-23 09:14:08 +02:00
log.go kvdb+refactor: move all general sqlite code to seprate dir 2023-01-23 09:05:11 +02:00
nodebug.go multi: add golang 1.17 compatible build tags 2021-09-29 17:31:37 -07:00
postgres_test.go kvdb: add ForAll 2022-01-12 19:11:53 +01:00
prefetch_test.go kvdb: extra test coverage for kvdb.Prefetch 2021-09-14 13:12:23 +02:00
readwrite_bucket_test.go kvdb: add ForAll 2022-01-12 19:11:53 +01:00
readwrite_cursor_test.go kvdb/test: fix cursor tests to match bbolt semantics 2021-07-12 11:31:09 +02:00
readwrite_tx_test.go kvdb/test: generalize etcd tests 2021-07-12 11:31:05 +02:00
test_utils.go channeldb/test: test with postgres 2021-10-29 10:54:44 +02:00
test.go kvdb/test: generalize etcd tests 2021-07-12 11:31:05 +02:00