-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Test disabling, dropping, and recreating subscriptions for RDS upgrade #2766
Comments
Set up the replication chainThe first step is to set up three postgresql docker images on port 5432, 5433, and 5434. These will be known by their port numbers, and data will flow from lowest to highest. In other words, 5432 will publish to 5433, and 5433 will publish to 5434. Do this across three terminals:
Then log into the three databases:
Then create the DB in each and connect to it:
Then create a user on all three...
...and grant them permissions:
Create a publication on 5432 and 5433 with:
Then finally subscribe to 5433 and 5432 from 5434 and 5433 respectively. To get the correct host IPs of the containers, use
And:
|
Run the testRun this while pointing it to the 5432 server:
Then check counts in If that works, your replication is up and running! |
Now, get real and test dropping/disabling/creating subscriptionsMake sure that you're adding data:
Disable the prod (5432) to replica (5433) subscription. From 5433:
Check that the data has flushed to 5434 (
Drop subscriptions on 5434 servers:
Check slots on 5433:
Great! Upgrade 5433 in RDS (not part of this test). Then re-create the subscriptions to 5433 from 5434:
Check slots on 5433 as above. Finally, re-enable the subscription from 5432 to 5433:
Stop adding data with CTRL+C on the watch command, then check that all rows have the same count on all three servers:
That's it! if the count is the same, the test is successful. This looks like it works perfectly. |
Note that this worked well, EXCEPT for one very huge problem. I haven' confirmed this yet, but it appears that when you upgrade a database using This means that when you restart the subscription, it's going to try to copy everything, with disastrous results. The fix is that instead of (dis/en)abling the subscription, you DROP it at the outset, and then create a new one after, with I asked for more info about this here: https://www.postgresql.org/message-id/CAMp9%3DEzf9OyuQaQUZDHEauTp-Dn_pPdS6xNmcFJHuQM_qsmZvQ%40mail.gmail.com |
As part of #2745, I need to recreate our replication chain and test the process to make sure it works before doing it on our clients. Following the approach in #1115, I'll give this a shot and put notes here.
The text was updated successfully, but these errors were encountered: