Skip to content

Commit

Permalink
fixing minor-version-upgrade-util V3
Browse files Browse the repository at this point in the history
  • Loading branch information
SiddharthBITS committed Jan 22, 2025
1 parent 1f9516d commit 0730bee
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 38 deletions.
110 changes: 79 additions & 31 deletions .github/composite-actions/major-version-upgrade-util/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Major Version Upgrade Utility'
name: 'Minor Version Upgrade Utility'
inputs:
engine_branch:
description: "Engine Branch"
Expand All @@ -9,15 +9,9 @@ inputs:
is_final_ver:
description: "Is this the final version"
required: true
pg_old_dir:
description: "Previous version was installed in this directory"
required: true
pg_new_dir:
install_dir:
description: "Install new version in this directory"
required: true
migration_mode:
description: "Database migration mode for Babelfish"
required: true
server_collation_name:
description: "Server collation name"
required: false
Expand All @@ -29,32 +23,86 @@ inputs:

runs:
using: "composite"
steps:
- name: Setup latest version
id: setup-new-version
steps:
- name: Build and run tests for Postgres engine using ${{ inputs.engine_branch }}
id: build-modified-postgres-new
if: always()
uses: ./.github/composite-actions/setup-new-version
uses: ./.github/composite-actions/build-modified-postgres
with:
engine_branch: ${{ inputs.engine_branch }}
extension_branch: ${{ inputs.extension_branch }}
pg_new_dir: ${{ inputs.pg_new_dir }}
antlr_version: ${{ inputs.antlr_version }}
install_dir: ${{ inputs.install_dir }}

- name: Compile new ANTLR
id: compile-new-antlr
if: always() && steps.build-modified-postgres-new.outcome == 'success'
uses: ./.github/composite-actions/compile-antlr
with:
version: ${{ inputs.antlr_version }}
install_dir: ${{inputs.install_dir}}

- name: Run pg_upgrade
id: run-pg_upgrade
if: always() && steps.setup-new-version.outcome == 'success'
uses: ./.github/composite-actions/run-pg-upgrade
- name: Set env variables and build extensions using ${{ inputs.extension_branch }}
id: build-extensions-newer
if: always() && steps.compile-new-antlr.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
with:
migration_mode: ${{ inputs.migration_mode }}
pg_old_dir: ${{ inputs.pg_old_dir }}
pg_new_dir: ${{ inputs.pg_new_dir }}
server_collation_name: ${{ inputs.server_collation_name }}
install_dir: ${{ inputs.install_dir }}
extension_branch: ${{ inputs.extension_branch }}

- name: Run Verify Tests
if: always() && steps.run-pg_upgrade.outcome == 'success' && inputs.is_final_ver == 'true'
uses: ./.github/composite-actions/run-verify-tests
with:
is_final_ver: ${{ inputs.is_final_ver }}
pg_new_dir: ${{ inputs.pg_new_dir }}
migration_mode: ${{ inputs.migration_mode }}
server_collation_name: ${{ inputs.server_collation_name }}
- name: Save cache
if: always() && steps.build-extensions-newer.outcome == 'success'
uses: ./.github/composite-actions/save-ccache

# Not created and used composite action update-extensions here since, in the previous step it has
# checked out a branch/tag which may not have the updated update-extension composite action
- name: Update extensions
if: always() && steps.build-extensions-newer.outcome == 'success'
run: |
ulimit -c unlimited
cd ~
~/${{ inputs.install_dir }}/bin/pg_ctl -c -D ~/${{ inputs.install_dir }}/data/ -l logfile restart
sudo ~/${{ inputs.install_dir }}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "\dx"
sudo ~/${{ inputs.install_dir }}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "ALTER EXTENSION "babelfishpg_common" UPDATE;"
sudo ~/${{ inputs.install_dir }}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "ALTER EXTENSION "babelfishpg_tsql" UPDATE;"
sudo ~/${{ inputs.install_dir }}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "\dx"
sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT @@version GO"
shell: bash

- uses: actions/checkout@v2

- name: Change migration mode to multi-db
id: change-migration-mode
if: always() && inputs.is_final_ver == 'true'
run: |
sudo ~/${{ inputs.install_dir}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db';"
sudo ~/${{ inputs.install_dir}}/bin/psql -v ON_ERROR_STOP=1 -d babelfish_db -U runner -c "SELECT pg_reload_conf();"
shell: bash

- name: Run JDBC Verify Tests
id: jdbc-verify-tests
if: always() && steps.change-migration-mode.outcome == 'success' && inputs.is_final_ver == 'true'
env:
base_dir: ${{ matrix.upgrade-path.path[0] }}
tar_dir: ${{ matrix.upgrade-path.last_version }}
run: |
cd test/JDBC/
export isUpgradeTestMode=true
if [[ ${{ inputs.server_collation_name }} != "default" ]]; then
export serverCollationName=${{ inputs.server_collation_name }}
fi
base_dir=${{ matrix.upgrade-path.path[0] }}
tar_dir=${{ matrix.upgrade-path.last_version }}
if [[ "$base_dir" == *"latest"* ]]; then
base_dir="latest"
fi
if [[ "$tar_dir" == *"latest"* ]]; then
tar_dir="latest"
fi
export inputFilesPath=upgrade/$tar_dir/verification_cleanup/$base_dir
mvn -B -ntp test
export inputFilesPath=input
for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do
sed -i "s/\b$filename[ ]*\b$/$filename-vu-verify\\n$filename-vu-cleanup/g" upgrade/$base_dir/schedule
done
export scheduleFile=upgrade/$base_dir/schedule
mvn -B -ntp test
shell: bash
14 changes: 7 additions & 7 deletions .github/workflows/minor-version-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ jobs:
sudo make USE_PGXS=1 PG_CONFIG=~/psql/bin/pg_config install
shell: bash

- uses: actions/checkout@v2

- name: Save cache
if: always() && steps.build-tds_fdw-extension.outcome == 'success'
uses: ./.github/composite-actions/save-ccache

- name: Install extensions
id: install-extensions-older
if: always() && steps.build-tds_fdw-extension.outcome == 'success'
uses: ./.github/composite-actions/install-extensions

- uses: actions/checkout@v2

- name: Save cache
if: always() && steps.install-extensions-older.outcome == 'success'
uses: ./.github/composite-actions/save-ccache

- name: Build and run tests for Postgres engine using latest engine
id: build-modified-postgres-newer
if: always() && steps.install-extensions-older.outcome == 'success'
Expand Down Expand Up @@ -194,4 +194,4 @@ jobs:

- name: Check and upload coredumps
if: always() && steps.jdbc.outcome == 'failure'
uses: ./.github/composite-actions/upload-coredump
uses: ./.github/composite-actions/upload-coredump

0 comments on commit 0730bee

Please sign in to comment.