From a5b9004df984a5eb226348ed42460d09a9f0fe5e Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Fri, 24 Nov 2023 06:32:43 +0000 Subject: [PATCH 1/6] added testframework to check --- .../run-pg-upgrade/action.yml | 3 +- .../setup-base-version/action.yml | 4 + .../setup-upgrade-version-ca/action.yml | 4 +- .../upgrade-test-configuration.yml | 268 +++++++++++------- .../jdbc-tests-with-non-default-params.yml | 94 ++++++ .github/workflows/upgrade-test.yml | 8 +- 6 files changed, 266 insertions(+), 115 deletions(-) create mode 100644 .github/workflows/jdbc-tests-with-non-default-params.yml diff --git a/.github/composite-actions/run-pg-upgrade/action.yml b/.github/composite-actions/run-pg-upgrade/action.yml index 28274cb2a6..d6bf776cc9 100644 --- a/.github/composite-actions/run-pg-upgrade/action.yml +++ b/.github/composite-actions/run-pg-upgrade/action.yml @@ -32,7 +32,8 @@ runs: echo 'Updating babelfish extensions...' cd ~/work/babelfish_extensions/babelfish_extensions/ ~/${{ inputs.pg_new_dir }}/bin/pg_ctl -D ~/${{ inputs.pg_new_dir }}/data -l ~/${{ inputs.pg_new_dir }}/data/logfile14 start - sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER EXTENSION babelfishpg_common UPDATE; ALTER EXTENSION babelfishpg_tsql UPDATE;" + sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER EXTENSION babelfishpg_common UPDATE;" + sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER EXTENSION babelfishpg_tsql UPDATE;" sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "\dx" echo 'Reset bbf database settings...' sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER SYSTEM SET babelfishpg_tsql.database_name = 'jdbc_testdb';" diff --git a/.github/composite-actions/setup-base-version/action.yml b/.github/composite-actions/setup-base-version/action.yml index 8c8f9efd1a..5fc3abbf24 100644 --- a/.github/composite-actions/setup-base-version/action.yml +++ b/.github/composite-actions/setup-base-version/action.yml @@ -56,6 +56,10 @@ runs: sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}') sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf + DB_PARAMETERS=${{ matrix.upgrade-path.db_parameters }} + for DB_PARAMETER in ${DB_PARAMETERS[@]}; do + sudo echo $DB_PARAMETER >> postgresql.conf + done ~/${{ inputs.install_dir }}/bin/pg_ctl -D ~/${{ inputs.install_dir }}/data/ -l logfile restart sudo ~/${{ inputs.install_dir }}/bin/psql -d postgres -U runner -c "CREATE USER jdbc_user WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '12345678' INHERIT;" sudo ~/${{ inputs.install_dir }}/bin/psql -d postgres -U runner -c "DROP DATABASE IF EXISTS jdbc_testdb;" diff --git a/.github/composite-actions/setup-upgrade-version-ca/action.yml b/.github/composite-actions/setup-upgrade-version-ca/action.yml index 993ce5f089..2ba841d82a 100644 --- a/.github/composite-actions/setup-upgrade-version-ca/action.yml +++ b/.github/composite-actions/setup-upgrade-version-ca/action.yml @@ -17,7 +17,7 @@ runs: printf 'name: "Upgrade till final version and run verify tests"\nruns:\n using: "composite"\n steps:\n' > $upgrade_version_dir_path/action.yml # Length of the upgrade path - LEN=$(yq '."upgrade-version"[${{ matrix.upgrade-path.id }}] | length' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml) + LEN=$(yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path" | length' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml) if [[ $LEN -le 1 ]] then echo "ERROR: Upgrade path length less than 2" 1>&2 @@ -32,7 +32,7 @@ runs: for (( i=1 ; i<$LEN ; i++ )); do # Computing input parameters that need to pass - version_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}][$i].version" + version_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}]."upgrade-path"[$i].version" upgrade_version=$(yq $version_var ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml) upgrade_version_engb=".\""${upgrade_version}"\".engine_branch" engine_branch=$(yq $upgrade_version_engb ${{ github.workspace }}/.github/template/version-branch-template.yml) diff --git a/.github/configuration/upgrade-test-configuration.yml b/.github/configuration/upgrade-test-configuration.yml index f1ca4be9c6..4876f88fc7 100644 --- a/.github/configuration/upgrade-test-configuration.yml +++ b/.github/configuration/upgrade-test-configuration.yml @@ -1,108 +1,160 @@ -upgrade-version: [[ - { - version: 13.6, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 14.3, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: minor - } -], -[ - { - version: 14.5, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: minor - } -], -[ - { - version: '14.10', - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: minor - } -], -[ - { - version: source.latest, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 13.4, - upgrade-type: null - }, - { - version: 13.9, - upgrade-type: minor - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 13.5, - upgrade-type: null - }, - { - version: 13.9, - upgrade-type: minor - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 13.7, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 13.8, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: major - } -], -[ - { - version: 13.9, - upgrade-type: null - }, - { - version: target.latest, - upgrade-type: major - } -]] +upgrade-version: [ +{ + upgrade-path: [ + { + version: 13.6, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 14.3, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: minor + } + ] +}, +{ + upgrade-path: [ + { + version: 14.5, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: minor + } + ] +}, +{ + upgrade-path: [ + { + version: '14.10', + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: minor + } + ] +}, +{ + upgrade-path: [ + { + version: source.latest, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.4, + upgrade-type: null + }, + { + version: 13.9, + upgrade-type: minor + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.5, + upgrade-type: null + }, + { + version: 13.9, + upgrade-type: minor + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.7, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.8, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.9, + upgrade-type: null + }, + { + version: target.latest, + upgrade-type: major + } + ] +}, +{ + upgrade-path: [ + { + version: 13.6, + upgrade-type: null, + }, + { + version: target.latest, + upgrade-type: major, + } + ], + db-parameters: [ + "babelfishpg_tsql.server_collation_name = 'chinese_prc_ci_as'" + ] +}, +{ + upgrade-path: [ + { + version: 13.9, + upgrade-type: null, + }, + { + version: target.latest, + upgrade-type: major, + } + ], + db-parameters: [ + "babelfishpg_tsql.server_collation_name = 'chinese_prc_ci_as'" + ] +} +] diff --git a/.github/workflows/jdbc-tests-with-non-default-params.yml b/.github/workflows/jdbc-tests-with-non-default-params.yml new file mode 100644 index 0000000000..a0b92b8e41 --- /dev/null +++ b/.github/workflows/jdbc-tests-with-non-default-params.yml @@ -0,0 +1,94 @@ +name: JDBC Tests with non default params +on: [push, pull_request] + +jobs: + run-babelfish-jdbc-tests: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + id: checkout + + - name: Install Dependencies + id: install-dependencies + if: always() + uses: ./.github/composite-actions/install-dependencies + + - name: Build Modified Postgres + id: build-modified-postgres + if: always() && steps.install-dependencies.outcome == 'success' + uses: ./.github/composite-actions/build-modified-postgres + + - name: Compile ANTLR + id: compile-antlr + if: always() && steps.build-modified-postgres.outcome == 'success' + uses: ./.github/composite-actions/compile-antlr + + - name: Build Extensions + id: build-extensions + if: always() && steps.compile-antlr.outcome == 'success' + uses: ./.github/composite-actions/build-extensions + + - name: Install Extensions + id: install-extensions + if: always() && steps.build-extensions.outcome == 'success' + run: | + cd ~ + export PATH=/opt/mssql-tools/bin:$PATH + ~/postgres/bin/initdb -D ~/postgres/data/ + ~/postgres/bin/pg_ctl -D ~/postgres/data/ -l logfile start + cd postgres/data + sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" postgresql.conf + sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf + ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}') + sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf + ~/postgres/bin/pg_ctl -D ~/postgres/data/ -l logfile restart + cd ~/work/babelfish_extensions/babelfish_extensions/ + sudo ~/postgres/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode="single-db" -v parallel_query_mode=false -f .github/scripts/create_extension.sql + sqlcmd -S localhost -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO" + shell: bash + + - name: Run JDBC Tests + id: jdbc + if: always() && steps.install-extensions.outcome == 'success' + timeout-minutes: 60 + run: | + cd test/JDBC/ + mvn test + + - name: Cleanup babelfish database + id: cleanup + if: always() && steps.install-extensions.outcome == 'success' + run: | + sudo ~/postgres/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql + + - name: Upload Log + if: always() && steps.jdbc.outcome == 'failure' + uses: actions/upload-artifact@v2 + with: + name: postgres-log + path: ~/postgres/data/logfile + + # The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions + - name: Rename Test Summary Files + id: test-file-rename + if: always() && steps.jdbc.outcome == 'failure' + run: | + cd test/JDBC/Info + timestamp=`ls -Art | tail -n 1` + cd $timestamp + mv $timestamp.diff ../output-diff.diff + mv "$timestamp"_runSummary.log ../run-summary.log + + - name: Upload Run Summary + if: always() && steps.test-file-rename == 'success' + uses: actions/upload-artifact@v2 + with: + name: run-summary.log + path: test/JDBC/Info/run-summary.log + + - name: Upload Output Diff + if: always() && steps.jdbc.outcome == 'failure' + uses: actions/upload-artifact@v2 + with: + name: output-diff.diff + path: test/JDBC/Info/output-diff.diff diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml index 33f2eadef8..5a2cad2a8f 100644 --- a/.github/workflows/upgrade-test.yml +++ b/.github/workflows/upgrade-test.yml @@ -13,9 +13,9 @@ jobs: - name: "Read and setup upgrade path list from configuration" id: generate-upgrade-path run: | - config="'$(yq -o=json ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml)'" + config="'$(yq -o=json ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml | sed "s/'/\\\\\'/g")'" config=$(echo $config | sed "s/\"/\\\\\"/g") - UPGRADE_PATH_LIST=$(node -e "let k = JSON.parse($config); let p = k['upgrade-version'].map((itm, index) => ({ id: index, path: itm.map(i => i.version.toString().replace(/[.]/g, \"_\")), title: itm.map(i => i.version.toString().replace(/[.]/g, \"_\")).join(\"-\"), last_version: itm[itm.length - 1].version.toString().replace(/[.]/g, \"_\") })); console.log(JSON.stringify(p));") + UPGRADE_PATH_LIST=$(node -e "let k = JSON.parse($config); let p = k['upgrade-version'].map((itm, index) => ({ id: index, path: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")), db_parameters: itm['db-parameters'] ? (\"(\" + itm['db-parameters'].map(dbp => '\"' + dbp + '\"').toString().replace(/[ ]/g, \"\").replace(/[,]/g, \" \") + \")\") : \"()\", title: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")).join(\"-\") + (itm['db-parameters'] ? \" with non-default db-paramters\" : \"\"), last_version: itm['upgrade-path'][itm['upgrade-path'].length - 1].version.toString().replace(/[.]/g, \"_\") })); console.log(JSON.stringify(p));") echo "::set-output name=upgrade-path-list::$UPGRADE_PATH_LIST" run-version-upgrade-test: @@ -39,10 +39,10 @@ jobs: if: always() && steps.install-yq.outcome == 'success' run: > echo "::set-output name=base-version::$( - yq '."upgrade-version"[${{ matrix.upgrade-path.id }}][0].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml + yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[0].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml )" && echo "::set-output name=final-version::$( - yq '."upgrade-version"[${{ matrix.upgrade-path.id }}][-1].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml + yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[-1].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml )" - name: Find Engine and Extension Branches for Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} From f4bc50bd7054094bd1ba76493a5fa49e5a3569f0 Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Fri, 24 Nov 2023 10:14:44 +0000 Subject: [PATCH 2/6] resolved syntax error Signed-off-by: Rohit Bhagat --- .github/composite-actions/setup-upgrade-version-ca/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite-actions/setup-upgrade-version-ca/action.yml b/.github/composite-actions/setup-upgrade-version-ca/action.yml index 2ba841d82a..1f74c5d083 100644 --- a/.github/composite-actions/setup-upgrade-version-ca/action.yml +++ b/.github/composite-actions/setup-upgrade-version-ca/action.yml @@ -32,7 +32,7 @@ runs: for (( i=1 ; i<$LEN ; i++ )); do # Computing input parameters that need to pass - version_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}]."upgrade-path"[$i].version" + version_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}].\"upgrade-path\"[$i].version" upgrade_version=$(yq $version_var ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml) upgrade_version_engb=".\""${upgrade_version}"\".engine_branch" engine_branch=$(yq $upgrade_version_engb ${{ github.workspace }}/.github/template/version-branch-template.yml) From 80bf6aae6cad484c60ca515ebd6d6ffb06be6729 Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Fri, 24 Nov 2023 11:02:23 +0000 Subject: [PATCH 3/6] fix setup-upgrade-version-ca Signed-off-by: Rohit Bhagat --- .github/composite-actions/setup-upgrade-version-ca/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite-actions/setup-upgrade-version-ca/action.yml b/.github/composite-actions/setup-upgrade-version-ca/action.yml index 1f74c5d083..197bd1867d 100644 --- a/.github/composite-actions/setup-upgrade-version-ca/action.yml +++ b/.github/composite-actions/setup-upgrade-version-ca/action.yml @@ -42,7 +42,7 @@ runs: pg_old_dir=$(echo postgres$(awk -F. '{print $1}' <<< $previous_installed_version)) pg_new_dir=$(echo postgres$(awk -F. '{print $1}' <<< $upgrade_version)) - upgrade_type_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}][$i].\"upgrade-type\"" + upgrade_type_var=".\"upgrade-version\"[${{ matrix.upgrade-path.id }}].\"upgrade-path\"[$i].\"upgrade-type\"" upgrade_type=$(yq $upgrade_type_var ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml) uses_file=./.github/composite-actions/$upgrade_type-version-upgrade-util From 97495fa40652cdb375d034bec8afb85db583ec91 Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Sun, 26 Nov 2023 18:53:14 +0000 Subject: [PATCH 4/6] updated major version upgrade util to support DB parameters --- .../major-version-upgrade-util/action.yml | 9 +++++++++ .../setup-upgrade-version-ca/action.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/composite-actions/major-version-upgrade-util/action.yml b/.github/composite-actions/major-version-upgrade-util/action.yml index 87692fb40a..e8b8f1df27 100644 --- a/.github/composite-actions/major-version-upgrade-util/action.yml +++ b/.github/composite-actions/major-version-upgrade-util/action.yml @@ -18,6 +18,10 @@ inputs: migration_mode: description: "Database migration mode for Babelfish" required: true + db_parameters: + description: "DB parameters which need to be set in postgresql.conf" + required: false + default: "()" runs: using: "composite" @@ -57,6 +61,11 @@ runs: sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}') sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf + + DB_PARAMETERS=${{ inputs.db_parameters }} + for DB_PARAMETER in ${DB_PARAMETERS[@]}; do + sudo echo $DB_PARAMETER >> postgresql.conf + done shell: bash - name: Run pg_upgrade diff --git a/.github/composite-actions/setup-upgrade-version-ca/action.yml b/.github/composite-actions/setup-upgrade-version-ca/action.yml index 197bd1867d..bc5aea8ebb 100644 --- a/.github/composite-actions/setup-upgrade-version-ca/action.yml +++ b/.github/composite-actions/setup-upgrade-version-ca/action.yml @@ -56,7 +56,7 @@ runs: # Appending upgrade step in upgrade-version composite action based on upgrade type if [[ $upgrade_type == 'major' ]] then - printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n pg_old_dir: ${pg_old_dir}\n pg_new_dir: ${pg_new_dir}\n migration_mode: 'multi-db'\n\n" >> $upgrade_version_dir_path/action.yml + printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n pg_old_dir: ${pg_old_dir}\n pg_new_dir: ${pg_new_dir}\n migration_mode: 'multi-db'\n db_parameters: ${{ matrix.upgrade-path.db_parameters }}\n\n" >> $upgrade_version_dir_path/action.yml else printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n install_dir: ${pg_new_dir}\n\n" >> $upgrade_version_dir_path/action.yml fi From 41b7a8d85afb26a8191785edaa6138006120552f Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Mon, 27 Nov 2023 03:48:50 +0000 Subject: [PATCH 5/6] removed files with different expected output --- .../preparation/ISC-Domains-vu-prepare.sql | 63 ------------------- .../sys-databases-dep-vu-prepare.sql | 18 ------ .../preparation/ISC-Domains-vu-prepare.sql | 63 ------------------- .../preparation/sys-databases-vu-prepare.sql | 18 ------ .../13_6/ISC-Domains-vu-cleanup.sql | 30 --------- .../13_6/ISC-Domains-vu-verify.sql | 10 --- .../13_6/sys-databases-dep-vu-cleanup.sql | 11 ---- .../13_6/sys-databases-dep-vu-verify.sql | 14 ----- .../13_9/ISC-Domains-vu-cleanup.sql | 30 --------- .../13_9/ISC-Domains-vu-verify.sql | 10 --- .../13_9/sys-databases-vu-cleanup.sql | 11 ---- .../13_9/sys-databases-vu-verify.sql | 14 ----- 12 files changed, 292 deletions(-) delete mode 100644 test/JDBC/upgrade/13_6/preparation/ISC-Domains-vu-prepare.sql delete mode 100644 test/JDBC/upgrade/13_6/preparation/sys-databases-dep-vu-prepare.sql delete mode 100644 test/JDBC/upgrade/13_9/preparation/ISC-Domains-vu-prepare.sql delete mode 100644 test/JDBC/upgrade/13_9/preparation/sys-databases-vu-prepare.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-cleanup.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-verify.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-cleanup.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-verify.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-cleanup.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-verify.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-cleanup.sql delete mode 100644 test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-verify.sql diff --git a/test/JDBC/upgrade/13_6/preparation/ISC-Domains-vu-prepare.sql b/test/JDBC/upgrade/13_6/preparation/ISC-Domains-vu-prepare.sql deleted file mode 100644 index d545af5994..0000000000 --- a/test/JDBC/upgrade/13_6/preparation/ISC-Domains-vu-prepare.sql +++ /dev/null @@ -1,63 +0,0 @@ -create schema isc_domains_vu_prepare_s -go - --- Create UDTS -create type isc_domains_vu_prepare_s.char_t from char(10) -go -create type isc_domains_vu_prepare_s.nchar_t from char(9) -go -create type isc_domains_vu_prepare_s.varchar_t from nvarchar(8) -go -create type isc_domains_vu_prepare_s.nvarchar_t from nvarchar(8) -go -create type isc_domains_vu_prepare_s.text_t from text -go -create type isc_domains_vu_prepare_s.ntext_t from ntext -go -create type isc_domains_vu_prepare_s.varbinary_t from varbinary(10) -go -create type isc_domains_vu_prepare_s.binary_t from binary(8) -go -create type isc_domains_vu_prepare_s.image_t from image -go -create type isc_domains_vu_prepare_s.int_t from int -go -create type isc_domains_vu_prepare_s.smallint_t from smallint -go -create type isc_domains_vu_prepare_s.tinyint_t from tinyint -go -create type isc_domains_vu_prepare_s.bigint_t from bigint -go -create type isc_domains_vu_prepare_s.bit_t from bit -go -create type isc_domains_vu_prepare_s.real_t from real -go -create type isc_domains_vu_prepare_s.numeric_t from numeric(5,3) -go -create type isc_domains_vu_prepare_s.money_t from money -go -create type isc_domains_vu_prepare_s.smallmoney_t from smallmoney -go -create type isc_domains_vu_prepare_s.date_t from date -go -create type isc_domains_vu_prepare_s.time_t from time(5) -go -create type isc_domains_vu_prepare_s.datetime_t from datetime -go -create type isc_domains_vu_prepare_s.datetime2_t from datetime2(5) -go -create type isc_domains_vu_prepare_s.smalldatetime_t from smalldatetime -go -create type isc_domains_vu_prepare_s.datetimeoffset_t from datetimeoffset(5) -go -create type isc_domains_vu_prepare_s.sql_variant_t from sql_variant -go - --- Create table type -CREATE TYPE isc_domains_vu_prepare_s.my_tbl_type AS TABLE(a INT) -go - --- Test cross db references -Create database isc_domains_vu_prepare_db -go - diff --git a/test/JDBC/upgrade/13_6/preparation/sys-databases-dep-vu-prepare.sql b/test/JDBC/upgrade/13_6/preparation/sys-databases-dep-vu-prepare.sql deleted file mode 100644 index ad0960b5ec..0000000000 --- a/test/JDBC/upgrade/13_6/preparation/sys-databases-dep-vu-prepare.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE DATABASE db_sys_databases_dep_vu_prepare -GO - -CREATE VIEW sys_databases_view_dep_vu_prepare AS -SELECT name, compatibility_level, collation_name FROM sys.databases WHERE name = 'db_sys_databases_dep_vu_prepare' -GO - -CREATE PROC sys_databases_proc_dep_vu_prepare AS -SELECT name, compatibility_level, collation_name FROM sys.databases WHERE name = 'db_sys_databases_dep_vu_prepare' -GO - -CREATE FUNCTION sys_databases_func_dep_vu_prepare() -RETURNS TINYINT -AS -BEGIN - RETURN (SELECT compatibility_level FROM sys.databases WHERE name = 'db_sys_databases_dep_vu_prepare') -END -GO diff --git a/test/JDBC/upgrade/13_9/preparation/ISC-Domains-vu-prepare.sql b/test/JDBC/upgrade/13_9/preparation/ISC-Domains-vu-prepare.sql deleted file mode 100644 index d545af5994..0000000000 --- a/test/JDBC/upgrade/13_9/preparation/ISC-Domains-vu-prepare.sql +++ /dev/null @@ -1,63 +0,0 @@ -create schema isc_domains_vu_prepare_s -go - --- Create UDTS -create type isc_domains_vu_prepare_s.char_t from char(10) -go -create type isc_domains_vu_prepare_s.nchar_t from char(9) -go -create type isc_domains_vu_prepare_s.varchar_t from nvarchar(8) -go -create type isc_domains_vu_prepare_s.nvarchar_t from nvarchar(8) -go -create type isc_domains_vu_prepare_s.text_t from text -go -create type isc_domains_vu_prepare_s.ntext_t from ntext -go -create type isc_domains_vu_prepare_s.varbinary_t from varbinary(10) -go -create type isc_domains_vu_prepare_s.binary_t from binary(8) -go -create type isc_domains_vu_prepare_s.image_t from image -go -create type isc_domains_vu_prepare_s.int_t from int -go -create type isc_domains_vu_prepare_s.smallint_t from smallint -go -create type isc_domains_vu_prepare_s.tinyint_t from tinyint -go -create type isc_domains_vu_prepare_s.bigint_t from bigint -go -create type isc_domains_vu_prepare_s.bit_t from bit -go -create type isc_domains_vu_prepare_s.real_t from real -go -create type isc_domains_vu_prepare_s.numeric_t from numeric(5,3) -go -create type isc_domains_vu_prepare_s.money_t from money -go -create type isc_domains_vu_prepare_s.smallmoney_t from smallmoney -go -create type isc_domains_vu_prepare_s.date_t from date -go -create type isc_domains_vu_prepare_s.time_t from time(5) -go -create type isc_domains_vu_prepare_s.datetime_t from datetime -go -create type isc_domains_vu_prepare_s.datetime2_t from datetime2(5) -go -create type isc_domains_vu_prepare_s.smalldatetime_t from smalldatetime -go -create type isc_domains_vu_prepare_s.datetimeoffset_t from datetimeoffset(5) -go -create type isc_domains_vu_prepare_s.sql_variant_t from sql_variant -go - --- Create table type -CREATE TYPE isc_domains_vu_prepare_s.my_tbl_type AS TABLE(a INT) -go - --- Test cross db references -Create database isc_domains_vu_prepare_db -go - diff --git a/test/JDBC/upgrade/13_9/preparation/sys-databases-vu-prepare.sql b/test/JDBC/upgrade/13_9/preparation/sys-databases-vu-prepare.sql deleted file mode 100644 index 56d8cac499..0000000000 --- a/test/JDBC/upgrade/13_9/preparation/sys-databases-vu-prepare.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE DATABASE db_sys_databases_vu_prepare -GO - -CREATE VIEW sys_databases_view_vu_prepare AS -SELECT name, compatibility_level, collation_name FROM sys.databases WHERE name = 'db_sys_databases_vu_prepare' -GO - -CREATE PROC sys_databases_proc_vu_prepare AS -SELECT name, compatibility_level, collation_name FROM sys.databases WHERE name = 'db_sys_databases_vu_prepare' -GO - -CREATE FUNCTION sys_databases_func_vu_prepare() -RETURNS TINYINT -AS -BEGIN - RETURN (SELECT compatibility_level FROM sys.databases WHERE name = 'db_sys_databases_vu_prepare') -END -GO diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-cleanup.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-cleanup.sql deleted file mode 100644 index 7a7d7a3728..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-cleanup.sql +++ /dev/null @@ -1,30 +0,0 @@ --- cleanup -DROP TYPE isc_domains_vu_prepare_s.char_t -DROP TYPE isc_domains_vu_prepare_s.nchar_t -DROP TYPE isc_domains_vu_prepare_s.varchar_t -DROP TYPE isc_domains_vu_prepare_s.nvarchar_t -DROP TYPE isc_domains_vu_prepare_s.text_t -DROP TYPE isc_domains_vu_prepare_s.ntext_t -DROP TYPE isc_domains_vu_prepare_s.varbinary_t -DROP TYPE isc_domains_vu_prepare_s.binary_t -DROP TYPE isc_domains_vu_prepare_s.image_t -DROP TYPE isc_domains_vu_prepare_s.int_t -DROP TYPE isc_domains_vu_prepare_s.smallint_t -DROP TYPE isc_domains_vu_prepare_s.tinyint_t -DROP TYPE isc_domains_vu_prepare_s.bigint_t -DROP TYPE isc_domains_vu_prepare_s.bit_t -DROP TYPE isc_domains_vu_prepare_s.real_t -DROP TYPE isc_domains_vu_prepare_s.numeric_t -DROP TYPE isc_domains_vu_prepare_s.money_t -DROP TYPE isc_domains_vu_prepare_s.smallmoney_t -DROP TYPE isc_domains_vu_prepare_s.date_t -DROP TYPE isc_domains_vu_prepare_s.time_t -DROP TYPE isc_domains_vu_prepare_s.datetime_t -DROP TYPE isc_domains_vu_prepare_s.datetime2_t -DROP TYPE isc_domains_vu_prepare_s.smalldatetime_t -DROP TYPE isc_domains_vu_prepare_s.datetimeoffset_t -DROP TYPE isc_domains_vu_prepare_s.sql_variant_t -DROP TYPE isc_domains_vu_prepare_s.my_tbl_type -DROP SCHEMA isc_domains_vu_prepare_s -DROP DATABASE isc_domains_vu_prepare_db -go \ No newline at end of file diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-verify.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-verify.sql deleted file mode 100644 index f3cc8233ca..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_6/ISC-Domains-vu-verify.sql +++ /dev/null @@ -1,10 +0,0 @@ - -select * from information_schema.domains where DOMAIN_SCHEMA = 'isc_domains_vu_prepare_s' ORDER BY DOMAIN_NAME -go - --- Test cross db references -use isc_domains_vu_prepare_db -go - -select COUNT(*) from information_schema.domains -go diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-cleanup.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-cleanup.sql deleted file mode 100644 index d2db84ccfa..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-cleanup.sql +++ /dev/null @@ -1,11 +0,0 @@ -DROP VIEW sys_databases_view_dep_vu_prepare -GO - -DROP PROC sys_databases_proc_dep_vu_prepare -GO - -DROP FUNCTION sys_databases_func_dep_vu_prepare -GO - -DROP DATABASE db_sys_databases_dep_vu_prepare -GO diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-verify.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-verify.sql deleted file mode 100644 index c96970ede8..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_6/sys-databases-dep-vu-verify.sql +++ /dev/null @@ -1,14 +0,0 @@ -SELECT name, compatibility_level, collation_name FROM sys_databases_view_dep_vu_prepare -GO - -EXEC sys_databases_proc_dep_vu_prepare -GO - -SELECT sys_databases_func_dep_vu_prepare() -GO - -SELECT COUNT(*) FROM sys.all_columns WHERE object_id = object_id('sys.databases'); -GO - -SELECT name FROM sys.databases where name = 'db_sys_databases_dep_vu_prepare'; -GO diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-cleanup.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-cleanup.sql deleted file mode 100644 index 7a7d7a3728..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-cleanup.sql +++ /dev/null @@ -1,30 +0,0 @@ --- cleanup -DROP TYPE isc_domains_vu_prepare_s.char_t -DROP TYPE isc_domains_vu_prepare_s.nchar_t -DROP TYPE isc_domains_vu_prepare_s.varchar_t -DROP TYPE isc_domains_vu_prepare_s.nvarchar_t -DROP TYPE isc_domains_vu_prepare_s.text_t -DROP TYPE isc_domains_vu_prepare_s.ntext_t -DROP TYPE isc_domains_vu_prepare_s.varbinary_t -DROP TYPE isc_domains_vu_prepare_s.binary_t -DROP TYPE isc_domains_vu_prepare_s.image_t -DROP TYPE isc_domains_vu_prepare_s.int_t -DROP TYPE isc_domains_vu_prepare_s.smallint_t -DROP TYPE isc_domains_vu_prepare_s.tinyint_t -DROP TYPE isc_domains_vu_prepare_s.bigint_t -DROP TYPE isc_domains_vu_prepare_s.bit_t -DROP TYPE isc_domains_vu_prepare_s.real_t -DROP TYPE isc_domains_vu_prepare_s.numeric_t -DROP TYPE isc_domains_vu_prepare_s.money_t -DROP TYPE isc_domains_vu_prepare_s.smallmoney_t -DROP TYPE isc_domains_vu_prepare_s.date_t -DROP TYPE isc_domains_vu_prepare_s.time_t -DROP TYPE isc_domains_vu_prepare_s.datetime_t -DROP TYPE isc_domains_vu_prepare_s.datetime2_t -DROP TYPE isc_domains_vu_prepare_s.smalldatetime_t -DROP TYPE isc_domains_vu_prepare_s.datetimeoffset_t -DROP TYPE isc_domains_vu_prepare_s.sql_variant_t -DROP TYPE isc_domains_vu_prepare_s.my_tbl_type -DROP SCHEMA isc_domains_vu_prepare_s -DROP DATABASE isc_domains_vu_prepare_db -go \ No newline at end of file diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-verify.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-verify.sql deleted file mode 100644 index f3cc8233ca..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_9/ISC-Domains-vu-verify.sql +++ /dev/null @@ -1,10 +0,0 @@ - -select * from information_schema.domains where DOMAIN_SCHEMA = 'isc_domains_vu_prepare_s' ORDER BY DOMAIN_NAME -go - --- Test cross db references -use isc_domains_vu_prepare_db -go - -select COUNT(*) from information_schema.domains -go diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-cleanup.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-cleanup.sql deleted file mode 100644 index de8dc754f0..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-cleanup.sql +++ /dev/null @@ -1,11 +0,0 @@ -DROP VIEW sys_databases_view_vu_prepare -GO - -DROP PROC sys_databases_proc_vu_prepare -GO - -DROP FUNCTION sys_databases_func_vu_prepare -GO - -DROP DATABASE db_sys_databases_vu_prepare -GO diff --git a/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-verify.sql b/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-verify.sql deleted file mode 100644 index 64415df3d4..0000000000 --- a/test/JDBC/upgrade/latest/verification_cleanup/13_9/sys-databases-vu-verify.sql +++ /dev/null @@ -1,14 +0,0 @@ -SELECT name, compatibility_level, collation_name FROM sys_databases_view_vu_prepare -GO - -EXEC sys_databases_proc_vu_prepare -GO - -SELECT sys_databases_func_vu_prepare() -GO - -SELECT COUNT(*) FROM sys.all_columns WHERE object_id = object_id('sys.databases'); -GO - -SELECT name FROM sys.databases where name = 'db_sys_databases_vu_prepare'; -GO From 08fe3c981ad31d3636a7675b45e92c8a47692466 Mon Sep 17 00:00:00 2001 From: Rohit Bhagat Date: Wed, 29 Nov 2023 13:33:04 +0000 Subject: [PATCH 6/6] fixed setting of server collation name in upgrade --- .../major-version-upgrade-util/action.yml | 10 +--------- .github/composite-actions/run-pg-upgrade/action.yml | 11 +++++++++++ .../setup-upgrade-version-ca/action.yml | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/composite-actions/major-version-upgrade-util/action.yml b/.github/composite-actions/major-version-upgrade-util/action.yml index e8b8f1df27..373dd9a513 100644 --- a/.github/composite-actions/major-version-upgrade-util/action.yml +++ b/.github/composite-actions/major-version-upgrade-util/action.yml @@ -18,10 +18,6 @@ inputs: migration_mode: description: "Database migration mode for Babelfish" required: true - db_parameters: - description: "DB parameters which need to be set in postgresql.conf" - required: false - default: "()" runs: using: "composite" @@ -61,11 +57,6 @@ runs: sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = 'babelfishpg_tds'/g" postgresql.conf ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}') sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf - - DB_PARAMETERS=${{ inputs.db_parameters }} - for DB_PARAMETER in ${DB_PARAMETERS[@]}; do - sudo echo $DB_PARAMETER >> postgresql.conf - done shell: bash - name: Run pg_upgrade @@ -76,6 +67,7 @@ runs: migration_mode: ${{ inputs.migration_mode }} pg_old_dir: ${{ inputs.pg_old_dir }} pg_new_dir: ${{ inputs.pg_new_dir }} + db_parameters: ${{ matrix.upgrade-path.db_parameters }} - name: Run JDBC Verify Tests if: always() && inputs.is_final_ver == 'true' diff --git a/.github/composite-actions/run-pg-upgrade/action.yml b/.github/composite-actions/run-pg-upgrade/action.yml index d6bf776cc9..c65b438e54 100644 --- a/.github/composite-actions/run-pg-upgrade/action.yml +++ b/.github/composite-actions/run-pg-upgrade/action.yml @@ -13,6 +13,10 @@ inputs: description: "Current postgres intall directory" required: false default: postgres14 + db_parameters: + description: "DB parameters which need to be set in postgresql.conf" + required: false + default: "()" runs: using: "composite" @@ -39,6 +43,13 @@ runs: sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER SYSTEM SET babelfishpg_tsql.database_name = 'jdbc_testdb';" sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "ALTER SYSTEM SET babelfishpg_tsql.migration_mode = '${{inputs.migration_mode}}';" sudo ~/${{ inputs.pg_new_dir }}/bin/psql -d jdbc_testdb -U runner -c "SELECT pg_reload_conf();" + + DB_PARAMETERS=${{ inputs.db_parameters }} + for DB_PARAMETER in ${DB_PARAMETERS[@]}; do + sudo echo $DB_PARAMETER >> ~/${{ inputs.pg_new_dir }}/data/postgresql.conf + done + ~/${{ inputs.pg_new_dir }}/bin/pg_ctl -D ~/${{ inputs.pg_new_dir }}/data -l ~/${{ inputs.pg_new_dir }}/data/logfile14 restart + export PATH=/opt/mssql-tools/bin:$PATH sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT @@version GO" shell: bash diff --git a/.github/composite-actions/setup-upgrade-version-ca/action.yml b/.github/composite-actions/setup-upgrade-version-ca/action.yml index bc5aea8ebb..197bd1867d 100644 --- a/.github/composite-actions/setup-upgrade-version-ca/action.yml +++ b/.github/composite-actions/setup-upgrade-version-ca/action.yml @@ -56,7 +56,7 @@ runs: # Appending upgrade step in upgrade-version composite action based on upgrade type if [[ $upgrade_type == 'major' ]] then - printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n pg_old_dir: ${pg_old_dir}\n pg_new_dir: ${pg_new_dir}\n migration_mode: 'multi-db'\n db_parameters: ${{ matrix.upgrade-path.db_parameters }}\n\n" >> $upgrade_version_dir_path/action.yml + printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n pg_old_dir: ${pg_old_dir}\n pg_new_dir: ${pg_new_dir}\n migration_mode: 'multi-db'\n\n" >> $upgrade_version_dir_path/action.yml else printf " - name: Upgrade Version to $upgrade_version\n id: upgrade-version-$i\n if: always() $temp\n uses: ${uses_file}\n with: \n engine_branch: ${engine_branch}\n extension_branch: ${extension_branch}\n is_final_ver: ${is_final_ver}\n install_dir: ${pg_new_dir}\n\n" >> $upgrade_version_dir_path/action.yml fi