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

Prevent duplicate entity version numbers #541

Closed
matthew-white opened this issue Nov 2, 2023 · 0 comments · Fixed by getodk/central-backend#1033
Closed

Prevent duplicate entity version numbers #541

matthew-white opened this issue Nov 2, 2023 · 0 comments · Fixed by getodk/central-backend#1033
Assignees
Labels
backend Requires a change to the API server entities Multiple Encounter workflows

Comments

@matthew-white
Copy link
Member

Right now, it may be possible for concurrent entity updates to result in two entity versions with the same version number:

  • Create a new entity. Its version number is 1.
  • Send a request to update the entity. This results in a new version with version number 2.
  • At the same time, send another request to update the same entity. This also results in a new version, also with version number 2.

Entity updates need to be sequential, not concurrent, because each update is applied on top of the latest entity version. Application code also assumes that the version number uniquely identifies each version of a particular entity. If there are concurrent updates, only one should succeed.

To be clear, I haven't tried to reproduce the scenario above. (@sadiqkhoja, have you?) However, I think it's important that we take steps to prevent it.

@matthew-white matthew-white added backend Requires a change to the API server entities Multiple Encounter workflows labels Nov 2, 2023
@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Nov 2, 2023
@matthew-white matthew-white moved this from 🕒 backlog to ✏️ in progress in ODK Central Nov 2, 2023
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Requires a change to the API server entities Multiple Encounter workflows
Projects
Status: ✅ done
Development

Successfully merging a pull request may close this issue.

2 participants