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

migrator: allow removing settings in migrations #644

Merged
merged 4 commits into from
Feb 1, 2020

Commits on Feb 1, 2020

  1. migrator: allow removing settings in migrations

    Migrations weren't able to remove settings because we started with a copy of
    the existing data store and wrote out any changes key-by-key, meaning a
    "removal" would just leave the old copied key in place on disk.
    
    With this change, we no longer copy the data store, we instead give migrations
    the source data store and the target data store, and (via migration-helpers)
    the input data is read from the source instead of a copy.  This is more
    efficient because it avoids a needless copy, and allows the migration to
    determine exactly what's left after it runs.
    tjkirch committed Feb 1, 2020
    Configuration menu
    Copy the full SHA
    94ceef1 View commit details
    Browse the repository at this point in the history
  2. apiserver: make MemoryDataStore public

    This allows for DataStore-based testing in other crates.
    tjkirch committed Feb 1, 2020
    Configuration menu
    Copy the full SHA
    0753901 View commit details
    Browse the repository at this point in the history
  3. apiserver: add DataStore methods to unset keys and metadata

    We've gotten by without this because settings are effectively all required, but
    there are now some advanced cases (migrator interface change) that require
    removing keys from an existing data store.  This probably shouldn't be exposed
    in a higher-level API, though, unless we account for optional settings.
    tjkirch committed Feb 1, 2020
    Configuration menu
    Copy the full SHA
    918b815 View commit details
    Browse the repository at this point in the history
  4. migration-helpers: back-compat: remove datastore keys removed in migr…

    …ation
    
    The old migrator interface used a single data store as source and target.
    After a migration changes the MigrationData, the resulting values are written
    out to the data store.  Since this data store also served as the source, it had
    all of the old keys on disk already, and nothing explicitly removed them; we'd
    only see new keys overwrite old.
    
    To allow downgrading to versions with the old migrator interface, we need
    migrations to explicitly remove keys from the data store.  This change to
    migration-helpers detects keys that were removed from MigrationData by a
    migration and tells the data store to explicitly remove them.  As long as
    migrations are rebuilt against this library, they'll work in the old or new
    migrator.
    
    This workaround can be removed when we no longer support versions with the old
    migrator interface.
    tjkirch committed Feb 1, 2020
    Configuration menu
    Copy the full SHA
    4fed84a View commit details
    Browse the repository at this point in the history