Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix optimistic concurrency issue with read model projections #1558

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

MarcAstr0
Copy link
Collaborator

@MarcAstr0 MarcAstr0 commented Nov 24, 2024

Description

The provider libraries have two methods for read model retrieval: fetch and search. In the implementation for the Azure provider, only the former was adding an optimisticConcurrencyValue property to the boosterMetadata. This value stores the Cosmos DB _etag property for the document and is used to handle optimistic concurrency scenarios.

Read model projection issues related to optimistic concurrency have been found due to the search method being used instead of fetch. Some read models weren't properly projected when a simultaneous update occurred because the optimistic concurrency verification wasn't happening due to the optimisticConcurrencyValue property not being in the boosterMetadata.

This PR fixes this by including this property in the search method implementation results.

Changes

  • Modified the Azure provider's read model search method so that it writes the _etag as the optimisticConcurrencyValue in the boosterMetadata.

Checks

  • Project Builds
  • Project passes tests and checks
  • Updated documentation accordingly

@MarcAstr0
Copy link
Collaborator Author

/integration sha=2e73191c62c9e35131e2bf1d389b1bfe6af6b7a8

Copy link

what-the-diff bot commented Nov 24, 2024

PR Summary

  • Introduction of a New Change Log File
    A new file that records changes (referred to as a change log) was added. This change log is specifically for noting updates to a software package named @boostercloud/framework-core. The latest update resolves an issue with too much confidence in the consistency of certain data projections in the read model.

  • Upgrade to Resource Mapping in 'query-helper.ts' File
    Modifications were made to a file called query-helper.ts. These changes are aimed at better mapping of resources by inserting a new property called optimisticConcurrencyValue to the boosterMetadata object. To accomplish this, the _etag (which is an identifier used for managing updates to resources) of each resource was utilized.

Copy link
Contributor

⌛ Integration tests are running...

Check their status here 👈

Copy link
Contributor

✅ Integration tests have finished successfully!

@MarcAstr0 MarcAstr0 added the bug Something isn't working label Nov 25, 2024
@MarcAstr0 MarcAstr0 changed the title Fix optimistic concurrency Fix optimistic concurrency issue with read model projections Nov 25, 2024
@MarcAstr0 MarcAstr0 marked this pull request as ready for review November 25, 2024 12:51
Copy link
Collaborator

@davidverdu davidverdu left a comment

Choose a reason for hiding this comment

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

LGTM

@MarcAstr0 MarcAstr0 merged commit 55cc944 into boostercloud:main Nov 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants