Skip to content

Commit f00d19b

Browse files
committed
code cleanup; some fixes and corner cases
1 parent 1cf2718 commit f00d19b

File tree

3 files changed

+185
-64
lines changed

3 files changed

+185
-64
lines changed

reinit.sh

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ reinit_master() {
77

88
echo "max_prepared_transactions = 100" >> ./install/data/postgresql.conf
99
echo "shared_buffers = 512MB" >> ./install/data/postgresql.conf
10-
echo "fsync = off" >> ./install/data/postgresql.conf
10+
# echo "fsync = on" >> ./install/data/postgresql.conf
1111
echo "log_checkpoints = on" >> ./install/data/postgresql.conf
1212
echo "max_wal_size = 48MB" >> ./install/data/postgresql.conf
1313
echo "min_wal_size = 32MB" >> ./install/data/postgresql.conf
@@ -16,11 +16,11 @@ reinit_master() {
1616
echo "max_wal_senders = 2" >> ./install/data/postgresql.conf
1717
echo "max_replication_slots = 2" >> ./install/data/postgresql.conf
1818

19-
echo '' > ./install/data/logfile
19+
echo '---- test ----' >> ./install/logfile
2020

2121
echo 'local replication stas trust' >> ./install/data/pg_hba.conf
2222

23-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile start
23+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile start
2424
./install/bin/createdb stas
2525
./install/bin/psql -c "create table t(id int);"
2626
}
@@ -33,12 +33,14 @@ reinit_slave() {
3333
echo "port = 5433" >> ./install/data_slave/postgresql.conf
3434
echo "hot_standby = on" >> ./install/data_slave/postgresql.conf
3535

36-
echo '' > ./install/data_slave/logfile
36+
echo '---- test ----' >> ./install/slave_logfile
3737

38-
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/data_slave/logfile start
38+
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/slave_logfile start
3939
}
4040

4141
make install > /dev/null
42+
echo > ./install/logfile
43+
echo > ./install/slave_logfile
4244

4345

4446
cat <<MSG
@@ -59,7 +61,7 @@ psql <<SQL
5961
insert into t values (43);
6062
prepare transaction 'y';
6163
SQL
62-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile restart
64+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile restart
6365
psql <<SQL
6466
commit prepared 'x';
6567
rollback prepared 'y';
@@ -78,15 +80,19 @@ MSG
7880
pkill -9 postgres
7981
reinit_master >> /dev/null
8082
psql <<SQL
83+
checkpoint;
84+
select * from pg_current_xlog_location();
8185
begin;
8286
insert into t values (42);
8387
prepare transaction 'x';
88+
select * from pg_current_xlog_location();
8489
begin;
8590
insert into t values (43);
8691
prepare transaction 'y';
8792
SQL
8893
pkill -9 postgres
89-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile start
94+
echo '--- kill -9 ---' >> ./install/logfile
95+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile start
9096
psql <<SQL
9197
commit prepared 'x';
9298
rollback prepared 'y';
@@ -105,11 +111,13 @@ reinit_master >> /dev/null
105111
psql <<SQL
106112
begin;
107113
insert into t values (42);
114+
savepoint s;
115+
insert into t values (43);
108116
prepare transaction 'x';
109117
commit prepared 'x';
110118
SQL
111119
pkill -9 postgres
112-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile start
120+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile start
113121
psql <<SQL
114122
begin;
115123
insert into t values (42);
@@ -206,8 +214,8 @@ psql <<SQL
206214
prepare transaction 'x';
207215
insert into t values (100);
208216
SQL
209-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile stop
210-
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/data_slave/logfile restart
217+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile stop
218+
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/slave_logfile restart
211219
echo "Following list should contain transaction 'x':"
212220
psql -p5433 <<SQL
213221
select * from pg_prepared_xacts;
@@ -232,9 +240,9 @@ psql <<SQL
232240
prepare transaction 'x';
233241
insert into t values (100);
234242
SQL
235-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile stop
243+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile stop
236244
kill -9 `cat install/data_slave/postmaster.pid | head -n 1`
237-
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/data_slave/logfile start
245+
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/slave_logfile start
238246
echo "Following list should contain transaction 'x':"
239247
psql -p5433 <<SQL
240248
select * from pg_prepared_xacts;
@@ -259,9 +267,21 @@ psql <<SQL
259267
prepare transaction 'x';
260268
SQL
261269
pkill -9 postgres
262-
./install/bin/pg_ctl -sw -D ./install/data -l ./install/data/logfile start
270+
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile start
263271
psql <<SQL
264272
commit prepared 'x';
265273
SQL
266274

267275

276+
277+
# check for prescan with pgbench
278+
279+
280+
281+
282+
283+
284+
285+
286+
287+

0 commit comments

Comments
 (0)