forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (244 loc) · 11.7 KB
/
major-version-upgrade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: Major Version Upgrade Tests for empty database
on: [push, pull_request]
jobs:
run-babelfish-mvu-tests:
env:
OLD_INSTALL_DIR: psql_source
NEW_INSTALL_DIR: psql_target
ENGINE_BRANCH_FROM: BABEL_2_X_DEV__PG_14_X
EXTENSION_BRANCH_FROM: BABEL_2_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/python3.8 --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 PostGIS Extension using ${{env.EXTENSION_BRANCH_FROM}}
id: build-postgis-extension-old
if: always() && steps.compile-antlr.outcome == 'success'
run: |
cd ..
export CC='ccache gcc'
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
sudo apt-get install wget
max_retries=20
retries=0
until [ $retries -ge $max_retries ]
do
wget http://postgis.net/stuff/postgis-3.4.0.tar.gz && break
retries=$((retries+1))
done
tar -xvzf postgis-3.4.0.tar.gz
retries1=0
until [ $retries1 -ge $max_retries ]
do
wget https://download.osgeo.org/proj/proj-9.2.1.tar.gz && break
retries1=$((retries1+1))
done
tar -xvzf proj-9.2.1.tar.gz
cd proj-9.2.1
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake -DCMAKE_INSTALL_LIBDIR="lib/x86_64-linux-gnu" -DCMAKE_INSTALL_PREFIX="/usr" ..
cmake --build .
sudo cmake --build . --target install
cd ../../postgis-3.4.0
./configure --without-protobuf --without-raster --with-pgconfig=$HOME/psql_source/bin/pg_config
make USE_PGXS=1 PG_CONFIG=~/psql_source/bin/pg_config
sudo make USE_PGXS=1 PG_CONFIG=~/psql_source/bin/pg_config install
shell: bash
- name: Build Extensions using ${{env.EXTENSION_BRANCH_FROM}}
id: build-extensions-old
if: always() && steps.build-postgis-extension-old.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: |
ulimit -c unlimited
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 -c -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, 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
~/${{env.OLD_INSTALL_DIR}}/bin/pg_ctl -c -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" -v migration_mode="multi-db" -v tsql_port="1433" -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}}
release_mode: 'yes'
- name: Copy ANTLR
run: cp "/usr/local/lib/libantlr4-runtime.so.4.9.3" ~/${{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: 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: ${{env.NEW_INSTALL_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: ${{env.NEW_INSTALL_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: ${{env.NEW_INSTALL_DIR}}
- name: Setup new data directory
id: setup-new-datadir
if: always() && steps.build-postgis-extension.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, 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
- 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: Disable TDS fault injection tests in release mode
id: disable-fault-injection
if: |
always() && steps.setup-new-datadir.outcome == 'success'
&& steps.check-babelfish-inconsistency.outcome == 'success'
&& steps.check-babelfish-inconsistency.outputs.check_result == 0
run: |
cd test/JDBC/
echo 'ignore#!#babel_tds_fault_injection' >> jdbc_schedule
echo 'ignore#!#tds_faultinjection' >> jdbc_schedule
echo jdbc_schedule
- name: Run JDBC Tests
id: jdbc
timeout-minutes: 60
if: always() && steps.run-pg_upgrade.outcome == 'success'
run: |
export PATH=~/${{env.NEW_INSTALL_DIR}}/bin:$PATH
export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish
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@v2
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@v2
with:
name: upgrade-logs
path: |
~/upgrade/*.log
~/${{env.NEW_INSTALL_DIR}}/data/pg_upgrade_output.d/*
# 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@v2
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@v2
with:
name: output-diff.diff
path: test/JDBC/Info/output-diff.diff
- name: Check and upload coredumps
if: always() && steps.jdbc.outcome == 'failure'
uses: ./.github/composite-actions/upload-coredump