Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix(dav): Limit number of UPDATES for sync token created_at #45991

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Jun 19, 2024

Backport of PR #45968

Address book and calendar sync tokens have a created_at column in 26+
and we need to assign a current timestamp to the existing data at
upgrade so the data isn't cleaned up immediately. Updating the full
table is expensive and fails on clustered setups that limit transaction
size. We don't need a timestamp for the oldest rows so we can skip
updating them.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
// The threshold is higher than the default of \OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob
// but small enough to fit into a cluster transaction size.
// For a 50k users instance that would still keep 10 changes on average.
$limit = max(1, (int) $this->appConfig->getAppValue('totalNumberOfSyncTokensToKeep', '500000'));

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\AppFramework\Services\IAppConfig::getAppValue has been marked as deprecated
->setFirstResult($limit)
->setMaxResults(1);
$oldestIdResult = $thresholdSelect->executeQuery();
$oldestId = $oldestIdResult->fetchColumn();

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OCP\DB\IResult::fetchColumn has been marked as deprecated
@AndyScherzinger AndyScherzinger merged commit 56d4906 into stable29 Jun 20, 2024
167 of 168 checks passed
@AndyScherzinger AndyScherzinger deleted the backport/45968/stable29 branch June 20, 2024 11:40
@skjnldsv skjnldsv mentioned this pull request Jun 20, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: caldav Related to CalDAV internals feature: carddav Related to CardDAV internals feature: dav feature: install and update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants