diff --git a/weed/command/scaffold/filer.toml b/weed/command/scaffold/filer.toml index 52df80744..397b93887 100644 --- a/weed/command/scaffold/filer.toml +++ b/weed/command/scaffold/filer.toml @@ -68,7 +68,7 @@ port = 3306 username = "root" password = "" database = "" # create or use an existing database -connection_max_idle = 10 +connection_max_idle = 50 connection_max_open = 50 connection_max_lifetime_seconds = 300 interpolateParams = false @@ -97,7 +97,7 @@ port = 3306 username = "root" password = "" database = "" # create or use an existing database -connection_max_idle = 10 +connection_max_idle = 50 connection_max_open = 50 connection_max_lifetime_seconds = 300 interpolateParams = false @@ -127,7 +127,7 @@ sslmode = "disable" # sslkey = "/path/to/client.key" # client private key file # sslrootcert = "/path/to/ca.crt" # CA certificate file # sslcrl = "/path/to/client.crl" # Certificate Revocation List (CRL) (optional) -connection_max_idle = 10 +connection_max_idle = 50 connection_max_open = 50 connection_max_lifetime_seconds = 300 # Set to true when using PgBouncer connection pooler @@ -166,7 +166,7 @@ sslmode = "disable" # sslkey = "/path/to/client.key" # client private key file # sslrootcert = "/path/to/ca.crt" # CA certificate file # sslcrl = "/path/to/client.crl" # Certificate Revocation List (CRL) (optional) -connection_max_idle = 10 +connection_max_idle = 50 connection_max_open = 50 connection_max_lifetime_seconds = 300 # Set to true when using PgBouncer connection pooler diff --git a/weed/filer/mysql/mysql_store.go b/weed/filer/mysql/mysql_store.go index abcef6fe6..5a7cf9da0 100644 --- a/weed/filer/mysql/mysql_store.go +++ b/weed/filer/mysql/mysql_store.go @@ -33,8 +33,12 @@ func (store *MysqlStore) GetName() string { } func (store *MysqlStore) Initialize(configuration util.Configuration, prefix string) (err error) { - // Absent key keeps a pooled default; an explicit 0 disables the idle pool. - configuration.SetDefault(prefix+"connection_max_idle", 2) + // Fewer idle slots than concurrent operations means a fresh connection per + // operation, until the filer runs out of ephemeral ports. connection_max_open + // stays unset: a listing runs a second query from its own callback, so a + // bounded pool deadlocks once the concurrency reaches it. + configuration.SetDefault(prefix+"connection_max_idle", 50) + configuration.SetDefault(prefix+"connection_max_lifetime_seconds", 300) // Default on so minimal configs avoid the duplicate-key roundtrip the // inode-index KvPut would otherwise emit on every write. configuration.SetDefault(prefix+"enableUpsert", true) diff --git a/weed/filer/mysql2/mysql2_store.go b/weed/filer/mysql2/mysql2_store.go index 0783398a3..e8b0af261 100644 --- a/weed/filer/mysql2/mysql2_store.go +++ b/weed/filer/mysql2/mysql2_store.go @@ -33,8 +33,12 @@ func (store *MysqlStore2) GetName() string { } func (store *MysqlStore2) Initialize(configuration util.Configuration, prefix string) (err error) { - // Absent key keeps a pooled default; an explicit 0 disables the idle pool. - configuration.SetDefault(prefix+"connection_max_idle", 2) + // Fewer idle slots than concurrent operations means a fresh connection per + // operation, until the filer runs out of ephemeral ports. connection_max_open + // stays unset: a listing runs a second query from its own callback, so a + // bounded pool deadlocks once the concurrency reaches it. + configuration.SetDefault(prefix+"connection_max_idle", 50) + configuration.SetDefault(prefix+"connection_max_lifetime_seconds", 300) // Default on so minimal configs avoid the duplicate-key roundtrip the // inode-index KvPut would otherwise emit on every write. configuration.SetDefault(prefix+"enableUpsert", true) diff --git a/weed/filer/postgres/postgres_store.go b/weed/filer/postgres/postgres_store.go index c694f77c3..62f27b327 100644 --- a/weed/filer/postgres/postgres_store.go +++ b/weed/filer/postgres/postgres_store.go @@ -28,8 +28,12 @@ func (store *PostgresStore) GetName() string { } func (store *PostgresStore) Initialize(configuration util.Configuration, prefix string) (err error) { - // Absent key keeps a pooled default; an explicit 0 disables the idle pool. - configuration.SetDefault(prefix+"connection_max_idle", 2) + // Fewer idle slots than concurrent operations means a fresh connection per + // operation, until the filer runs out of ephemeral ports. connection_max_open + // stays unset: a listing runs a second query from its own callback, so a + // bounded pool deadlocks once the concurrency reaches it. + configuration.SetDefault(prefix+"connection_max_idle", 50) + configuration.SetDefault(prefix+"connection_max_lifetime_seconds", 300) // Default on so minimal configs are not exposed to duplicate-key tx // poisoning on Postgres; an explicit false still disables it. configuration.SetDefault(prefix+"enableUpsert", true) diff --git a/weed/filer/postgres2/postgres2_store.go b/weed/filer/postgres2/postgres2_store.go index e846bdf9f..2eb85764a 100644 --- a/weed/filer/postgres2/postgres2_store.go +++ b/weed/filer/postgres2/postgres2_store.go @@ -33,8 +33,12 @@ func (store *PostgresStore2) GetName() string { } func (store *PostgresStore2) Initialize(configuration util.Configuration, prefix string) (err error) { - // Absent key keeps a pooled default; an explicit 0 disables the idle pool. - configuration.SetDefault(prefix+"connection_max_idle", 2) + // Fewer idle slots than concurrent operations means a fresh connection per + // operation, until the filer runs out of ephemeral ports. connection_max_open + // stays unset: a listing runs a second query from its own callback, so a + // bounded pool deadlocks once the concurrency reaches it. + configuration.SetDefault(prefix+"connection_max_idle", 50) + configuration.SetDefault(prefix+"connection_max_lifetime_seconds", 300) // Default on so minimal configs are not exposed to duplicate-key tx // poisoning on Postgres; an explicit false still disables it. configuration.SetDefault(prefix+"enableUpsert", true)