Skip to content

Commit 070e12f

Browse files
committed
test with replication
1 parent 85bae39 commit 070e12f

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

commit.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
commit prepared 'x';

prepare.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
begin;
2+
insert into t values (42);
3+
prepare transaction 'x';

reinit.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
pkill -9 postgres
3+
make install
4+
rm -rf install/data
5+
rm -rf install/data_slave
6+
rm -rf /cores/*
7+
8+
9+
# Node master
10+
./install/bin/initdb -D ./install/data
11+
echo "max_prepared_transactions = 100" >> ./install/data/postgresql.conf
12+
echo "shared_buffers = 512MB" >> ./install/data/postgresql.conf
13+
echo "fsync = off" >> ./install/data/postgresql.conf
14+
echo "log_checkpoints = on" >> ./install/data/postgresql.conf
15+
echo "max_wal_size = 48MB" >> ./install/data/postgresql.conf
16+
echo "min_wal_size = 32MB" >> ./install/data/postgresql.conf
17+
echo "wal_level = hot_standby" >> ./install/data/postgresql.conf
18+
echo "wal_keep_segments = 64" >> ./install/data/postgresql.conf
19+
echo "max_wal_senders = 2" >> ./install/data/postgresql.conf
20+
echo "max_replication_slots = 2" >> ./install/data/postgresql.conf
21+
22+
echo '' > ./install/data/logfile
23+
echo 'local replication stas trust' >> ./install/data/pg_hba.conf
24+
25+
./install/bin/pg_ctl -w -D ./install/data -l ./install/data/logfile start
26+
./install/bin/createdb stas
27+
./install/bin/psql -c "create table t(id int);"
28+
29+
./install/bin/pg_basebackup -D ./install/data_slave/ -R
30+
31+
# Node slave
32+
echo "port = 5433" >> ./install/data_slave/postgresql.conf
33+
echo "hot_standby = on" >> ./install/data_slave/postgresql.conf
34+
echo '' > ./install/data_slave/logfile
35+
./install/bin/pg_ctl -w -D ./install/data_slave -l ./install/data_slave/logfile start
36+
37+

0 commit comments

Comments
 (0)