select pg_basebackup(address, dbid, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
-- Then a replication slot gets created on that segment with the slot
-- name and the slot's restart_lsn is not NULL, indicating that the
0U: select slot_name, slot_type, active, restart_lsn is not NULL as slot_was_used from pg_get_replication_slots() where slot_name = 'some_replication_slot';
-- When another basebackup is run with the same slot name
select pg_basebackup(address, dbid, port, 'some_replication_slot', '@testtablespace@/some_other_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
-- Then the backup should exist on the filesystem, ready for mirroring
-- And the replication slot information should be unchanged
0U: select slot_name, slot_type, active, restart_lsn is not NULL as slot_was_used from pg_get_replication_slots() where slot_name = 'some_replication_slot';
-- Given we remove the replication slot
0U: select * from pg_drop_replication_slot('some_replication_slot');
select pg_basebackup(address, dbid, port, null, '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
-- Then there should NOT be a replication slot
0U: select count(1) from pg_get_replication_slots() where slot_name = 'some_replication_slot';
select pg_basebackup(address, 100, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
-- Then we should have a backup of the source segment files in the newly created target tablespace
select pg_basebackup(address, 200, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', true) from gp_segment_configuration where content = 0 and role = 'p';
-- Then we should have a backup of the source segment files in the newly created target tablespace
-- When pg_basebackup runs with --slot and stream as xlog-method
select pg_basebackup(address, dbid, port, 'some_replication_slot', '/tmp/some_isolation2_pg_basebackup') from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, dbid, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
-- When another basebackup is run with the same slot name
select pg_basebackup(address, dbid, port, 'some_replication_slot', '/tmp/some_other_isolation2_pg_basebackup') from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, dbid, port, 'some_replication_slot', '@testtablespace@/some_other_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
pg_basebackup
---------------
(1 row)
-- Then the backup should exist on the filesystem, ready for mirroring
select pg_basebackup(address, dbid, port, null, '/tmp/some_isolation2_pg_basebackup') from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, dbid, port, null, '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, 100, port, 'some_replication_slot', '/tmp/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, 100, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', false) from gp_segment_configuration where content = 0 and role = 'p';
pg_basebackup
---------------
(1 row)
-- Then we should have a backup of the source segment files in the newly created target tablespace
-- When we create a full backup using force overwrite
select pg_basebackup(address, 200, port, 'some_replication_slot', '/tmp/some_isolation2_pg_basebackup', true) from gp_segment_configuration where content = 0 and role = 'p';
select pg_basebackup(address, 200, port, 'some_replication_slot', '@testtablespace@/some_isolation2_pg_basebackup', true) from gp_segment_configuration where content = 0 and role = 'p';
pg_basebackup
---------------
(1 row)
-- Then we should have a backup of the source segment files in the newly created target tablespace