Skip to content

Conversation

@hamza221
Copy link
Contributor

@hamza221 hamza221 commented Jan 8, 2025

  • Resolves: #

Summary

This Pr enables truncation for addressbook sync between federated instances

How to Test

what to look for:

  • if you're checking the request make sure that it respects the RFC Structure for truncated sync https://www.rfc-editor.org/rfc/rfc6578#section-3.6
  • Check the sync token in every iteration it should be 'init_currentToken_latestTokenAtTheStartOfSync''
  • at the end of initial sync it should be 'latestTokenAtTheStartOfSync'
  • Make sure that all the cards are synced at the end of the sync

Checklist

@hamza221 hamza221 self-assigned this Jan 8, 2025
@hamza221 hamza221 added 3. to review Waiting for reviews 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jan 8, 2025
@AndyScherzinger AndyScherzinger added this to the Nextcloud 31 milestone Jan 8, 2025
@hamza221 hamza221 force-pushed the feat/sync-truncation branch from c7ee3ab to 1cb4891 Compare January 10, 2025 08:08
@hamza221 hamza221 marked this pull request as ready for review January 21, 2025 12:37
@hamza221 hamza221 added feature: carddav Related to CardDAV internals feature: federation labels Jan 21, 2025
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to test this? Does this also work with clients or is it limited strictly to server-to-server synchronization?

@hamza221
Copy link
Contributor Author

hamza221 commented Jan 21, 2025

How to test this?

The limit is set to 1 here. The ways to test this that I can think of

  • Intercept the requests and check the sync token changes ,+ results (make sure that all the cards are synched, with the correct number of steps and that the sync token always reflects the correct state)
  • Logs or breakpoints can also be used

PS: In case of federation both instances need to be patched.

Does this also work with clients or is it limited strictly to server-to-server synchronisation?

It should work for client sync too, But testing server to server is also needed to cover the whole PR

This was referenced Jan 21, 2025
@blizzz blizzz mentioned this pull request Jan 29, 2025
1 task
@blizzz blizzz modified the milestones: Nextcloud 31, Nextcloud 32 Jan 29, 2025
@AndyScherzinger AndyScherzinger force-pushed the feat/sync-truncation branch 2 times, most recently from 2e2983a to c10a8cd Compare February 11, 2025 21:39
@AndyScherzinger
Copy link
Member

/backport to stable31

@ChristophWurst
Copy link
Member

Failing CI needs to be addressed and won't be resolved with rebases

@hamza221 hamza221 force-pushed the feat/sync-truncation branch from ef45c01 to 9dc7d13 Compare March 27, 2025 12:56
@hamza221 hamza221 requested a review from a team as a code owner March 27, 2025 12:56
@hamza221 hamza221 requested review from Altahrim and removed request for a team March 27, 2025 12:56
@hamza221
Copy link
Contributor Author

hamza221 commented Jun 17, 2025

Does it still run into OOM with the now lower limit?

I have 224 contacts, setting it to 50 caused the OOM, I'm assuming memory is not being freed, I'm still looking into it.

Edit: Idk if it was obvious from my comment 😅 but setting it to > 224 solved the OOM exception

@kesselb
Copy link
Contributor

kesselb commented Jun 17, 2025

Hi,

I did some more testing today and encountered a few minor issues. I'm not entirely sure if this is moving in the right direction, so I've pushed the changes to a different branch based on this one: #53551

  1. I believe the new logic returns the wrong sync token if a non-initial sync request was not truncated: 5ca43d6.

  2. We were paging through a truncated result only for initial syncs, not for regular syncs. Therefore, I added some code to expose the truncated state to the caller. This also fixes a small bug where we were triggering a deleteCard request for a card with the URI set to "system" (no such card exists, so nothing would be deleted). The reason was that the truncated state is signaled through a new response in the multistatus response, and our code was treating this new response as a vCard.

Please note that there have been some changes to config.sample.php in the meantime. If time allows, please rebase and resolve the conflicts.

@kesselb kesselb force-pushed the feat/sync-truncation branch from 7d493b1 to 29fba71 Compare July 16, 2025 13:49
@hamza221 hamza221 force-pushed the feat/sync-truncation branch from 29fba71 to 4d185b3 Compare July 16, 2025 14:41
@kesselb kesselb added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 17, 2025
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works with 5247 users in total and the limit configured to 2500, as Daniel suggested.

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Aug 1, 2025
@hamza221 hamza221 force-pushed the feat/sync-truncation branch from 91bc886 to 8124485 Compare August 6, 2025 12:12
@hamza221 hamza221 added 4. to release Ready to be released and/or waiting for tests to finish and removed 2. developing Work in progress labels Aug 6, 2025
@hamza221 hamza221 force-pushed the feat/sync-truncation branch from 8124485 to 13f25c9 Compare August 6, 2025 12:32
@hamza221 hamza221 enabled auto-merge August 6, 2025 12:32
@hamza221 hamza221 merged commit 6e9d48b into master Aug 6, 2025
198 of 201 checks passed
@hamza221 hamza221 deleted the feat/sync-truncation branch August 6, 2025 12:57
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 19, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish feature: carddav Related to CardDAV internals feature: federation 🍂 2025-Autumn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants