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 replication installation after primary key addition #9264

Merged
merged 2 commits into from Jun 20, 2016

Conversation

carbonin
Copy link
Member

In 7656212 a migration added "id" primary keys to some tables that were being replicated. The triggers used in rubyrep replication hardcode the "key" used to retrieve the row that has been changed. In tables without a proper PK these triggers were using multiple columns for this key.

Before this change, a migrated environment would have the same (old) triggers firing on tables that now had a primary key which would write the old key into the pending changes table. This mismatch between what was recorded in the pending changes table and the actual primary key caused an infinate loop / timeout during rubyrep replication.

This fixes the situation by removing the triggers and other replication state information for these tables and allowing them to be rebuilt when replication starts again.

The new triggers will have the new primary key in them and will generate changes that can be properly processed.

https://bugzilla.redhat.com/show_bug.cgi?id=1344456

@carbonin
Copy link
Member Author

@Fryguy please review

@carbonin
Copy link
Member Author

@miq-bot add_label core, replication, bug

@gtanzillo
Copy link
Member

👍 Looks awesome!

@Fryguy
Copy link
Member

Fryguy commented Jun 17, 2016

I'll review shortly.

@chessbyte @gtanzillo Please don't merge / backport until I can verify that we have the darga_migrations.txt stuff all squared away.

Commit 392423a created a spec which would fail if a migration
in the current source tree was at an earlier timestamp than one
that has already been released, leaving us open to an issue where
we could run migrations out of order potentially causing schema
inconsistencies across regions.

The previous method relied on a file to determine which migrations
had been released. When that file was not updated when new
migrations were backported we left ourselves open to a false positive.

This change pulls the migrations from the github api right before
running the spec, ensuring that we have the latest data on backported
migrations.
@carbonin
Copy link
Member Author

So are we holding this until #9278 is in @Fryguy ?

@Fryguy Fryguy changed the title Fix replication installation after primary key addition [Depends on #9278] Fix replication installation after primary key addition Jun 20, 2016
In 7656212 a migration added "id" primary keys to some
tables that were being replicated. The triggers used in
rubyrep replication hardcode the "key" used to retrieve
the row that has been changed. In tables without a proper PK
these triggers were using multiple columns for this key.

Before this change, a migrated environment would have the same (old)
triggers firing on tables that now had a primary key which would
write the old key into the pending changes table. This mismatch
between what was recorded in the pending changes table and the
actual primary key caused an infinate loop / timeout during
rubyrep replication.

This fixes the situation by removing the triggers and other
replication state information for these tables and allowing
them to be rebuilt when replication starts again.

The new triggers will have the new primary key in them and
will generate changes that can be properly processed.

https://bugzilla.redhat.com/show_bug.cgi?id=1344456
@carbonin carbonin force-pushed the fix_rubyrep_for_join_table_pks branch from bcc9410 to b1cb72e Compare June 20, 2016 15:08
@carbonin carbonin closed this Jun 20, 2016
@carbonin carbonin reopened this Jun 20, 2016
@Fryguy Fryguy changed the title [Depends on #9278] Fix replication installation after primary key addition Fix replication installation after primary key addition Jun 20, 2016
@Fryguy
Copy link
Member

Fryguy commented Jun 20, 2016

#9278 is merged, so when this goes green I think we are good.

@miq-bot
Copy link
Member

miq-bot commented Jun 20, 2016

Checked commit carbonin@b1cb72e with ruby 2.2.4, rubocop 0.37.2, and haml-lint 0.16.1
2 files checked, 0 offenses detected
Everything looks good. 🍪

@Fryguy Fryguy merged commit e106575 into ManageIQ:master Jun 20, 2016
@Fryguy Fryguy added this to the Sprint 42 Ending June 20, 2016 milestone Jun 20, 2016
chessbyte pushed a commit that referenced this pull request Jun 20, 2016
Fix replication installation after primary key addition
(cherry picked from commit e106575)
@carbonin carbonin deleted the fix_rubyrep_for_join_table_pks branch July 15, 2016 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants