-
-
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
Do replication test of foreign keys in new tables #977
Comments
As you might expect, the hardest part of this is the networking. My original idea, above, was to use an RDS instance as a subscriber and to have my laptop as the publisher. Of course, that only works if I properly forward ports from my router, which is theoretically possible, but I run enterprise-grade routers in my house, and frankly, while they work wonderfully and I love them, forwarding a port is surprisingly difficult. So that was out. There's an easier way, anyway: Docker, and what do you know, there's even a postgresql image. So, to get this set up, I launched one docker image on port 5432 (the publisher) and another on 5433 (the subscriber). A couple tricks here:
From there, it's just a matter of running the right SQL commands from issue #932, and running the test. |
Good news: This works fine. First, I created this model and got it replicating from one container to the other: class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published') Then, to confirm functionality, I created a couple items via the admin portal and checked that they got replicated. They did (instantly). Then I made this model: class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0) And migrated it using
Seems like all is good here. Tearing things down and proceeding with real work. |
Here's a question. Say we have a table we're replicating. Then we add another table that FKs to the first one, but we don't migrate the schema of the new table to the destination server.
Does replication break? This issue is to find out.
I think the procedure will be:
Set up:
Test:
Hypothesis:
Measurement:
Hopefully this won't take too long. I need to know what happens in this instance because I am about to add "Claims Registers" for bankruptcy proceedings in PACER. They will FK into the
search_docket
table, which is one of our replicated tables. If we can avoid having to talk to all our replicated customers immediately to get them this table...that'd be good.The text was updated successfully, but these errors were encountered: