Re: Errors with schema migration and logical replication — expected?

From: Mike Lissner <mlissner(at)michaeljaylissner(dot)com>
To: adrian(dot)klaver(at)aklaver(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Errors with schema migration and logical replication — expected?
Date: 2018-12-12 08:15:08
Message-ID: CAMp9=EzR8SXPWRSYSkh2e3FUdaKJB_BzevtzByZG9Qx_36Jm9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 11, 2018 at 3:10 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

>
> > Well, I was able to fix this by briefly allowing nulls on the
> > subscriber, letting it catch up with the publisher, setting all
> > nulls to empty strings (a Django convention), and then disallowing
> > nulls again. After letting it catch up, there were 118 nulls on the
> > subscriber in this column:
>
> So recap_sequence_number is not actually a number, it is a code?
>

It has sequential values, but they're not necessarily numbers.

>
> >
> > I appreciate all the responses. I'm scared to say so, but I think
> > this is a bug in logical replication. Somehow a null value appeared
> > at the subscriber that was never in the publisher.
> >
> > I also still have this question/suggestion from my first email:
> >
> > > Is the process for schema migrations documented somewhere beyond
> > the above?
>
> Not that I know of. It might help, if possible, to detail the steps in
> the migration. Also what program you used to do it. Given that is Django
> I am assuming some combination of migrate, makemigrations and/or
> sqlmigrate.
>

Pretty simple/standard, I think:
- Changed the code.
- Generated the migration using manage.py makemigration
- Generated the SQL using sqlmigrate
- Ran the migration using manage.py migrate on the master and using psql
on the replica

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oygun Josef 2018-12-12 09:37:30 Idle connections / sessions
Previous Message Srinivas 2018-12-12 06:38:26 Stack Builder for pgAgent on Production