-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the updateExistingSession Atomic (#12669)
If two clients joined a non-live session from different clusters, they would have a race condition to modify the database collection using different URLs. For example: Tenant A opens document A and calls the getSession method to update URLs. While Tenant B opens document A and hits the race condition. Tenant A's interaction with cosmos DB hasn't been done, tenant B might still read the isSessionAlive as false, and update the URLs for the truth again. To fix it: When the service wants to update the truth in CosmosDB collection, we only make updates as atomic in condition when the isSessionAlive == false. We are doing the check at the very last instant (as a part of the upsert command itself), it will not create the race. ![MicrosoftTeams-image](https://user-images.githubusercontent.com/66701969/197908085-5552bfb6-f3de-4cfd-9197-768115036182.png)
- Loading branch information
1 parent
08be0c2
commit 7b3f64a
Showing
5 changed files
with
103 additions
and
9 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