提交 4e899e31 编写于 作者: A Adam Berlin 提交者: Adam Berlin

squash! Skip attempts to create target gp tablespace.

use template files to find location of tablespace directory
上级 58b88aa4
......@@ -6,6 +6,10 @@ sql/ao_upgrade.sql
expected/ao_upgrade.out
expected/ao_upgrade_optimizer.out
-- ignore generated pg_basebackup tests
/sql/pg_basebackup*.sql
/expected/pg_basebackup*.out
# Local binaries and symbolic links
/pg_isolation2_regress
/atmsort.pm
......
include: helpers/gp_management_utils_helpers.sql;
-- Given a segment running without a replication slot
0U: select * from pg_drop_replication_slot('some_replication_slot');
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
-- 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';
-- 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
......@@ -14,22 +11,26 @@ select pg_basebackup(address, dbid, port, 'some_replication_slot', '/tmp/some_is
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', '/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';
-- Then the backup should exist on the filesystem, ready for mirroring
!\retcode cat /tmp/some_other_isolation2_pg_basebackup/recovery.conf;
!\retcode cat @testtablespace@/some_other_isolation2_pg_basebackup/recovery.conf;
-- 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');
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
!\retcode rm -rf /tmp/some_other_isolation2_pg_basebackup;
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup;
!\retcode rm -rf @testtablespace@/some_other_isolation2_pg_basebackup;
-- When pg_basebackup runs without --slot
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';
-- Then there should NOT be a replication slot
0U: select count(1) from pg_get_replication_slots() where slot_name = 'some_replication_slot';
-- Cleanup things we've created
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup;
include: helpers/gp_management_utils_helpers.sql;
-- Ensure we have a clean slate to begin with
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup_tablespace;
-- Given a segment with a database that has a tablespace
!\retcode mkdir -p /tmp/some_isolation2_pg_basebackup_tablespace;
!\retcode mkdir -p @testtablespace@/some_isolation2_pg_basebackup_tablespace;
drop tablespace if exists some_isolation2_pg_basebackup_tablespace;
create tablespace some_isolation2_pg_basebackup_tablespace location '/tmp/some_isolation2_pg_basebackup_tablespace';
create tablespace some_isolation2_pg_basebackup_tablespace location '@testtablespace@/some_isolation2_pg_basebackup_tablespace';
-- And a database using the tablespace
drop database if exists some_database_with_tablespace;
create database some_database_with_tablespace tablespace some_isolation2_pg_basebackup_tablespace;
-- When we create a full backup
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';
-- Then we should have a backup of the source segment files in the newly created target tablespace
select count_of_items_in_directory('/tmp/some_isolation2_pg_basebackup_tablespace/GPDB_*db100/');
select count_of_items_in_directory('@testtablespace@/some_isolation2_pg_basebackup_tablespace/GPDB_*db100/');
-- 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';
-- Then we should have a backup of the source segment files in the newly created target tablespace
select count_of_items_in_directory('/tmp/some_isolation2_pg_basebackup_tablespace/GPDB_*db200/');
select count_of_items_in_directory('@testtablespace@/some_isolation2_pg_basebackup_tablespace/GPDB_*db200/');
-- Cleanup things we've created
0U: select pg_drop_replication_slot('some_replication_slot');
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup;
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup_tablespace;
include: helpers/gp_management_utils_helpers.sql;
CREATE
-- Given a segment running without a replication slot
0U: select * from pg_drop_replication_slot('some_replication_slot');
ERROR: replication slot "some_replication_slot" does not exist
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
-- 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';
pg_basebackup
---------------
......@@ -28,14 +20,14 @@ select pg_basebackup(address, dbid, port, 'some_replication_slot', '/tmp/some_is
(1 row)
-- 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
!\retcode cat /tmp/some_other_isolation2_pg_basebackup/recovery.conf;
!\retcode cat @testtablespace@/some_other_isolation2_pg_basebackup/recovery.conf;
-- start_ignore
standby_mode = 'on'
primary_conninfo = 'user=adamberlin host=adamberlin-linux port=25432 sslmode=disable sslcompression=1 application_name=gp_walreceiver'
......@@ -57,19 +49,19 @@ primary_slot_name = 'some_replication_slot'
--------------------------
(1 row)
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
!\retcode rm -rf /tmp/some_other_isolation2_pg_basebackup;
!\retcode rm -rf @testtablespace@/some_other_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
-- When pg_basebackup runs without --slot
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';
pg_basebackup
---------------
......@@ -82,3 +74,11 @@ select pg_basebackup(address, dbid, port, null, '/tmp/some_isolation2_pg_basebac
0
(1 row)
-- Cleanup things we've created
!\retcode rm -rf /home/adamberlin/workspace/gpdb/src/test/isolation2/testtablespace/some_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
include: helpers/gp_management_utils_helpers.sql;
CREATE
-- Ensure we have a clean slate to begin with
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
!\retcode rm -rf /tmp/some_isolation2_pg_basebackup_tablespace;
-- start_ignore
-- end_ignore
(exited with code 0)
-- Given a segment with a database that has a tablespace
!\retcode mkdir -p /tmp/some_isolation2_pg_basebackup_tablespace;
!\retcode mkdir -p @testtablespace@/some_isolation2_pg_basebackup_tablespace;
-- start_ignore
-- end_ignore
......@@ -22,7 +10,7 @@ CREATE
drop tablespace if exists some_isolation2_pg_basebackup_tablespace;
DROP
create tablespace some_isolation2_pg_basebackup_tablespace location '/tmp/some_isolation2_pg_basebackup_tablespace';
create tablespace some_isolation2_pg_basebackup_tablespace location '@testtablespace@/some_isolation2_pg_basebackup_tablespace';
CREATE
-- And a database using the tablespace
......@@ -32,29 +20,48 @@ create database some_database_with_tablespace tablespace some_isolation2_pg_base
CREATE
-- When we create a full backup
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
select count_of_items_in_directory('/tmp/some_isolation2_pg_basebackup_tablespace/GPDB_*db100/');
select count_of_items_in_directory('@testtablespace@/some_isolation2_pg_basebackup_tablespace/GPDB_*db100/');
count_of_items_in_directory
-----------------------------
1
(1 row)
-- 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
select count_of_items_in_directory('/tmp/some_isolation2_pg_basebackup_tablespace/GPDB_*db200/');
select count_of_items_in_directory('@testtablespace@/some_isolation2_pg_basebackup_tablespace/GPDB_*db200/');
count_of_items_in_directory
-----------------------------
1
(1 row)
-- Cleanup things we've created
0U: select pg_drop_replication_slot('some_replication_slot');
pg_drop_replication_slot
--------------------------
(1 row)
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup;
-- start_ignore
-- end_ignore
(exited with code 0)
!\retcode rm -rf @testtablespace@/some_isolation2_pg_basebackup_tablespace;
-- start_ignore
-- end_ignore
(exited with code 0)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册