Skip to content

Commit

Permalink
Fix data directory path
Browse files Browse the repository at this point in the history
  • Loading branch information
ritanwar committed Jan 18, 2024
1 parent cc49976 commit a3a2fa1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 12 additions & 5 deletions .github/composite-actions/install-extensions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ inputs:
psql_port:
description: "Postgres port"
required: false
default: 'null'
default: 5432
tsql_port:
description: "TDS port"
required: false
default: 1433
wal_level:
description: "wal_level GUC setting"
required: false
default: replica

runs:
using: "composite"
Expand All @@ -32,15 +36,18 @@ runs:
export PATH=/opt/mssql-tools/bin:$PATH
# add port as suffix in data directory name to make it unique
if [[ '${{ inputs.psql_port }}' != 'null' ]];then
export DATADIR=data_${{ inputs.psql_port }}
if [[ ${{inputs.psql_port}} != 5432 ]];then
export DATADIR=data_${{inputs.psql_port}}
else
export DATADIR=data
fi
~/${{inputs.install_dir}}/bin/initdb -D ~/${{inputs.install_dir}}/$DATADIR/
cd ${{inputs.install_dir}}/$DATADIR
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
sudo sed -i "s/#port = 5432/port = ${{ inputs.psql_port }}/g" postgresql.conf
sudo sed -i "s/#port = 5432/port = ${{inputs.psql_port}}/g" postgresql.conf
sudo sed -i "s/#wal_level = replica/wal_level = ${{inputs.wal_level}}/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
{
Expand All @@ -53,7 +60,7 @@ runs:
} > pg_hba.conf
~/${{inputs.install_dir}}/bin/pg_ctl -c -D ~/${{inputs.install_dir}}/$DATADIR/ -l logfile start
cd ~/work/babelfish_extensions/babelfish_extensions/
sudo ~/${{inputs.install_dir}}/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode=${{inputs.migration_mode}} -v tsql_port=${{inputs.tsql_port}} -v parallel_query_mode=${{inputs.parallel_query_mode}} -f .github/scripts/create_extension.sql
sudo ~/${{inputs.install_dir}}/bin/psql -d postgres -U runner -p ${{inputs.psql_port}} -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode=${{inputs.migration_mode}} -v tsql_port=${{inputs.tsql_port}} -v parallel_query_mode=${{inputs.parallel_query_mode}} -f .github/scripts/create_extension.sql
~/${{inputs.install_dir}}/bin/pg_ctl -c -D ~/${{inputs.install_dir}}/$DATADIR/ -l logfile restart
sqlcmd -S localhost,${{inputs.tsql_port}} -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO"
shell: bash
7 changes: 4 additions & 3 deletions .github/workflows/logical-replication-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ jobs:
with:
psql_port: 5433
tsql_port: 8199
wal_level: logical

- name: Setup Publication and Subscription
id: setup-pub-sub
if: always() && steps.start-subscriber.outcome == 'success'
run: |
~/${{inputs.install_dir}}/bin/psql -d jdbc_testdb -U runner -c "CREATE PUBLICATION my_pub;"
~/${{inputs.install_dir}}/bin/psql -d jdbc_testdb -U runner -p 5433 -c "CREATE SUBSCRIPTION my_sub CONNECTION 'host=localhost port=5432 user=jdbc_user dbname=jdbc_testdb password=12345678' PUBLICATION my_pub;"
~/${{env.INSTALL_DIR}}/bin/psql -d jdbc_testdb -U runner -c "CREATE PUBLICATION my_pub;"
~/${{env.INSTALL_DIR}}/bin/psql -d jdbc_testdb -U runner -p 5433 -c "CREATE SUBSCRIPTION my_sub CONNECTION 'host=localhost port=5432 user=jdbc_user dbname=jdbc_testdb password=12345678' PUBLICATION my_pub;"
- name: Run Replication Tests
id: replication
Expand All @@ -78,7 +79,7 @@ jobs:
name: postgres-log-replication
path: |
~/psql/data/logfile
~/psql/data2/logfile
~/psql/data_5433/logfile
# The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions
- name: Rename Test Summary Files
Expand Down

0 comments on commit a3a2fa1

Please sign in to comment.