Commit Graph

11 Commits

Author SHA1 Message Date
Elle Mouton
67419a7c0c
Revert "kvdb/postgres: remove global application level lock"
This reverts commit 43a1ca4f3d.
2024-10-28 09:35:18 +02:00
Olaoluwa Osuntokun
43a1ca4f3d
kvdb/postgres: remove global application level lock
In this commit, we remove the global application level lock from the
postgres backend. This lock prevents multiple write transactions from
happening at the same time, and will also block a writer if a read is on
going. Since this lock was added, we know always open DB connections
with the strongest level of concurrency control available:
`LevelSerializable`. In concert with the new auto retry logic, we ensure
that if db transactions conflict (writing the same key/row in this
case), then the tx is retried automatically.

Removing this lock should increase perf for the postgres backend, as now
concurrent write transactions can proceed, being serialized as needed.
Rather then trying to handle concurrency at the application level, we'll
set postgres do its job, with the application only needing to retry as
necessary.
2024-09-30 16:58:46 -07:00
Elle Mouton
170160f28a
kvdb+refactor: move all general sqlite code to seprate dir
In this commit, all the sql, non-postgres-specific, code is moved out of
the postgres package and into a new sqlbase package. This will make it
more easily reusable for future sql integrations.
2023-01-23 09:05:11 +02:00
Elle Mouton
30ba8cbae9
kvdb/postgres: separate general sql code from postgres
In this commit, changes are made to the `kvdb/postgres` package so that
all all the non-postgres-specific code is generalised to be applicable
for all sql code. A follow up commit will move all the general sql code
into its own package.
2023-01-23 09:05:11 +02:00
Elle Mouton
3dfaa88bb4
kvdb/postgres: remove old +build directive and cleanup
Due to the update of the kvdb package to go1.18, the `// +build`
directives are no longer required. They are removed in this commit in
order to simplify upcoming commits. Along the way, a few typos are fixed
and an unused struct is removed.
2023-01-23 09:05:11 +02:00
Elle Mouton
c6abf585ee
kvdb/postgres: make global dbConns thread safe
In this commit, a mutex is added to guard access to the global dbConns
variable in the kvdb/postgres package.
2023-01-23 09:05:11 +02:00
Joost Jager
7cd7cef6c6
htlcswitch: fix duplicate close
The decayed log database opening and closing is managed at a higher
level in config_builder.go.
2022-01-10 08:42:32 +01:00
Joost Jager
274faff980
postgres: add connection limit 2021-11-17 11:08:43 +01:00
Oliver Gugger
41c579fd09
multi: run go fmt with go 1.17 2021-11-08 22:39:41 +01:00
Joost Jager
bd291286f7
kvdb/postgres: convert all types of panic data to error
Previously the assumption existed that panic data was already an error.
If that wasn't the case for example because panic("string") was used,
the transaction wasn't unlocked.
2021-10-29 10:54:40 +02:00
Joost Jager
3eb80cac97
kvdb: add postgres 2021-09-21 10:44:18 +02:00