Skip to content

Relationship update request may query read-only replica #1110

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

Closed
bart-degreed opened this issue Nov 15, 2021 · 1 comment · Fixed by #1114
Closed

Relationship update request may query read-only replica #1110

bart-degreed opened this issue Nov 15, 2021 · 1 comment · Fixed by #1114
Labels

Comments

@bart-degreed
Copy link
Contributor

This bug affects APIs that use a master database to write changes to while using a set of read-only replicates to serve GET requests.

The query to determine initial state is sent to the read-only database on POST Many-to-many and DELETE To-many relationship requests.

Affected code:

IReadOnlyCollection<TResource> leftResources = await _repositoryAccessor.GetAsync<TResource>(queryLayer, cancellationToken);

Instead it should call:

_repositoryAccessor.GetForUpdateAsync()
@bart-degreed
Copy link
Contributor Author

This is not such a big problem after all, as all calls eventually reach GetAsync(), which is the place to override and switch databases based on IJsonApiRequest.IsReadOnly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant