0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-12 15:37:27 +00:00
nextcloud_server/lib/private/DB
Louis Chemineau f9a4e80a72 fix: Initialize lastConnectionCheck after first connection
We are checking whether the DB connection is alive once every 30 seconds. But when we are lacking the last check time, we are skipping the check and reconnect logic. This is causing the reconnect logic to never fire in those cases.

It seems to me that "those cases", are actually always the case, as upon initialization, we are not using the proper connection name to store the time.

In the `connect()` logic, when `$this->_conn` is null, `$this->getConnectionName()` is returning `replica`, so `$this->lastConnectionCheck` will be equal to `['replica' => time()];`

60711ea4cf/lib/private/DB/Connection.php (L215-L221)

60711ea4cf/lib/private/DB/Connection.php (L891-L893)

2b6d7bf65f/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php (L136-L139)

Then, if the connection name ends up as being 'primary', the reconnect logic is skipped:

60711ea4cf/lib/private/DB/Connection.php (L874-L880)

Follow-up of https://github.com/nextcloud/server/pull/41819

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-02-25 11:08:43 +00:00
..
Exceptions fix: Check for wrapped retriable exceptions 2023-05-02 19:42:11 +02:00
QueryBuilder fix: Remove bogus code from query builder and fix parameter name 2024-04-30 10:47:46 +02:00
Adapter.php fix: Apply new coding standard to all files 2024-04-04 11:45:22 +02:00
AdapterMySQL.php composer run cs:fix 2023-01-20 11:45:08 +01:00
AdapterOCI8.php Update php licenses 2021-06-04 22:02:41 +02:00
AdapterPgSql.php Check style update 2022-01-13 00:19:07 +01:00
AdapterSqlite.php fix: Apply new coding standard to all files 2024-04-04 11:45:22 +02:00
BacktraceDebugStack.php log start time of queries for profiler 2023-02-14 15:16:15 +01:00
Connection.php fix: Initialize lastConnectionCheck after first connection 2025-02-25 11:08:43 +00:00
ConnectionAdapter.php feat: add additional logging for database errors 2024-07-25 14:47:27 +02:00
ConnectionFactory.php fix(ConvertType): Read dbtype in createConnectionParams and remove safeguard 2025-01-30 12:21:30 +01:00
DbDataCollector.php fix: Apply new coding standard to all files 2024-04-04 11:45:22 +02:00
MigrationException.php Update php licenses 2021-06-04 22:02:41 +02:00
MigrationService.php fix(migration): Make compatible with PHP 8.0 2024-12-05 12:08:16 +01:00
Migrator.php fix: Run migration sql as statement so that the primary db node is used 2024-09-09 09:39:01 +00:00
MigratorExecuteSqlEvent.php Declare strict types in all new Event classes 2022-08-25 16:15:49 +02:00
MissingColumnInformation.php Migrate missing column database check to new API 2023-11-27 15:23:52 +01:00
MissingIndexInformation.php Migrate missing index database check to new API 2023-11-27 15:23:52 +01:00
MissingPrimaryKeyInformation.php Migrate missing primary key database check to new API 2023-11-27 15:23:52 +01:00
MySqlTools.php Refactors "strpos" calls in lib/private to improve code readability. 2023-05-15 15:17:19 +03:30
ObjectParameter.php Add a built-in profiler inside Nextcloud 2022-04-04 10:28:26 +02:00
OCSqlitePlatform.php Update php licenses 2021-06-04 22:02:41 +02:00
OracleConnection.php Cleanup plsam issues in DB/ContactsManager and Console 2023-09-05 09:20:26 +02:00
OracleMigrator.php fix(oracle): Move away from internal and deprecated SchemaDiff API 2023-10-06 15:29:26 +02:00
PgSqlTools.php Use typed version of IConfig::getSystemValue as much as possible 2023-04-05 12:50:08 +02:00
PreparedStatement.php composer run cs:fix 2023-01-20 11:45:08 +01:00
ResultAdapter.php composer run cs:fix 2023-01-20 11:45:08 +01:00
SchemaWrapper.php Refactors "strpos" calls in lib/private to improve code readability. 2023-05-15 15:17:19 +03:30
SetTransactionIsolationLevel.php enh: Implement PrimaryReadReplicaConnection 2023-12-16 20:27:37 +01:00
SQLiteMigrator.php fix(sqlite): Remove some old SQLite cheats 2023-10-06 15:29:27 +02:00
SQLiteSessionInit.php Update php licenses 2021-06-04 22:02:41 +02:00