Skip to content

Commit 2e16efe

Browse files
committed
sqldb: add global lock config options for postgres
Add two configuration options to control global lock usage for different postgres database backends: - ChannelDBWithGlobalLock: for channeldb access (default: false) - WalletDBWithGlobalLock: for wallet database access (default: true) These allow fine-grained control over which databases use global locks, rather than hardcoding the behavior. This is a temporary measure until the revocation log and wallet are migrated to native SQL and become fully concurrent-safe.
1 parent 85a5bf2 commit 2e16efe

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sqldb/config.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ func (p *SqliteConfig) Validate() error {
4444
//
4545
//nolint:ll
4646
type PostgresConfig struct {
47-
Dsn string `long:"dsn" description:"Database connection string."`
48-
Timeout time.Duration `long:"timeout" description:"Database connection timeout. Set to zero to disable."`
49-
MaxConnections int `long:"maxconnections" description:"The maximum number of open connections to the database. Set to zero for unlimited."`
50-
SkipMigrations bool `long:"skipmigrations" description:"Skip applying migrations on startup."`
51-
QueryConfig `group:"query" namespace:"query"`
47+
Dsn string `long:"dsn" description:"Database connection string."`
48+
Timeout time.Duration `long:"timeout" description:"Database connection timeout. Set to zero to disable."`
49+
MaxConnections int `long:"maxconnections" description:"The maximum number of open connections to the database. Set to zero for unlimited."`
50+
SkipMigrations bool `long:"skipmigrations" description:"Skip applying migrations on startup."`
51+
ChannelDBWithGlobalLock bool `long:"channeldb-with-global-lock" description:"Use a global lock for channeldb access. This ensures only a single writer at a time but reduces concurrency. This is a temporary workaround until the revocation log is migrated to a native sql schema."`
52+
WalletDBWithGlobalLock bool `long:"walletdb-with-global-lock" description:"Use a global lock for wallet database access. This ensures only a single writer at a time but reduces concurrency. This is a temporary workaround until the wallet subsystem is upgraded to a native sql schema."`
53+
QueryConfig `group:"query" namespace:"query"`
5254
}
5355

5456
// Validate checks that the PostgresConfig values are valid.

0 commit comments

Comments
 (0)