Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit229f8c2

Browse files
committed
tap tests: replace 'master' with 'primary'.
We've largely replaced master with primary in docs etc, but tap teststill widely used master.Author: Andres FreundReviewed-By: David SteeleDiscussion:https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue@alap3.anarazel.de
1 parent2661a79 commit229f8c2

File tree

37 files changed

+777
-777
lines changed

37 files changed

+777
-777
lines changed

‎contrib/bloom/t/001_wal.pl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use TestLib;
66
use Test::Moretests=> 31;
77

8-
my$node_master;
8+
my$node_primary;
99
my$node_standby;
1010

11-
# Run few queries on bothmaster and standby and check their results match.
11+
# Run few queries on bothprimary and standby and check their results match.
1212
subtest_index_replay
1313
{
1414
my ($test_name) =@_;
@@ -17,7 +17,7 @@ sub test_index_replay
1717
my$applname =$node_standby->name;
1818
my$caughtup_query =
1919
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
20-
$node_master->poll_query_until('postgres',$caughtup_query)
20+
$node_primary->poll_query_until('postgres',$caughtup_query)
2121
ordie"Timed out while waiting for standby 1 to catch up";
2222

2323
my$queries =qq(SET enable_seqscan=off;
@@ -32,35 +32,35 @@ sub test_index_replay
3232
);
3333

3434
# Run test queries and compare their result
35-
my$master_result =$node_master->safe_psql("postgres",$queries);
35+
my$primary_result =$node_primary->safe_psql("postgres",$queries);
3636
my$standby_result =$node_standby->safe_psql("postgres",$queries);
3737

38-
is($master_result,$standby_result,"$test_name: query result matches");
38+
is($primary_result,$standby_result,"$test_name: query result matches");
3939
return;
4040
}
4141

42-
# Initializemaster node
43-
$node_master = get_new_node('master');
44-
$node_master->init(allows_streaming=> 1);
45-
$node_master->start;
42+
# Initializeprimary node
43+
$node_primary = get_new_node('primary');
44+
$node_primary->init(allows_streaming=> 1);
45+
$node_primary->start;
4646
my$backup_name ='my_backup';
4747

4848
# Take backup
49-
$node_master->backup($backup_name);
49+
$node_primary->backup($backup_name);
5050

51-
# Create streaming standby linking tomaster
51+
# Create streaming standby linking toprimary
5252
$node_standby = get_new_node('standby');
53-
$node_standby->init_from_backup($node_master,$backup_name,
53+
$node_standby->init_from_backup($node_primary,$backup_name,
5454
has_streaming=> 1);
5555
$node_standby->start;
5656

57-
# Create some bloom index onmaster
58-
$node_master->safe_psql("postgres","CREATE EXTENSION bloom;");
59-
$node_master->safe_psql("postgres","CREATE TABLE tst (i int4, t text);");
60-
$node_master->safe_psql("postgres",
57+
# Create some bloom index onprimary
58+
$node_primary->safe_psql("postgres","CREATE EXTENSION bloom;");
59+
$node_primary->safe_psql("postgres","CREATE TABLE tst (i int4, t text);");
60+
$node_primary->safe_psql("postgres",
6161
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;"
6262
);
63-
$node_master->safe_psql("postgres",
63+
$node_primary->safe_psql("postgres",
6464
"CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);");
6565

6666
# Test that queries give same result
@@ -69,12 +69,12 @@ sub test_index_replay
6969
# Run 10 cycles of table modification. Run test queries after each modification.
7070
formy$i (1 .. 10)
7171
{
72-
$node_master->safe_psql("postgres","DELETE FROM tst WHERE i =$i;");
72+
$node_primary->safe_psql("postgres","DELETE FROM tst WHERE i =$i;");
7373
test_index_replay("delete$i");
74-
$node_master->safe_psql("postgres","VACUUM tst;");
74+
$node_primary->safe_psql("postgres","VACUUM tst;");
7575
test_index_replay("vacuum$i");
7676
my ($start,$end) = (100001 + ($i - 1) * 10000, 100000 +$i * 10000);
77-
$node_master->safe_psql("postgres",
77+
$node_primary->safe_psql("postgres",
7878
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;"
7979
);
8080
test_index_replay("insert$i");

‎src/bin/pg_rewind/t/001_basic.pl

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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 inmaster.
19-
master_psql("CREATE TABLE tbl1 (d text)");
20-
master_psql("INSERT INTO tbl1 VALUES ('inmaster')");
18+
# Create a test table and insert a row inprimary.
19+
primary_psql("CREATE TABLE tbl1 (d text)");
20+
primary_psql("INSERT INTO tbl1 VALUES ('inprimary')");
2121

2222
# This test table will be used to test truncation, i.e. the table
23-
# is extended in the oldmaster after promotion
24-
master_psql("CREATE TABLE trunc_tbl (d text)");
25-
master_psql("INSERT INTO trunc_tbl VALUES ('inmaster')");
23+
# is extended in the oldprimary after promotion
24+
primary_psql("CREATE TABLE trunc_tbl (d text)");
25+
primary_psql("INSERT INTO trunc_tbl VALUES ('inprimary')");
2626

2727
# This test table will be used to test the "copy-tail" case, i.e. the
28-
# table is truncated in the oldmaster after promotion
29-
master_psql("CREATE TABLE tail_tbl (id integer, d text)");
30-
master_psql("INSERT INTO tail_tbl VALUES (0, 'inmaster')");
28+
# table is truncated in the oldprimary after promotion
29+
primary_psql("CREATE TABLE tail_tbl (id integer, d text)");
30+
primary_psql("INSERT INTO tail_tbl VALUES (0, 'inprimary')");
3131

32-
master_psql("CHECKPOINT");
32+
primary_psql("CHECKPOINT");
3333

3434
RewindTest::create_standby($test_mode);
3535

36-
# Insert additional data onmaster that will be replicated to standby
37-
master_psql("INSERT INTO tbl1 values ('inmaster, before promotion')");
38-
master_psql(
39-
"INSERT INTO trunc_tbl values ('inmaster, before promotion')");
40-
master_psql(
41-
"INSERT INTO tail_tbl SELECT g, 'inmaster, before promotion: ' || g FROM generate_series(1, 10000) g"
36+
# Insert additional data onprimary that will be replicated to standby
37+
primary_psql("INSERT INTO tbl1 values ('inprimary, before promotion')");
38+
primary_psql(
39+
"INSERT INTO trunc_tbl values ('inprimary, before promotion')");
40+
primary_psql(
41+
"INSERT INTO tail_tbl SELECT g, 'inprimary, 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 oldmaster. This causes themaster and standby
48+
# Insert a row in the oldprimary. This causes theprimary and standby
4949
# to have "diverged", it's no longer possible to just apply the
50-
# standy's logs overmaster directory - you need to rewind.
51-
master_psql("INSERT INTO tbl1 VALUES ('inmaster, after promotion')");
50+
# standy's logs overprimary directory - you need to rewind.
51+
primary_psql("INSERT INTO tbl1 VALUES ('inprimary, after promotion')");
5252

5353
# Also insert a new row in the standby, which won't be present in the
54-
# oldmaster.
54+
# oldprimary.
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 'inmaster, after promotion: ' || g FROM generate_series(1, 10000) g"
59+
primary_psql(
60+
"INSERT INTO trunc_tbl SELECT 'inprimary, 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_modeeq'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(inmaster
139-
inmaster, before promotion
138+
qq(inprimary
139+
inprimary, before promotion
140140
in standby, after promotion
141141
),
142142
'table content');
143143

144144
check_query(
145145
'SELECT * FROM trunc_tbl',
146-
qq(inmaster
147-
inmaster, before promotion
146+
qq(inprimary
147+
inprimary, 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

‎src/bin/pg_rewind/t/002_databases.pl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ sub run_test
1313
my$test_mode =shift;
1414

1515
RewindTest::setup_cluster($test_mode, ['-g']);
16-
RewindTest::start_master();
16+
RewindTest::start_primary();
1717

18-
# Create a database inmaster with a table.
19-
master_psql('CREATE DATABASEinmaster');
20-
master_psql('CREATE TABLEinmaster_tab (a int)','inmaster');
18+
# Create a database inprimary with a table.
19+
primary_psql('CREATE DATABASEinprimary');
20+
primary_psql('CREATE TABLEinprimary_tab (a int)','inprimary');
2121

2222
RewindTest::create_standby($test_mode);
2323

2424
# Create another database with another table, the creation is
2525
# replicated to the standby.
26-
master_psql('CREATE DATABASE beforepromotion');
27-
master_psql('CREATE TABLE beforepromotion_tab (a int)',
26+
primary_psql('CREATE DATABASE beforepromotion');
27+
primary_psql('CREATE TABLE beforepromotion_tab (a int)',
2828
'beforepromotion');
2929

3030
RewindTest::promote_standby();
3131

32-
# Create databases in the oldmaster and the new promoted standby.
33-
master_psql('CREATE DATABASEmaster_afterpromotion');
34-
master_psql('CREATE TABLEmaster_promotion_tab (a int)',
35-
'master_afterpromotion');
32+
# Create databases in the oldprimary and the new promoted standby.
33+
primary_psql('CREATE DATABASEprimary_afterpromotion');
34+
primary_psql('CREATE TABLEprimary_promotion_tab (a int)',
35+
'primary_afterpromotion');
3636
standby_psql('CREATE DATABASE standby_afterpromotion');
3737
standby_psql('CREATE TABLE standby_promotion_tab (a int)',
3838
'standby_afterpromotion');
@@ -45,7 +45,7 @@ sub run_test
4545
check_query(
4646
'SELECT datname FROM pg_database ORDER BY 1',
4747
qq(beforepromotion
48-
inmaster
48+
inprimary
4949
postgres
5050
standby_afterpromotion
5151
template0
@@ -59,7 +59,7 @@ sub run_test
5959
skip"unix-style permissions not supported on Windows", 1
6060
if ($windows_os);
6161

62-
ok(check_mode_recursive($node_master->data_dir(), 0750, 0640),
62+
ok(check_mode_recursive($node_primary->data_dir(), 0750, 0640),
6363
'check PGDATA permissions');
6464
}
6565

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp