Skip to content

Commit 2e43289

Browse files
authored
Connection exception and reconnection handling (#283)
Initial work to provide connection error handling that optionally reconnects. Fixes #32 Still probably needs: - [ ] Unit tests (open to suggestions on how to handle this, but for now skipping in favor of functional tests in the CI pipeline and local script infrastructure) - [x] Expanded/tested support for additional database engines. Additional work on improving test infrastructure has been split out to #427.
1 parent 5e44cbf commit 2e43289

File tree

134 files changed

+553
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+553
-28
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
".devcontainer/scripts/initializeCommand"
1919
],
2020
"runArgs": [
21+
// Allow us to resolve the host network from inside the devcontainer.
22+
"--add-host=host.docker.internal:host-gateway",
2123
// Secret injection as environment variables
2224
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables#_option-2-use-an-env-file
2325
"--env-file=.env"

.github/workflows/maven.yml

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ jobs:
126126
java -jar benchbase.jar -b tpcc -c config/sqlite/sample_tpcc_nosync_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
127127
# Run the templated benchmark.
128128
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/sqlite/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
129+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
130+
echo "The ${{matrix.benchmark}} benchmark is not supported for sqlite."
131+
exit 0
129132
else
130133
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/sqlite/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
131134
fi
@@ -140,6 +143,9 @@ jobs:
140143
ERRORS_THRESHOLD=0.03
141144
elif [ ${{matrix.benchmark}} == tatp ]; then
142145
ERRORS_THRESHOLD=0.05
146+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
147+
ERRORS_THRESHOLD=0.02
148+
results_benchmark=tpcc
143149
fi
144150
./scripts/check_latest_benchmark_results.sh $results_benchmark
145151
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
@@ -154,7 +160,7 @@ jobs:
154160
fail-fast: false
155161
matrix:
156162
# FIXME: Add tpch back in (#333).
157-
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
163+
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
158164
services:
159165
mariadb: # https://hub.docker.com/_/mariadb
160166
image: mariadb:latest
@@ -202,6 +208,11 @@ jobs:
202208
if [[ ${{matrix.benchmark}} == templated ]]; then
203209
java -jar benchbase.jar -b tpcc -c config/mariadb/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
204210
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/mariadb/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
211+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
212+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
213+
java -jar benchbase.jar -b tpcc -c config/mariadb/sample_tpcc_config.xml --create=true --load=true
214+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh mariadb) &
215+
java -jar benchbase.jar -b tpcc -c config/mariadb/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
205216
else
206217
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/mariadb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
207218
fi
@@ -212,6 +223,9 @@ jobs:
212223
ERRORS_THRESHOLD=0.02
213224
elif [ ${{matrix.benchmark}} == tatp ]; then
214225
ERRORS_THRESHOLD=0.05
226+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
227+
ERRORS_THRESHOLD=0.02
228+
results_benchmark=tpcc
215229
fi
216230
./scripts/check_latest_benchmark_results.sh $results_benchmark
217231
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
@@ -225,7 +239,7 @@ jobs:
225239
strategy:
226240
fail-fast: false
227241
matrix:
228-
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
242+
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
229243
services:
230244
mysql: # https://hub.docker.com/_/mysql
231245
image: mysql:latest
@@ -272,6 +286,11 @@ jobs:
272286
if [[ ${{matrix.benchmark}} == templated ]]; then
273287
java -jar benchbase.jar -b tpcc -c config/mysql/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
274288
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/mysql/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
289+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
290+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
291+
java -jar benchbase.jar -b tpcc -c config/mysql/sample_tpcc_config.xml --create=true --load=true
292+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh mysql) &
293+
java -jar benchbase.jar -b tpcc -c config/mysql/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
275294
else
276295
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/mysql/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
277296
fi
@@ -282,6 +301,9 @@ jobs:
282301
ERRORS_THRESHOLD=0.02
283302
elif [ ${{matrix.benchmark}} == tatp ]; then
284303
ERRORS_THRESHOLD=0.05
304+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
305+
ERRORS_THRESHOLD=0.02
306+
results_benchmark=tpcc
285307
fi
286308
./scripts/check_latest_benchmark_results.sh $results_benchmark
287309
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
@@ -295,7 +317,7 @@ jobs:
295317
strategy:
296318
fail-fast: false
297319
matrix:
298-
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb', 'templated' ]
320+
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
299321
services:
300322
oracle:
301323
image: gvenzl/oracle-xe:21.3.0-slim-faststart
@@ -346,6 +368,11 @@ jobs:
346368
if [[ ${{matrix.benchmark}} == templated ]]; then
347369
java -jar benchbase.jar -b tpcc -c config/oracle/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
348370
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/oracle/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
371+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
372+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
373+
java -jar benchbase.jar -b tpcc -c config/oracle/sample_tpcc_config.xml --create=true --load=true
374+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh oracle) &
375+
java -jar benchbase.jar -b tpcc -c config/oracle/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
349376
else
350377
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/oracle/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
351378
fi
@@ -354,12 +381,15 @@ jobs:
354381
results_benchmark=${{matrix.benchmark}}
355382
if [ ${{matrix.benchmark}} == auctionmark ]; then
356383
ERRORS_THRESHOLD=0.04
384+
elif [ ${{matrix.benchmark}} == resourcestresser ]; then
385+
ERRORS_THRESHOLD=0.04
357386
elif [ ${{matrix.benchmark}} == tatp ]; then
358387
ERRORS_THRESHOLD=0.05
359388
elif [ ${{matrix.benchmark}} == tpcc ]; then
360389
ERRORS_THRESHOLD=0.03
361-
elif [ ${{matrix.benchmark}} == resourcestresser ]; then
362-
ERRORS_THRESHOLD=0.04
390+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
391+
ERRORS_THRESHOLD=0.02
392+
results_benchmark=tpcc
363393
elif [ ${{matrix.benchmark}} == wikipedia ]; then
364394
ERRORS_THRESHOLD=0.02
365395
fi
@@ -375,7 +405,7 @@ jobs:
375405
strategy:
376406
fail-fast: false
377407
matrix:
378-
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
408+
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
379409
services:
380410
postgres: # https://hub.docker.com/_/postgres
381411
image: postgres:latest
@@ -420,6 +450,11 @@ jobs:
420450
if [[ ${{matrix.benchmark}} == templated ]]; then
421451
java -jar benchbase.jar -b tpcc -c config/postgres/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
422452
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/postgres/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
453+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
454+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
455+
java -jar benchbase.jar -b tpcc -c config/postgres/sample_tpcc_config.xml --create=true --load=true
456+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh postgres) &
457+
java -jar benchbase.jar -b tpcc -c config/postgres/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
423458
else
424459
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/postgres/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
425460
fi
@@ -430,6 +465,9 @@ jobs:
430465
ERRORS_THRESHOLD=0.02
431466
elif [ ${{matrix.benchmark}} == tatp ]; then
432467
ERRORS_THRESHOLD=0.05
468+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
469+
ERRORS_THRESHOLD=0.02
470+
results_benchmark=tpcc
433471
fi
434472
./scripts/check_latest_benchmark_results.sh $results_benchmark
435473
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
@@ -443,6 +481,7 @@ jobs:
443481
strategy:
444482
fail-fast: false
445483
matrix:
484+
# TODO: Add tpcc-with-reconnects benchmark support
446485
benchmark: [ 'auctionmark', 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'seats', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
447486
services:
448487
cockroach: # https://hub.docker.com/repository/docker/timveil/cockroachdb-single-node
@@ -479,16 +518,24 @@ jobs:
479518
if [[ ${{matrix.benchmark}} == templated ]]; then
480519
java -jar benchbase.jar -b tpcc -c config/cockroachdb/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
481520
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
521+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
522+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
523+
java -jar benchbase.jar -b tpcc -c config/cockroachdb/sample_tpcc_config.xml --create=true --load=true
524+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh cockroachdb) &
525+
java -jar benchbase.jar -b tpcc -c config/cockroachdb/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
482526
else
483527
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
484528
fi
485-
# FIXME: Reduce the error rate so we don't need these overrides.
529+
486530
# FIXME: Reduce the error rate so we don't need these overrides.
487531
results_benchmark=${{matrix.benchmark}}
488532
if [ ${{matrix.benchmark}} == auctionmark ]; then
489533
ERRORS_THRESHOLD=0.02
490534
elif [ ${{matrix.benchmark}} == tatp ]; then
491535
ERRORS_THRESHOLD=0.05
536+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
537+
ERRORS_THRESHOLD=0.02
538+
results_benchmark=tpcc
492539
fi
493540
./scripts/check_latest_benchmark_results.sh $results_benchmark
494541
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD
@@ -503,7 +550,7 @@ jobs:
503550
fail-fast: false
504551
matrix:
505552
# TODO: add auctionmark and seats benchmark
506-
benchmark: [ 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'sibench', 'smallbank', 'tatp', 'tpcc', 'templated', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
553+
benchmark: [ 'epinions', 'hyadapt', 'noop', 'otmetrics', 'resourcestresser', 'sibench', 'smallbank', 'tatp', 'templated', 'tpcc', 'tpcc-with-reconnects', 'tpch', 'twitter', 'voter', 'wikipedia', 'ycsb' ]
507554
services:
508555
sqlserver:
509556
image: mcr.microsoft.com/mssql/server:latest
@@ -569,6 +616,11 @@ jobs:
569616
if [[ ${{matrix.benchmark}} == templated ]]; then
570617
java -jar benchbase.jar -b tpcc -c config/sqlserver/sample_tpcc_config.xml --create=true --load=true --execute=false --json-histograms results/histograms.json
571618
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/sqlserver/sample_${{matrix.benchmark}}_config.xml --create=false --load=false --execute=true --json-histograms results/histograms.json
619+
elif [[ ${{matrix.benchmark}} == tpcc-with-reconnects ]]; then
620+
# See Also: WITH_SERVICE_INTERRUPTIONS=true docker/build-run-benchmark-with-docker.sh
621+
java -jar benchbase.jar -b tpcc -c config/sqlserver/sample_tpcc_config.xml --create=true --load=true
622+
(sleep 10 && ./scripts/interrupt-docker-db-service.sh sqlserver) &
623+
java -jar benchbase.jar -b tpcc -c config/sqlserver/sample_tpcc_config.xml --execute=true --json-histograms results/histograms.json
572624
else
573625
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/sqlserver/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true --json-histograms results/histograms.json
574626
fi
@@ -577,6 +629,9 @@ jobs:
577629
results_benchmark=${{matrix.benchmark}}
578630
if [ ${{matrix.benchmark}} == tatp ]; then
579631
ERRORS_THRESHOLD=0.05
632+
elif [ ${{matrix.benchmark}} == tpcc-with-reconnects ]; then
633+
ERRORS_THRESHOLD=0.02
634+
results_benchmark=tpcc
580635
fi
581636
./scripts/check_latest_benchmark_results.sh $results_benchmark
582637
./scripts/check_histogram_results.sh results/histograms.json $ERRORS_THRESHOLD

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"**/target": true
44
},
55
"java.format.settings.profile": "GoogleStyle",
6-
"java.format.enabled": true
6+
"java.format.enabled": true,
7+
"editor.formatOnSaveMode": "modificationsIfAvailable"
78
}

config/cockroachdb/sample_auctionmark_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=auctionmark&amp;reWriteBatchedInserts=true</url>
88
<username>root</username>
99
<password></password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1112
<batchsize>128</batchsize>
1213
<retries>4</retries>

config/cockroachdb/sample_chbenchmark_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=chbenchmark-mixed&amp;reWriteBatchedInserts=true</url>
88
<username>root</username>
99
<password></password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1112
<batchsize>128</batchsize>
1213

config/cockroachdb/sample_epinions_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=epinions&amp;reWriteBatchedInserts=true</url>
88
<username>root</username>
99
<password></password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1112
<batchsize>128</batchsize>
1213

config/cockroachdb/sample_hyadapt_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=hyadapt&amp;reWriteBatchedInserts=true</url>
77
<username>root</username>
88
<password></password>
9+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
910
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1011
<batchsize>128</batchsize>
1112

config/cockroachdb/sample_noop_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=noop&amp;reWriteBatchedInserts=true</url>
88
<username>root</username>
99
<password></password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1112
<batchsize>128</batchsize>
1213

config/cockroachdb/sample_otmetrics_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=otmetrics&amp;reWriteBatchedInserts=true</url>
88
<username>admin</username>
99
<password>password</password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<retries>4</retries>
1112

1213
<batchsize>2048</batchsize>

config/cockroachdb/sample_resourcestresser_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<url>jdbc:postgresql://localhost:26257/benchbase?sslmode=disable&amp;ApplicationName=resourcestresser&amp;reWriteBatchedInserts=true</url>
88
<username>root</username>
99
<password></password>
10+
<reconnectOnConnectionFailure>true</reconnectOnConnectionFailure>
1011
<isolation>TRANSACTION_SERIALIZABLE</isolation>
1112
<batchsize>128</batchsize>
1213

0 commit comments

Comments
 (0)