[v12] Firestore backend improvements #28738
Merged
Merged
Conversation
The backend test suite was not validating that simultaneous CAS operations result in only one attempt succeeding. The test now runs multiple concurrent CAS operations and ensures that only a single operation succeeds. This shortcoming with the test allowed the Firestore backend to pass the compliance test while not perfoming CAS in an atomic manner.
1) CAS now utilizes a transaction to ensure the operation is atomic The original implementation did not use transactions which violated the atomic guarantees of the CAS operation. The backend compliance test was able to catch this when it was updated to run concurrent CAS opertations. 2) Update is limited to updating a value The original implementation of Update was actually doing a get and then upsert. However, there are no guarantees that prevent a delete from occurring between get and upsert, which means Update would upsert the value instead of failing. Instead of get and then upsert we now update the document using the (firestore.DocumentRef) Update method. 3) Watching items from the collection filters out any audit events If Teleport is configured to use the same collection for backend state and audit events the collection watcher ends up consuming all audit events as empty backend items. To avoid this the watcher is now filtering out any collections which have an empty key since it is not possible for backend resources to be written without a key this will only exclude audit events which have a different schema. 4) SearchEvents now filters out backend resources Similar to above, the Firestore events implementation now excludes any documents which have an empty session id to prevent backend resources from getting included in queries for audit events if the collection is being shared.
fspmarshall
approved these changes
Jul 6, 2023
jakule
approved these changes
Jul 6, 2023
espadolini
approved these changes
Jul 6, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport #28473 to branch/v12