-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Merged
ChristophWurst
merged 1 commit into
master
from
fix/dav/limit-sync-token-created-at-updates
Jun 19, 2024
Merged
fix(dav): Limit number of UPDATES for sync token created_at #45968
ChristophWurst
merged 1 commit into
master
from
fix/dav/limit-sync-token-created-at-updates
Jun 19, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChristophWurst
added
bug
3. to review
Waiting for reviews
feature: dav
feature: install and update
feature: caldav
Related to CalDAV internals
feature: carddav
Related to CardDAV internals
labels
Jun 19, 2024
ChristophWurst
requested review from
icewind1991,
st3iny,
tcitworld,
miaulalala and
SebastianKrupinski
June 19, 2024 10:35
/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
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
icewind1991
approved these changes
Jun 19, 2024
miaulalala
approved these changes
Jun 19, 2024
ChristophWurst
force-pushed
the
fix/dav/limit-sync-token-created-at-updates
branch
from
June 19, 2024 13:27
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>
ChristophWurst
force-pushed
the
fix/dav/limit-sync-token-created-at-updates
branch
from
June 19, 2024 13:38
c051834
to
169eeda
Compare
SebastianKrupinski
approved these changes
Jun 19, 2024
/backport to stable26 |
This comment was marked as resolved.
This comment was marked as resolved.
Merged
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
backport-request
bug
feature: caldav
Related to CalDAV internals
feature: carddav
Related to CardDAV internals
feature: dav
feature: install and update
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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