@@ -7,7 +7,7 @@ reinit_master() {
7
7
8
8
echo " max_prepared_transactions = 100" >> ./install/data/postgresql.conf
9
9
echo " shared_buffers = 512MB" >> ./install/data/postgresql.conf
10
- # echo "fsync = on " >> ./install/data/postgresql.conf
10
+ # echo "fsync = off " >> ./install/data/postgresql.conf
11
11
echo " log_checkpoints = on" >> ./install/data/postgresql.conf
12
12
echo " max_wal_size = 48MB" >> ./install/data/postgresql.conf
13
13
echo " min_wal_size = 32MB" >> ./install/data/postgresql.conf
@@ -21,8 +21,6 @@ reinit_master() {
21
21
echo ' local replication stas trust' >> ./install/data/pg_hba.conf
22
22
23
23
./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile start
24
- ./install/bin/createdb stas
25
- ./install/bin/psql -c " create table t(id int);"
26
24
}
27
25
28
26
reinit_slave () {
@@ -36,6 +34,15 @@ reinit_slave() {
36
34
echo ' ---- test ----' >> ./install/slave_logfile
37
35
38
36
./install/bin/pg_ctl -sw -D ./install/data_slave -l ./install/slave_logfile start
37
+
38
+
39
+ echo " synchronous_standby_names = '*'" >> ./install/data/postgresql.conf
40
+ ./install/bin/pg_ctl -sw -D ./install/data -l ./install/logfile restart
41
+ }
42
+
43
+ postinit (){
44
+ ./install/bin/createdb stas
45
+ ./install/bin/psql -c " create table t(id int);"
39
46
}
40
47
41
48
make install > /dev/null
53
60
54
61
pkill -9 postgres
55
62
reinit_master >> /dev/null
63
+ postinit >> /dev/null
56
64
psql << SQL
57
65
begin;
58
66
insert into t values (42);
79
87
80
88
pkill -9 postgres
81
89
reinit_master >> /dev/null
90
+ postinit >> /dev/null
82
91
psql << SQL
83
92
checkpoint;
84
93
select * from pg_current_xlog_location();
108
117
109
118
pkill -9 postgres
110
119
reinit_master >> /dev/null
120
+ postinit >> /dev/null
111
121
psql << SQL
112
122
begin;
113
123
insert into t values (42);
139
149
pkill -9 postgres
140
150
reinit_master >> /dev/null
141
151
reinit_slave >> /dev/null
152
+ postinit >> /dev/null
142
153
psql << SQL
143
154
begin;
144
155
insert into t values (42);
159
170
pkill -9 postgres
160
171
reinit_master >> /dev/null
161
172
reinit_slave >> /dev/null
173
+ postinit >> /dev/null
162
174
psql << SQL
163
175
begin;
164
176
insert into t values (42);
@@ -182,11 +194,15 @@ MSG
182
194
183
195
pkill -9 postgres
184
196
reinit_master >> /dev/null
197
+ echo " master init"
185
198
reinit_slave >> /dev/null
199
+ echo " slave init"
200
+ postinit >> /dev/null
186
201
psql << SQL
187
202
begin;
188
203
insert into t values (42);
189
204
prepare transaction 'x';
205
+ --select * from pg_current_xlog_location();
190
206
SQL
191
207
kill -9 ` cat install/data/postmaster.pid | head -n 1`
192
208
./install/bin/pg_ctl promote -D ./install/data_slave
206
222
pkill -9 postgres
207
223
reinit_master >> /dev/null
208
224
reinit_slave >> /dev/null
225
+ postinit >> /dev/null
209
226
psql << SQL
210
227
begin;
211
228
insert into t values (42);
232
249
pkill -9 postgres
233
250
reinit_master >> /dev/null
234
251
reinit_slave >> /dev/null
252
+ postinit >> /dev/null
235
253
psql << SQL
236
254
begin;
237
255
insert into t values (42);
257
275
258
276
pkill -9 postgres
259
277
reinit_master >> /dev/null
278
+ postinit >> /dev/null
260
279
psql << SQL
261
280
begin;
262
281
insert into t values (42);
0 commit comments