Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-2311

Implement client database backwards migration and make sure rollback works



    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      Acceptance criteria:

      • Implement database rollback when an update to v3 fails
      • Test that verifies it works, including spontaneous reboots
      • This is the expected API and properties of the API:
        • API which takes a key and a new value, where the key points to an old/existing value in the DB
        • The must be two stages: One function to upgrade the value of the key to the new value, in a pre commit fashion. More specifically, this means:
          • If power is lost and and returned to a client that doesn't understand the new value, it must read the old value correctly
          • If power is lost and returned to a client that does understand the new value, it must read the new value and ignore the old one
          • The new value must not be retained in the database after the old value has been read by an old client
            • It may be that this is impossible to implement without support in the old client(s) for wiping stale entries in the database. If so, this is acceptable, we will just have to patch it into old versions. Good if we can avoid it though. To be investigated
        • The second stage is a function which commits the new value and removes the old value completely
        • Each change must be be done in a single ACID compliant transaction
          • This may require extension to our dbstore API, since I think it only has an API for updating single entries right now, and I'm 99% certain we will have to update more than one at a time




            • Assignee:
              a10040 Kristian Amlie
              a10040 Kristian Amlie
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Zendesk Support