-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move create entry "similarity" check inside of DataStore (#2475)
The entry similarity check happens only on the API level, but not within the same transaction that the entry creation takes place in. This causes a small window where two concurrent requests for similar entries can result in both being created. This PR moves the similarity check down to the SQL DataStore layer inside of the transaction that creates the entry. It also introduces a new DataStore function CreateOrReturnRegistrationEntry that returns the existing entry, that is useful for the API, but otherwise allows us to not have to update the existing CreateRegistrationEntry callers at this time. Both CreateRegistrationEntry and CreateOrReturnRegistrationEntry go through the same code paths and differ only in how they treat the case when a similar entry exists. CreateRegistrationEntry fails with AlreadyExists, while CreateOrReturnRegistrationEntry returns the existing entry along with a bool indicating that it is an existing entry. This PR does NOT address the issue that UpdateRegistrationEntry can end up creating two "similar" entries. Signed-off-by: Andrew Harding <aharding@vmware.com>
- Loading branch information
Showing
9 changed files
with
110 additions
and
62 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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