Re: [RFC][PATCH] BDR Prototype startup instructions (not prematurely sent this time)

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC][PATCH] BDR Prototype startup instructions (not prematurely sent this time)
Date: 2012-06-13 18:01:42
Message-ID: 201206132001.42997.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

The patch as of yet doesn't contain how you actually can use the prototype...
Obviously at this point its not very convenient:

I have two config files:
Node 1:
port = 5501
wal_level = logical
max_wal_senders = 10
wal_keep_segments = 200
multimaster_conninfo = 'port=5502 host=/tmp'
multimaster_node_id = 1

Node 2:
port = 5502
wal_level = logical
max_wal_senders = 10
wal_keep_segments = 200
multimaster_conninfo = 'port=5501 host=/tmp'
multimaster_node_id = 2

after initdb'ing the first cluster (initdb required):
$ ~/src/postgresql/build/assert/src/backend/postgres -D
~/tmp/postgres/bdr/1/datadir/ -c
config_file=~/tmp/postgres/bdr/1/postgresql.conf -c
hba_file=~/tmp/postgres/bdr/1/pg_hba.conf -c
ident_file=~/tmp/postgres/bdr/1/pg_ident.conf

$ psql -p 5501 -U andres postgres
CREATE TABLE data(id serial primary key, data bigint);
ALTER SEQUENCE data_id_seq INCREMENT 2;
SELECT setval('data_id_seq', 1);

shutdown cluster

$ rsync -raxv --delete /home/andres/tmp/postgres/bdr/1/datadir/*
/home/andres/tmp/postgres/bdr/2/datadir

start both clusters which should sync after some output.

$ psql -p 5501 -U andres postgres

INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;

$ psql -p 5502 -U andres postgres
SELECT setval('data_id_seq', 2);

INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;
INSERT INTO data(data) VALUES (random()*10000) RETURNING *;

postgres=# SELECT * FROM data;
id | data
----+------
3 | 396
5 | 2522
7 | 275
9 | 9632
11 | 1176
4 | 6977
6 | 7339
8 | 6383
10 | 4600
12 | 8878
14 | 1987
(11 rows)

$ psql -p 5501 -U andres postgres
id | data
----+------
3 | 396
5 | 2522
7 | 275
9 | 9632
11 | 1176
4 | 6977
6 | 7339
8 | 6383
10 | 4600
12 | 8878
14 | 1987
(11 rows)

DELETE FROM data;

$ psql -p 5502 -U andres postgres
SELECT * FROM data;
id | data
----+------
(0 rows)

There is not much more you can do at this time. You can run an unmodified
pgbench if you do it before the rsync if you prohibit vacuum (-n) which
actually does a truncate on the history table.

Hope that helps the brave sould already trying this,

Andres

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-06-13 18:09:19 Re: [COMMITTERS] pgsql: Mark JSON error detail messages for translation.
Previous Message Andres Freund 2012-06-13 17:52:40 Re: [RFC][PATCH] Logical Replication/BDR prototype and architecture