55use TestLib;
66use Test::More tests => 31;
77
8- my $node_master ;
8+ my $node_primary ;
99my $node_standby ;
1010
11- # Run few queries on both master and standby and check their results match.
11+ # Run few queries on both primary and standby and check their results match.
1212sub test_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 or die " 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- # Initialize master node
43- $node_master = get_new_node(' master ' );
44- $node_master -> init(allows_streaming => 1);
45- $node_master -> start;
42+ # Initialize primary node
43+ $node_primary = get_new_node(' primary ' );
44+ $node_primary -> init(allows_streaming => 1);
45+ $node_primary -> start;
4646my $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 to master
51+ # Create streaming standby linking to primary
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 on master
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 on primary
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.
7070for my $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 " );
0 commit comments