Skip to content

Conversation

@ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Jun 19, 2024

  • Resolves: #

Summary

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.

TODO

  • Do

Checklist

@ChristophWurst
Copy link
Member Author

/backport to stable29

@ChristophWurst
Copy link
Member Author

/backport to stable28

@ChristophWurst
Copy link
Member Author

/backport to stable27

// 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

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

The method OCP\DB\IResult::fetchColumn has been marked as deprecated
@ChristophWurst ChristophWurst force-pushed the fix/dav/limit-sync-token-created-at-updates branch from 19379b2 to c051834 Compare June 19, 2024 13:27
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 <[email protected]>
@ChristophWurst ChristophWurst force-pushed the fix/dav/limit-sync-token-created-at-updates branch from c051834 to 169eeda Compare June 19, 2024 13:38
@ChristophWurst
Copy link
Member Author

/backport to stable26

@backportbot

This comment was marked as resolved.

@blizzz blizzz mentioned this pull request Jul 24, 2024
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

Development

Successfully merging this pull request may close these issues.

6 participants