-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(dav): Limit number of UPDATES for sync token created_at #45968
fix(dav): Limit number of UPDATES for sync token created_at #45968
Conversation
/backport to stable29 |
/backport to stable28 |
/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 Note
->setFirstResult($limit) | ||
->setMaxResults(1); | ||
$oldestIdResult = $thresholdSelect->executeQuery(); | ||
$oldestId = $oldestIdResult->fetchColumn(); |
Check notice
Code scanning / Psalm
DeprecatedMethod Note
19379b2
to
c051834
Compare
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>
c051834
to
169eeda
Compare
/backport to stable26 |
The backport to # Switch to the target branch and update it
git checkout stable26
git pull origin stable26
# Create the new backport branch
git checkout -b backport/45968/stable26
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 169eedab
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/45968/stable26 Error: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
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
Checklist