Skip to content

Conversation

@tomneedham
Copy link
Contributor

Description

When running the federation:sync-addressbook occ command on a large instance with many users and utilising a DB cluster, there is an issue in the createCard() method. It first inserts the command to oc_cards and then runs updateProperties() to create the properties but this method triggers getCardId() which does a select to the DB to get the ID of the card it just inserted - this is failing on clusters where the write has not yet synced.

In this PR I just cache the uri->id so that it can be utilised in the updateProperties method.

This should also remove 1 select to the DB per new user synchronised during the command.

CardDavBackend::
createCard()
updateProperties()
getCardId()

Related Issue

If you run the sync-addressbook command on a big instance with a DB cluster it fails repeatedly when the SELECT fails, meaning the command must be restarted numerous times.

Motivation and Context

This should work without having to restart the command >20 times.

How Has This Been Tested?

Local unit tests. 2 local servers running non-clustered DBs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tomneedham tomneedham self-assigned this Jul 5, 2017
@tomneedham tomneedham requested a review from DeepDiver1975 July 5, 2017 10:25
@tomneedham tomneedham changed the title Add cache for new card uri<->id to fix db cluster execution Add card id cache for use during inserting of new cards with clustered dbs Jul 5, 2017
@DeepDiver1975 DeepDiver1975 added this to the 10.1 milestone Jul 5, 2017
@DeepDiver1975 DeepDiver1975 merged commit d183968 into master Jul 6, 2017
@DeepDiver1975 DeepDiver1975 deleted the sync-addressbook-db-cluster branch July 6, 2017 19:35
@DeepDiver1975 DeepDiver1975 modified the milestones: 10.1, development Oct 10, 2017
@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants