ALTER TABLE to ADD BDR global sequence - Mailing list pgsql-general

From John Casey
Subject ALTER TABLE to ADD BDR global sequence
Date
Msg-id 003801d02773$1025f630$3071e290$@innovisors.com
Whole thread Raw
Responses Re: ALTER TABLE to ADD BDR global sequence  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-general

While attempting to alter a table to add a global sequence as a primary key using the following commands:

 

CREATE SEQUENCE my_table_id_seq USING bdr;

ALTER TABLE my_table

ADD COLUMN id integer PRIMARY KEY NOT NULL DEFAULT nextval('my_table_id_seq'::regclass);

 

I started to notice some issues that concerned me. In order to create the sequence, I had to have the replication running. To alter the table, I had to stop replication. The only way I really knew how to do this was to remove the bdr properties in the postgres configuration file and restart. At that point, I executed the ALTER TABLE code, when it got to 15000 records, Postgres informed me that I needed to turn replication back on so the nodes could agree on additional sequence allocations. When I turned it back on, it just kind-of wigged out.

 

So, how is this supposed to work? In addition, what happens when you have very disparate databases that are both updated often and connected occasionally (which is what we have). Will it quit doing inserts until it is connected to the other databases again? That would be really bad.

pgsql-general by date:

Previous
From: "John Casey"
Date:
Subject: Re: bdr_init_copy fails when starting 2nd BDR node
Next
From: tuanhoanganh
Date:
Subject: Does anyone user pg-pool II on real production ? Please help me.