diff --git a/.github/composite-actions/dump-restore-util/action.yml b/.github/composite-actions/dump-restore-util/action.yml index 3c8fc794dd..4437a92d93 100644 --- a/.github/composite-actions/dump-restore-util/action.yml +++ b/.github/composite-actions/dump-restore-util/action.yml @@ -61,11 +61,11 @@ runs: if [[ '${{ inputs.logical_database }}' == 'null' ]];then echo 'Starting to dump whole Babelfish physical database' - ~/${{ inputs.pg_new_dir }}/bin/pg_dumpall -h localhost --database jdbc_testdb --username jdbc_user --globals-only --quote-all-identifiers --verbose --no-role-passwords -f pg_dump_globals.sql 2>>error.log + ~/${{ inputs.pg_new_dir }}/bin/pg_dumpall -h localhost --database jdbc_testdb --username jdbc_user --roles-only --quote-all-identifiers --verbose --no-role-passwords -f pg_dump_globals.sql 2>>error.log ~/${{ inputs.pg_new_dir }}/bin/pg_dump -h localhost --username jdbc_user $DUMP_OPTS --quote-all-identifiers --verbose --file="pg_dump.archive" --dbname=jdbc_testdb 2>>error.log else echo "Starting to dump Babelfish logical database ${{ inputs.logical_database }}" - ~/${{ inputs.pg_new_dir }}/bin/pg_dumpall -h localhost --database jdbc_testdb --username jdbc_user --globals-only --quote-all-identifiers --verbose --no-role-passwords --bbf-database-name='${{ inputs.logical_database }}' -f pg_dump_globals.sql 2>>error.log + ~/${{ inputs.pg_new_dir }}/bin/pg_dumpall -h localhost --database jdbc_testdb --username jdbc_user --roles-only --quote-all-identifiers --verbose --no-role-passwords --bbf-database-name='${{ inputs.logical_database }}' -f pg_dump_globals.sql 2>>error.log ~/${{ inputs.pg_new_dir }}/bin/pg_dump -h localhost --username jdbc_user $DUMP_OPTS --quote-all-identifiers --verbose --bbf-database-name='${{ inputs.logical_database }}' --file="pg_dump.archive" --dbname=jdbc_testdb 2>>error.log fi diff --git a/contrib/babelfishpg_tds/test/t/004_bbfdumprestore.pl b/contrib/babelfishpg_tds/test/t/004_bbfdumprestore.pl index f6e8fbd233..fa1e6592ba 100644 --- a/contrib/babelfishpg_tds/test/t/004_bbfdumprestore.pl +++ b/contrib/babelfishpg_tds/test/t/004_bbfdumprestore.pl @@ -70,7 +70,7 @@ $oldnode->start; my @dumpall_command = ( 'pg_dumpall', '--database', 'testdb', '--username', 'test_master', - '--port', $oldnode->port, '--globals-only', '--quote-all-identifiers', + '--port', $oldnode->port, '--roles-only', '--quote-all-identifiers', '--verbose', '--no-role-passwords', '--file', $dump1_file); $newnode->command_ok(\@dumpall_command, 'Dump global objects.'); # Dump Babelfish database using pg_dump. @@ -135,7 +135,7 @@ # need to use dump utilities from the new node here. @dumpall_command = ( 'pg_dumpall', '--database', 'testdb', '--username', 'test_master', - '--port', $newnode2->port, '--globals-only', '--quote-all-identifiers', + '--port', $newnode2->port, '--roles-only', '--quote-all-identifiers', '--verbose', '--no-role-passwords', '--file', $dump3_file); $newnode2->command_ok(\@dumpall_command, 'Dump global objects.'); # Dump Babelfish database using pg_dump. Let's dump with the custom format @@ -177,4 +177,23 @@ qr/Dump and restore across different migration modes is not yet supported./, 'Restore of Babelfish database failed since source and target migration modes do not match.'); $newnode->stop; + +############################################################################################ +########################### Test dump for non Babelfish database ########################### +############################################################################################ +$newnode->start; + +# Dump global objects using pg_dumpall. +@dumpall_command = ( + 'pg_dumpall', '--database', 'postgres', '--port', $newnode->port, + '--roles-only', '--quote-all-identifiers', '--verbose', + '--no-role-passwords', '--file', $dump1_file); +$newnode->command_ok(\@dumpall_command, 'Dump global objects.'); +# Dump Babelfish database using pg_dump. +@dump_command = ( + 'pg_dump', '--quote-all-identifiers', '--port', $newnode->port, + '--verbose', '--dbname', 'postgres', + '--file', $dump2_file); +$newnode->command_ok(\@dump_command, 'Dump non-Babelfish (postgres db) database.'); +$newnode->stop; done_testing(); diff --git a/dev-tools.sh b/dev-tools.sh index 0d4f2ff2e1..dd23a63940 100755 --- a/dev-tools.sh +++ b/dev-tools.sh @@ -197,10 +197,10 @@ pg_dump() { rm -f pg_dump_globals.sql pg_dump.sql error.log if [[ ! $2 ]];then - $1/postgres/bin/pg_dumpall --username jdbc_user --globals-only --quote-all-identifiers --verbose -f pg_dump_globals.sql 2>error.log + $1/postgres/bin/pg_dumpall --username jdbc_user --roles-only --quote-all-identifiers --verbose -f pg_dump_globals.sql 2>error.log $1/postgres/bin/pg_dump --create --username jdbc_user --column-inserts --quote-all-identifiers --verbose --file="pg_dump.sql" --dbname=jdbc_testdb 2>>error.log else - $1/postgres/bin/pg_dumpall --username jdbc_user --globals-only --quote-all-identifiers --verbose --bbf-database-name=$2 -f pg_dump_globals.sql 2>error.log + $1/postgres/bin/pg_dumpall --username jdbc_user --roles-only --quote-all-identifiers --verbose --bbf-database-name=$2 -f pg_dump_globals.sql 2>error.log $1/postgres/bin/pg_dump --username jdbc_user --column-inserts --quote-all-identifiers --verbose --bbf-database-name=$2 --file="pg_dump.sql" --dbname=jdbc_testdb 2>>error.log fi stop $1