aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB/Connection.php
Commit message (Collapse)AuthorAgeFilesLines
* feat: Add option to also log parameters to query logMarcel Müller2025-04-191-3/+8
| | | | Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
* feat(db): add truncateTable methodpulsejet/truncate-1Varun Patil2025-03-021-0/+13
| | | | Signed-off-by: Varun Patil <varunpatil@ucla.edu>
* feat: support migrating an instance to shardingsharding-existingRobin Appelman2025-02-251-4/+8
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* fix: Initialize lastConnectionCheck after first connectionartonge/fix/login_flow_v2_sessionsLouis Chemineau2025-02-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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()];` https://github.com/nextcloud/server/blob/60711ea4cfde6f53d0b18bcd7e166a34a43056a5/lib/private/DB/Connection.php#L215-L221 https://github.com/nextcloud/server/blob/60711ea4cfde6f53d0b18bcd7e166a34a43056a5/lib/private/DB/Connection.php#L891-L893 https://github.com/nextcloud/3rdparty/blob/2b6d7bf65ff242ea050e736925f752a38d8da220/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php#L136-L139 Then, if the connection name ends up as being 'primary', the reconnect logic is skipped: https://github.com/nextcloud/server/blob/60711ea4cfde6f53d0b18bcd7e166a34a43056a5/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>
* chore: Add proper deprecation dates where missingFerdinand Thiessen2024-09-201-2/+2
| | | | Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* chore(deps): Update nextcloud/coding-standard to v1.3.1provokateurin2024-09-191-4/+4
| | | | Signed-off-by: provokateurin <kate@provokateurin.de>
* fix(DB): do not assume sharding is always enabledArthur Schiwon2024-08-291-13/+19
| | | | Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* fix: only allow pre-defined shardsRobin Appelman2024-08-281-8/+30
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* feat: implement distributing partitioned queries over multiple shardsRobin Appelman2024-08-281-3/+71
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* feat: add option to automatically partition queries by specific tablesRobin Appelman2024-08-281-1/+18
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* fix(db): Increase log level for very slow transactionsChristoph Wurst2024-08-271-2/+29
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* style: update codestyle for coding-standard 1.2.3Daniel Kesselberg2024-08-251-13/+13
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* feat: add additional logging for database errorsRobin Appelman2024-07-241-4/+47
| | | | | | including the stack trace of the current database transaction Signed-off-by: Robin Appelman <robin@icewind.nl>
* fix(db): Fix md5 for oracle >= 20Joas Schilling2024-07-191-0/+10
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* fix(db): Deprecate `IExpressionBuilder::or()` and ↵Joas Schilling2024-07-191-6/+6
| | | | | | `IExpressionBuilder::and()` without parameters Signed-off-by: Joas Schilling <coding@schilljs.com>
* fix(db): Promote the use of `getDatabaseProvider` to reduce the impage of ↵Joas Schilling2024-07-191-0/+20
| | | | | | removed upstream platforms Signed-off-by: Joas Schilling <coding@schilljs.com>
* fix(db): `Doctrine\DBAL\Connection::executeUpdate()` is deprecatedJoas Schilling2024-07-191-4/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* fix(db): Use `createSchemaManager()` method as `getSchemaManager()` is ↵Joas Schilling2024-07-191-2/+2
| | | | | | deprecated Signed-off-by: Joas Schilling <coding@schilljs.com>
* Merge branch 'master' into refactor/OC-Server-getSecureRandomJohn Molakvoæ2024-05-301-63/+186
|\ | | | | Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
| * fix(db): Prevent two connections for single node databasesChristoph Wurst2024-05-281-1/+11
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * Merge pull request #39589 from ↵Thomas Citharel2024-05-271-0/+2
| |\ | | | | | | | | | | | | nextcloud/enh/set-nest-transactions-with-savepoints set Doctrine to use nest transactions with savepoints
| | * feat(db): set Doctrine to use nest transactions with savepointsThomas Citharel2024-02-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using nested transactions without savepoints is actually deprecated by Doctrine: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/transactions.html#transaction-nesting Without savepoints, a nested transaction can be rollbacked but not handled properly in the "real" transaction, leading to the following error: Transaction commit failed because the transaction has been marked for rollback only. Ref https://github.com/nextcloud/server/pull/36528#issuecomment-1639913965 (and possibly) https://github.com/nextcloud/server/issues/38902#issuecomment-1598075391 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
| * | fix(db): Log loong transaction times at debug levelJosh2024-05-251-2/+2
| | | | | | | | | Signed-off-by: Josh <josh.t.richards@gmail.com>
| * | chore: Add SPDX headerAndy Scherzinger2024-05-241-30/+3
| | | | | | | | | | | | Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
| * | feat: add option to add backtrace to the query loggerRobin Appelman2024-05-011-1/+7
| | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
| * | feat: add request id as comment to all queriesRobin Appelman2024-04-171-8/+20
| | | | | | | | | | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
| * | chore(db): move to OCP\ServerGit'Fellow2024-04-131-6/+7
| | | | | | | | | Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
| * | fix: Apply new coding standard to all filesCôme Chilliet2024-04-021-3/+3
| |/ | | | | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
| * Merge pull request #43297 from nextcloud/fix/db/dirty-read-cool-offChristoph Wurst2024-02-191-3/+20
| |\ | | | | | | fix(db): Let dirty writes cool off
| | * fix(db): Let dirty writes cool offChristoph Wurst2024-02-191-3/+20
| | | | | | | | | | | | | | | | | | | | | We can assume that after a few seconds a read will be clean again. This is helpful for false warnings in long running processes. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * | fix(db): Give dirty read exception a messageChristoph Wurst2024-02-151-1/+1
| | | | | | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * | fix(db): Unify long transaction log/exception messageChristoph Wurst2024-02-131-1/+1
| |/ | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * fix(db): Execute dirty reads on the primary nodeChristoph Wurst2024-01-301-0/+4
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * feat(db): Make dirty query logging available in productionChristoph Wurst2024-01-301-1/+9
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * Merge pull request #42929 from nextcloud/fix/db/transacted-read-not-dirtyChristoph Wurst2024-01-231-2/+5
| |\ | | | | | | fix(db): Do not log transacted reads as dirty read
| | * fix(db): Do not log transacted reads as dirty readChristoph Wurst2024-01-181-2/+5
| | | | | | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * | fix(db): Remove very verbose dirty query logsChristoph Wurst2024-01-181-11/+0
| |/ | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
| * fix: Add reconnect check in case of timeouts on the db sideJulius Härtl2024-01-121-0/+27
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
| * feat: First attempt to track dirty tables after writes and switch back to ↵Julius Härtl2024-01-121-0/+27
| | | | | | | | | | | | | | | | | | | | replicas if reads go to other tables Signed-off-by: Julius Härtl <jus@bitgrid.net> debug: error log Signed-off-by: Julius Härtl <jus@bitgrid.net>
| * feat: Add logging for transaction timeJulius Härtl2024-01-121-0/+34
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
| * enh: Implement PrimaryReadReplicaConnectionJulius Härtl2023-12-161-2/+17
| | | | | | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
| * chore: apply changes from Nextcloud coding standards 1.1.1Joas Schilling2023-11-231-2/+2
| | | | | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
| * fix(mysql): Remove custom MySQL workaround from 2015Joas Schilling2023-10-061-2/+0
| | | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
| * fix(postgres): Remove old Postgres 9.4 workaroundJoas Schilling2023-10-061-3/+0
| | | | | | | | | | | | | | | | Postgres 10 is the minimum in the meantime and doctrine/dbal fixed this in 2.6.0 already ref https://github.com/doctrine/dbal/pull/2614 Signed-off-by: Joas Schilling <coding@schilljs.com>
| * fix(sqlite): Remove no longer required autoincrement fixJoas Schilling2023-10-061-2/+2
| | | | | | | | | | | | | | | | | | - I installed current master and exported the schema as SQL - Then I went to this branch, removed the content of the run() method (so made it no-op) - I installed again and exported the schema as SQL - The files are exactly the same, so whatever we tried to fix was fixed since 2015 in doctrine dbal Signed-off-by: Joas Schilling <coding@schilljs.com>
| * Cleanup plsam issues in DB/ContactsManager and ConsoleCarl Schwan2023-09-051-8/+8
| | | | | | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Refactor `OC\Server::getSecureRandom`Andrew Summers2023-08-291-1/+2
|/ | | | Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
* fix DBAL exception handling in setValuesArthur Schiwon2023-03-311-7/+11
| | | | | | | | | This seems to be a left over after abstracting DBAL. Nowadays, IQueryBuilder::executeStatement() only throws a \OCP\DB\Exception, where previously original DBAL exceptions where thrown. These are now wrapped, the orignal classes are now mapped to a reason. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
* Fix more psalm issues in OC\DBCôme Chilliet2022-11-211-2/+4
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Fix psalm issues following doctrine/dbal bumpCôme Chilliet2022-11-211-3/+4
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>