Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update antlr to 4.13.2 #3069

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/composite-actions/compile-antlr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:

- name: Compile ANTLR
run: |
ANTLR_VERSION=4.9.3
ANTLR_VERSION=4.13.2

cd contrib/babelfishpg_tsql/antlr/thirdparty/antlr/
sudo cp "antlr-$ANTLR_VERSION-complete.jar" /usr/local/lib
Expand Down
80 changes: 80 additions & 0 deletions .github/composite-actions/setup-new-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: 'Setup Base Version'
inputs:
engine_branch:
description: "Engine Branch"
required: true
extension_branch:
description: "Extension Branch"
required: true
pg_new_dir:
description: "Install new version in this directory"
required: true

runs:
using: "composite"
steps:
- name: Build Modified Postgres using latest version
id: build-modified-postgres-new
if: always()
uses: ./.github/composite-actions/build-modified-postgres
with:
engine_branch: ${{ inputs.engine_branch }}
install_dir: ${{ inputs.pg_new_dir }}

- name: Copy ANTLR
id: copy-antlr
if: always() && steps.build-modified-postgres-new.outcome == 'success'
run: cp "/usr/local/lib/libantlr4-runtime.so.4.13.2" ~/${{ inputs.pg_new_dir }}/lib/
shell: bash

- name: Build Extensions
id: build-extensions-new
if: always() && steps.copy-antlr.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
with:
install_dir: ${{ inputs.pg_new_dir }}
extension_branch: ${{ inputs.extension_branch }}

- uses: actions/checkout@v2

- name: Build tds_fdw Extension
id: build-tds_fdw-extension
if: always() && steps.build-extensions-new.outcome == 'success'
uses: ./.github/composite-actions/build-tds_fdw-extension
with:
install_dir: ${{ inputs.pg_new_dir }}

- name: Build vector Extension
id: build-vector-extension
if: always() && steps.build-tds_fdw-extension.outcome == 'success'
uses: ./.github/composite-actions/build-vector-extension
with:
install_dir: ${{ inputs.pg_new_dir }}

- name: Build PostGIS Extension
id: build-postgis-extension
if: always() && steps.build-vector-extension.outcome == 'success'
uses: ./.github/composite-actions/build-postgis-extension
with:
install_dir: ${{ inputs.pg_new_dir }}

- name: Setup new data directory
id: setup-new-datadir
if: always() && steps.build-postgis-extension.outcome == 'success'
run: |
cd ~
~/${{ inputs.pg_new_dir }}/bin/initdb -D ~/${{ inputs.pg_new_dir }}/data
cd ~/${{ inputs.pg_new_dir }}/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, pg_stat_statements'/g" postgresql.conf
ipaddress=$(ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{ print $2}')
# Allow only runner to have trust authentication, all other users must provide a password
{
sudo echo "local all runner trust"
sudo echo "local all all md5"
sudo echo "host all runner 127.0.0.1/32 trust"
sudo echo "host all runner $ipaddress/32 trust"
sudo echo "host all all 0.0.0.0/0 md5"
sudo echo "host all all ::/0 md5"
} > pg_hba.conf
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/isolation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ jobs:
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
cd ~/work/babelfish_extensions/babelfish_extensions/test/python
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 python3-dev
pip3 install pyodbc pymssql pytest pytest-xdist antlr4-python3-runtime==4.9.3
pip3 install pyodbc pymssql pytest pytest-xdist antlr4-python3-runtime==4.13.2
- name: Generate .spec file parser
run: |
cd ~/work/babelfish_extensions/babelfish_extensions/test/python/isolationtest/
java -Xmx500M -cp /usr/local/lib/antlr-4.9.3-complete.jar org.antlr.v4.Tool -Dlanguage=Python3 ./parser/*.g4 -visitor -no-listener
java -Xmx500M -cp /usr/local/lib/antlr-4.13.2-complete.jar org.antlr.v4.Tool -Dlanguage=Python3 ./parser/*.g4 -visitor -no-listener
- name: Run Isolation tests
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/jdbc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Upload Log
if: always() && steps.jdbc.outcome == 'failure'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: postgres-log
path: ~/postgres/data/logfile
Expand All @@ -61,14 +61,14 @@ jobs:

- name: Upload Run Summary
if: always() && steps.test-file-rename == 'success'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
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
uses: actions/upload-artifact@v4
with:
name: output-diff.diff
path: test/JDBC/Info/output-diff.diff
174 changes: 174 additions & 0 deletions .github/workflows/major-version-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Major Version Upgrade Tests for empty database
on: [push, pull_request]

jobs:
run-babelfish-mvu-tests:
env:
OLD_INSTALL_DIR: postgres13
NEW_INSTALL_DIR: postgres14
ENGINE_BRANCH_FROM: BABEL_1_X_DEV__PG_13_X
EXTENSION_BRANCH_FROM: BABEL_1_X_DEV

runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Install Dependencies
id: install-dependencies
if: always()
uses: ./.github/composite-actions/install-dependencies

- name: Build Modified Postgres using ${{env.ENGINE_BRANCH_FROM}}
id: build-modified-postgres-old
if: always() && steps.install-dependencies.outcome == 'success'
run: |
cd ..
git clone --branch ${{env.ENGINE_BRANCH_FROM}} https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git
cd postgresql_modified_for_babelfish
./configure --prefix=$HOME/${{env.OLD_INSTALL_DIR}} --with-python PYTHON=/usr/bin/python2.7 --enable-debug --enable-cassert CFLAGS="-ggdb" --with-libxml --with-uuid=ossp --with-icu
make clean
make -j 4 2>error.txt
make install
make check
cd contrib && make && sudo make install
shell: bash

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

- uses: actions/checkout@v2
with:
repository: babelfish-for-postgresql/babelfish_extensions
ref: ${{env.EXTENSION_BRANCH_FROM}}

- name: Build Extensions using ${{env.EXTENSION_BRANCH_FROM}}
id: build-extensions-old
if: always() && steps.compile-antlr.outcome == 'success'
run: |
export PG_CONFIG=~/${{env.OLD_INSTALL_DIR}}/bin/pg_config
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
export cmake=$(which cmake)
cd contrib/babelfishpg_money
make && make install
cd ../babelfishpg_common
make && make install
cd ../babelfishpg_tds
make && make install
cd ../babelfishpg_tsql
make && make install

- name: Install Extensions using ${{env.EXTENSION_BRANCH_FROM}}
id: install-extensions-old
if: always() && steps.build-extensions-old.outcome == 'success'
run: |
cd ~
export PATH=/opt/mssql-tools/bin:$PATH
~/${{env.OLD_INSTALL_DIR}}/bin/initdb -D ~/${{env.OLD_INSTALL_DIR}}/data
~/${{env.OLD_INSTALL_DIR}}/bin/pg_ctl -D ~/${{env.OLD_INSTALL_DIR}}/data -l ~/${{env.OLD_INSTALL_DIR}}/data/logfile start
cd ${{env.OLD_INSTALL_DIR}}/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
~/${{env.OLD_INSTALL_DIR}}/bin/pg_ctl -D ~/${{env.OLD_INSTALL_DIR}}/data -l ~/${{env.OLD_INSTALL_DIR}}/data/logfile restart
cd ~/work/babelfish_extensions/babelfish_extensions/
sudo ~/${{env.OLD_INSTALL_DIR}}/bin/psql -v ON_ERROR_STOP=1 -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/create_extension.sql
sqlcmd -S localhost -U jdbc_user -P 12345678 -Q "SELECT @@version GO"
shell: bash

- uses: actions/checkout@v2

- name: Build Modified Postgres using latest version
id: build-modified-postgres-new
if: always() && steps.install-extensions-old.outcome == 'success'
uses: ./.github/composite-actions/build-modified-postgres
with:
install_dir: ${{env.NEW_INSTALL_DIR}}

- name: Copy ANTLR
run: cp "/usr/local/lib/libantlr4-runtime.so.4.13.2" ~/${{env.NEW_INSTALL_DIR}}/lib/

- name: Build Extensions using latest version
id: build-extensions-new
if: always() && steps.build-modified-postgres-new.outcome == 'success'
uses: ./.github/composite-actions/build-extensions
with:
install_dir: ${{env.NEW_INSTALL_DIR}}

- name: Setup new data directory
id: setup-new-datadir
if: always() && steps.build-extensions-new.outcome == 'success'
run: |
cd ~
~/${{env.NEW_INSTALL_DIR}}/bin/initdb -D ~/${{env.NEW_INSTALL_DIR}}/data
cd ~/${{env.NEW_INSTALL_DIR}}/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
shell: bash

- name: Check Babelfish metadata inconsistency before Major Version Upgrade
id: check-babelfish-inconsistency
if: always() && steps.setup-new-datadir.outcome == 'success'
uses: ./.github/composite-actions/check-babelfish-inconsistency

- name: Run pg_upgrade
id: run-pg_upgrade
if: |
always() && steps.setup-new-datadir.outcome == 'success'
&& steps.check-babelfish-inconsistency.outcome == 'success'
uses: ./.github/composite-actions/run-pg-upgrade

- name: Run JDBC Tests
id: jdbc
timeout-minutes: 60
if: always() && steps.run-pg_upgrade.outcome == 'success'
run: |
cd test/JDBC/
# temporarily ignore test BABEL-2086
echo 'ignore#!#BABEL-2086' >> jdbc_schedule
mvn test

- name: Upload Postgres log
if: always() && steps.jdbc.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: postgres-log
path: ~/${{env.NEW_INSTALL_DIR}}/data/logfile

- name: Upload upgrade Log
if: always() && steps.run-pg_upgrade.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: upgrade-logs
path: ~/upgrade/*.log

# 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.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: run-summary.log
path: test/JDBC/Info/run-summary.log

- name: Upload Output Diff
if: always() && steps.test-file-rename.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: output-diff.diff
path: test/JDBC/Info/output-diff.diff
6 changes: 3 additions & 3 deletions .github/workflows/minor-version-upgrade-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:

- name: Upload Log
if: always() && steps.jdbc.outcome == 'failure'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: postgres-log
path: ~/postgres/data/logfile
Expand All @@ -130,14 +130,14 @@ jobs:

- name: Upload Run Summary
if: always() && steps.test-file-rename == 'success'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
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
uses: actions/upload-artifact@v4
with:
name: output-diff.diff
path: test/JDBC/Info/output-diff.diff
Loading
Loading