Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Always save the latest available version of QuestionnaireStore. #1921

Conversation

bitdivision
Copy link
Contributor

@bitdivision bitdivision commented Dec 3, 2018

What is the context of this PR?

Currently, we are able to read version 3 in production, but can only write version 2.

While making the changes to write version 3, it became clear that there is an issue around what version we are writing for the questionnaire store.

In a deployment as follows (I've represented the version of the data with data_version):

  1. Instance running version 2 saves QuestionnaireStore. {version=2, data_version=2}
  2. Instance running version 3 loads QuestionnaireStore with version 2, upgrades to version 3, and saves {version=3, data_version=3}
  3. Instance running version 2 loads QuestionnaireStore with version 3, and saves with {version=3, data_version=2}

At this point we have a mismatched version number, which will cause errors when an application tries to load it.

To avoid this, we can ensure that we always write the latest version which the current code can write, rather than the highest possible version.

How to review

I have a branch which adds the writing functionality of version 3. This can be used to test it.

  1. Checkout master, start a questionnaire
  2. Checkout 2647-update-questionnaire-store-version-for-compression-and-new-answerstore-storage-format, restart server, continue questionnaire.
  3. Checkout master, restart server, continue questionnaire.
  4. You should see errors
  5. Checkout this PR's branch, start a questionnaire
  6. Checkout 2647-update-questionnaire-store-version-for-compression-and-new-answerstore-storage-format, merge this PR into it, continue your questionnaire.
  7. Checkout this PR, continue your questionnaire
  8. Checkout 2647-update-questionnaire-store-version-for-compression-and-new-answerstore-storage-format, continue questionnaire, and ensure it's all working

Checklist

  • New static content marked up for translation
  • Newly defined schema content included in eq-translations repo

@jonnyshaw89
Copy link
Contributor

Are they also answers after submission and session store writes that need to be updated?

@bitdivision
Copy link
Contributor Author

Are they also answers after submission and session store writes that need to be updated?

I think this only applies to QuestionnaireStore writes? This PR just fixes a defect in how the version was written.

Maybe I've missed something?

@bitdivision
Copy link
Contributor Author

@ajmaddaford I've made a few changes to make it a bit clearer what's going on with the version of QuestionnaireStore.

Copy link
Contributor

@MebinAbraham MebinAbraham left a comment

Choose a reason for hiding this comment

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

Tested the scenarios and, the version seems to always match the data version. Checked the data in Postgres and all seems as expected.

@bitdivision bitdivision force-pushed the eq-2659-always-store-latest-version-of-questionnairestore branch from 2df0574 to 4fa36c8 Compare December 4, 2018 14:31
@MebinAbraham MebinAbraham merged commit 98cba85 into master Dec 4, 2018
@MebinAbraham MebinAbraham deleted the eq-2659-always-store-latest-version-of-questionnairestore branch December 4, 2018 15:19
@bitdivision bitdivision mentioned this pull request Dec 6, 2018
2 tasks
@bitdivision bitdivision modified the milestones: v2.75.X, v2.76.x Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants