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 | 963211 | 1176 4 | 6977 6 | 7339 8 | 638310 | 460012 | 887814 | 1987
(11 rows)
$ psql -p 5501 -U andres postgresid | data
----+------ 3 | 396 5 | 2522 7 | 275 9 | 963211 | 1176 4 | 6977 6 | 7339 8 | 638310 | 460012 | 887814 | 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