@@ -13,66 +13,66 @@ sub run_test
1313 my $test_mode = shift ;
1414
1515 RewindTest::setup_cluster($test_mode );
16- RewindTest::start_master ();
16+ RewindTest::start_primary ();
1717
18- # Create a test table and insert a row in master .
19- master_psql (" CREATE TABLE tbl1 (d text)" );
20- master_psql (" INSERT INTO tbl1 VALUES ('in master ')" );
18+ # Create a test table and insert a row in primary .
19+ primary_psql (" CREATE TABLE tbl1 (d text)" );
20+ primary_psql (" INSERT INTO tbl1 VALUES ('in primary ')" );
2121
2222 # This test table will be used to test truncation, i.e. the table
23- # is extended in the old master after promotion
24- master_psql (" CREATE TABLE trunc_tbl (d text)" );
25- master_psql (" INSERT INTO trunc_tbl VALUES ('in master ')" );
23+ # is extended in the old primary after promotion
24+ primary_psql (" CREATE TABLE trunc_tbl (d text)" );
25+ primary_psql (" INSERT INTO trunc_tbl VALUES ('in primary ')" );
2626
2727 # This test table will be used to test the "copy-tail" case, i.e. the
28- # table is truncated in the old master after promotion
29- master_psql (" CREATE TABLE tail_tbl (id integer, d text)" );
30- master_psql (" INSERT INTO tail_tbl VALUES (0, 'in master ')" );
28+ # table is truncated in the old primary after promotion
29+ primary_psql (" CREATE TABLE tail_tbl (id integer, d text)" );
30+ primary_psql (" INSERT INTO tail_tbl VALUES (0, 'in primary ')" );
3131
32- master_psql (" CHECKPOINT" );
32+ primary_psql (" CHECKPOINT" );
3333
3434 RewindTest::create_standby($test_mode );
3535
36- # Insert additional data on master that will be replicated to standby
37- master_psql (" INSERT INTO tbl1 values ('in master , before promotion')" );
38- master_psql (
39- " INSERT INTO trunc_tbl values ('in master , before promotion')" );
40- master_psql (
41- " INSERT INTO tail_tbl SELECT g, 'in master , before promotion: ' || g FROM generate_series(1, 10000) g"
36+ # Insert additional data on primary that will be replicated to standby
37+ primary_psql (" INSERT INTO tbl1 values ('in primary , before promotion')" );
38+ primary_psql (
39+ " INSERT INTO trunc_tbl values ('in primary , before promotion')" );
40+ primary_psql (
41+ " INSERT INTO tail_tbl SELECT g, 'in primary , before promotion: ' || g FROM generate_series(1, 10000) g"
4242 );
4343
44- master_psql (' CHECKPOINT' );
44+ primary_psql (' CHECKPOINT' );
4545
4646 RewindTest::promote_standby();
4747
48- # Insert a row in the old master . This causes the master and standby
48+ # Insert a row in the old primary . This causes the primary and standby
4949 # to have "diverged", it's no longer possible to just apply the
50- # standy's logs over master directory - you need to rewind.
51- master_psql (" INSERT INTO tbl1 VALUES ('in master , after promotion')" );
50+ # standy's logs over primary directory - you need to rewind.
51+ primary_psql (" INSERT INTO tbl1 VALUES ('in primary , after promotion')" );
5252
5353 # Also insert a new row in the standby, which won't be present in the
54- # old master .
54+ # old primary .
5555 standby_psql(" INSERT INTO tbl1 VALUES ('in standby, after promotion')" );
5656
5757 # Insert enough rows to trunc_tbl to extend the file. pg_rewind should
5858 # truncate it back to the old size.
59- master_psql (
60- " INSERT INTO trunc_tbl SELECT 'in master , after promotion: ' || g FROM generate_series(1, 10000) g"
59+ primary_psql (
60+ " INSERT INTO trunc_tbl SELECT 'in primary , after promotion: ' || g FROM generate_series(1, 10000) g"
6161 );
6262
6363 # Truncate tail_tbl. pg_rewind should copy back the truncated part
6464 # (We cannot use an actual TRUNCATE command here, as that creates a
6565 # whole new relfilenode)
66- master_psql (" DELETE FROM tail_tbl WHERE id > 10" );
67- master_psql (" VACUUM tail_tbl" );
66+ primary_psql (" DELETE FROM tail_tbl WHERE id > 10" );
67+ primary_psql (" VACUUM tail_tbl" );
6868
6969 # Before running pg_rewind, do a couple of extra tests with several
7070 # option combinations. As the code paths taken by those tests
7171 # do not change for the "local" and "remote" modes, just run them
7272 # in "local" mode for simplicity's sake.
7373 if ($test_mode eq ' local' )
7474 {
75- my $master_pgdata = $node_master -> data_dir;
75+ my $primary_pgdata = $node_primary -> data_dir;
7676 my $standby_pgdata = $node_standby -> data_dir;
7777
7878 # First check that pg_rewind fails if the target cluster is
@@ -82,7 +82,7 @@ sub run_test
8282 [
8383 ' pg_rewind' , ' --debug' ,
8484 ' --source-pgdata' , $standby_pgdata ,
85- ' --target-pgdata' , $master_pgdata ,
85+ ' --target-pgdata' , $primary_pgdata ,
8686 ' --no-sync'
8787 ],
8888 ' pg_rewind with running target' );
@@ -94,20 +94,20 @@ sub run_test
9494 [
9595 ' pg_rewind' , ' --debug' ,
9696 ' --source-pgdata' , $standby_pgdata ,
97- ' --target-pgdata' , $master_pgdata ,
97+ ' --target-pgdata' , $primary_pgdata ,
9898 ' --no-sync' , ' --no-ensure-shutdown'
9999 ],
100100 ' pg_rewind --no-ensure-shutdown with running target' );
101101
102102 # Stop the target, and attempt to run with a local source
103103 # still running. This fails as pg_rewind requires to have
104104 # a source cleanly stopped.
105- $node_master -> stop;
105+ $node_primary -> stop;
106106 command_fails(
107107 [
108108 ' pg_rewind' , ' --debug' ,
109109 ' --source-pgdata' , $standby_pgdata ,
110- ' --target-pgdata' , $master_pgdata ,
110+ ' --target-pgdata' , $primary_pgdata ,
111111 ' --no-sync' , ' --no-ensure-shutdown'
112112 ],
113113 ' pg_rewind with unexpected running source' );
@@ -121,30 +121,30 @@ sub run_test
121121 [
122122 ' pg_rewind' , ' --debug' ,
123123 ' --source-pgdata' , $standby_pgdata ,
124- ' --target-pgdata' , $master_pgdata ,
124+ ' --target-pgdata' , $primary_pgdata ,
125125 ' --no-sync' , ' --dry-run'
126126 ],
127127 ' pg_rewind --dry-run' );
128128
129129 # Both clusters need to be alive moving forward.
130130 $node_standby -> start;
131- $node_master -> start;
131+ $node_primary -> start;
132132 }
133133
134134 RewindTest::run_pg_rewind($test_mode );
135135
136136 check_query(
137137 ' SELECT * FROM tbl1' ,
138- qq( in master
139- in master , before promotion
138+ qq( in primary
139+ in primary , before promotion
140140in standby, after promotion
141141) ,
142142 ' table content' );
143143
144144 check_query(
145145 ' SELECT * FROM trunc_tbl' ,
146- qq( in master
147- in master , before promotion
146+ qq( in primary
147+ in primary , before promotion
148148) ,
149149 ' truncation' );
150150
@@ -160,7 +160,7 @@ sub run_test
160160 skip " unix-style permissions not supported on Windows" , 1
161161 if ($windows_os );
162162
163- ok(check_mode_recursive($node_master -> data_dir(), 0700, 0600),
163+ ok(check_mode_recursive($node_primary -> data_dir(), 0700, 0600),
164164 ' check PGDATA permissions' );
165165 }
166166
0 commit comments