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

fix(db) ensure we reach schema consensus while bootstrapping #4233

Merged
merged 2 commits into from
Jan 28, 2019

Conversation

thibaultcha
Copy link
Member

@thibaultcha thibaultcha commented Jan 23, 2019

When bootstrapping, both up and teardown phases of each migration
execute subsequently. If the teardown step executed DML statements,
such statements can span all peers (due to replication factors). If the
replica peers have not yet reached consensus for their schema, they will
provoke errors and make the bootstrapping fail.

This change ensures that we wait for schema consensus when:

  • before running teardown if up was just ran
  • after running teardown if up was not just ran (see comment as
    for why)
  • after running all migrations that were to be run, if executing
    run_up only

From another perspective:

  • run_up == true: wait for consensus at the very end (after executing
    all up steps)
  • run_teardown == true: wait for consensus after each teardown step
  • run_up == true and run_teardown == true: wait for consensus before
    each teardown step, and once at the very end (after all up and
    teardown steps)

Fix #4229

When bootstrapping, both `up` and `teardown` phases of each migration
execute subsequently. If the `teardown` step executed DML statements,
such statements can span all peers (due to replication factors). If the
replica peers have not yet reached consensus for their schema, they will
provoke errors and make the bootstrapping fail.

This change ensures that we wait for schema consensus when:

* before running `teardown` if `up` was just ran
* after running `teardown` if `up` was _not_ just ran (see comment as
  for why)
* after running all migrations that were to be run, if executing
  `run_up` only

From another perspective:

* `run_up == true`: wait for consensus at the very end (after executing
  all up steps)
* `run_teardown == true`: wait for consensus after each teardown step
* `run_up == true and run_teardown == true`: wait for consensus before
  each `teardown` step, and once at the very end (after all up and
  teardown steps)

Fix #4229
Drop `post_run_up_migrations` and `post_run_teardown_migrations` in
favor of a single `wait_for_schema_consensus`, since no distinction are
really made between `up` and `teardown` post-steps of migrations
anymore.
@thibaultcha thibaultcha force-pushed the fix/schema-consensus-before-teardown branch from 44c1d99 to 80bdc0c Compare January 24, 2019 18:48
@thibaultcha thibaultcha added this to the 1.0.3 milestone Jan 24, 2019
@thibaultcha thibaultcha merged commit f87a82f into master Jan 28, 2019
@thibaultcha thibaultcha deleted the fix/schema-consensus-before-teardown branch January 28, 2019 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant