ALTER TABLE to ADD BDR global sequence

From: "John Casey" <john(dot)casey(at)innovisors(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: ALTER TABLE to ADD BDR global sequence
Date: 2015-01-03 16:33:53
Message-ID: 003801d02773$1025f630$3071e290$@innovisors.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edson Carlos Ericksson Richter 2015-01-03 16:48:24 Replication: How to query current segments allocation relative to "Wal keep segments"?
Previous Message John Casey 2015-01-03 16:14:41 Loading Data Dumps for Tables Containing BDR Global Sequence