Skip to content

Save schema version on downgrade, add test to verify #2153

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

Merged
merged 2 commits into from
Dec 6, 2018

Conversation

gsoltis
Copy link

@gsoltis gsoltis commented Dec 5, 2018

Due to the nature of leveldb, our existing migrations are idempotent already. As with other platforms, this is not a guarantee that they will always be, but in general the issue is largely the same as with migrating protobufs.

// detect it when we go to upgrade again, allowing us to rerun the
// data migrations.
if (from_version > to_version) {
LevelDbTransaction transaction(db, "Save downgrade version");
Copy link
Contributor

Choose a reason for hiding this comment

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

Under the former transaction arrangement we could have used a single transaction to read the version and write the downgrade version. Is it worth trying to conserve transaction creation?

Normally I don't think this would matter, but we do these on every startup, and even though we're not blocking the main thread, these still contribute to the latency to first query.

Note that we can preserve the nice change to the tests by adding a local override in the tests that instantiates the transaction and then reads using the production code that doesn't.

Copy link
Author

Choose a reason for hiding this comment

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

We could have, but we never did, and probably wouldn't. Some migrations run iteratively and commit periodically, so we don't run them all in a single transaction.

@gsoltis gsoltis assigned wilhuff and unassigned gsoltis Dec 6, 2018
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

@wilhuff wilhuff assigned gsoltis and unassigned wilhuff Dec 6, 2018
@gsoltis gsoltis merged commit 2c9f881 into master Dec 6, 2018
@gsoltis gsoltis deleted the gsoltis/save_schema_version branch December 6, 2018 05:48
bstpierr added a commit that referenced this pull request Dec 6, 2018
* master: (26 commits)
  Functions Interop (#2113)
  Add a travis cron job for CocoaPod symbol collision testing (#2154)
  Save schema version on downgrade, add test to verify (#2153)
  Silence Storage Unit Test `nil` warning. (#2150)
  Update versions for Release 5.14.0 (#2145)
  gRPC: fix cases where gRPC call could be finished twice (#2146)
  Fix Swizzler test warnings (#2144)
  Update Auth CHANGELOG.md (#2128)
  Make fuzz tests optional until they pass (#2143)
  Add support of Game Center sign in (#2127)
  Add test for deprecated FDLURLComponents init API. (#2133)
  fix a typo in integration test (#2131)
  Make fuzzing less verbose to avoid exceeding Travis log limit (#2126)
  Move to `domainURIPrefix` for FIRDynamicLinkComponents (#2119)
  Carthage instructions for new gRPCCertificates.bundle location (#2132)
  Fix pod lib lint GoogleUtilities.podspec --use-libraries regression (#2130)
  Avoid using default FIROptions directly. (#2124)
  Changelog entry for LRU GC (#2122)
  Revert "Add Firebase Source to Header Search Path" (#2123)
  Custom fdl domain (#2121)
  ...
@firebase firebase locked and limited conversation to collaborators Oct 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants