is($node_standby_1->psql('postgres',qq[SELECT pg_create_physical_replication_slot('$slotname_2');]),0,'physical slot created on intermediate replica');
my$stdout_sql=$node_master->safe_psql('postgres',qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');]);
my$stdout_sql=$node_master->safe_psql('postgres',
qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');]
);
is($stdout_sql,$expected,'got expected output from SQL decoding session');
my$endpos=$node_master->safe_psql('postgres',"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;");
my$endpos=$node_master->safe_psql('postgres',
"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
$node_master->poll_query_until('otherdb',"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)");
$node_master->poll_query_until('otherdb',"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)");
is($stdout,$final_expected_output_bb,'decoded expected data from slot before_basebackup');
is($stdout,$final_expected_output_bb,
'decoded expected data from slot before_basebackup');
is($stderr,'','replay from slot before_basebackup produces no stderr');
# So far we've peeked the slots, so when we fetch the same info over
# pg_recvlogical we should get complete results. First, find out the commit lsn
# of the last transaction. There's no max(pg_lsn), so:
my$endpos=$node_replica->safe_psql('postgres',"SELECT lsn FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY lsn DESC LIMIT 1;");
my$endpos=$node_replica->safe_psql('postgres',
"SELECT lsn FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
);
# now use the walsender protocol to peek the slot changes and make sure we see
@@ -266,7 +269,7 @@ my $result = $node_subscriber->safe_psql('postgres', qq(
SELECT a, b FROM tst_hstore ORDER BY a;
));
is($result,'1|{1,2,3}
is($result,'1|{1,2,3}
2|{2,3,1}
3|{3,2,1}
4|{4,3,2}
...
...
@@ -331,10 +334,11 @@ e|{d,NULL}
2|"zzz"=>"foo"
3|"123"=>"321"
4|"yellow horse"=>"moaned"',
'check replicated inserts on subscriber');
'check replicated inserts on subscriber');
# Run batch of updates
$node_publisher->safe_psql('postgres',qq(
$node_publisher->safe_psql(
'postgres',qq(
UPDATE tst_one_array SET b = '{4, 5, 6}' WHERE a = 1;
UPDATE tst_one_array SET b = '{4, 5, 6, 1}' WHERE a > 3;
UPDATE tst_arrays SET b = '{"1a", "2b", "3c"}', c = '{1.0, 2.0, 3.0}', d = '{"1 day 1 second", "2 days 2 seconds", "3 days 3 second"}' WHERE a = '{1, 2, 3}';