Skip to content

Commit a2b505f

Browse files
bpkrothjcamachor
authored andcommitted
Adding tests for MSSQL in Github actions (TPC-C and TPC-H)
* Adds Github Actions CI support via the SqlServer Docker image. * Adds other docker run support. * Adds a column store based schema creation command in addition to the row store one, and a symlink to chose between them (defaulting to cstore).
1 parent 823ee1b commit a2b505f

File tree

10 files changed

+421
-137
lines changed

10 files changed

+421
-137
lines changed

.github/workflows/maven.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
runs-on: ubuntu-latest
4343
strategy:
4444
matrix:
45-
profile: [ 'cockroachdb', 'mariadb', 'mysql', 'postgres', 'spanner', 'phoenix' ]
45+
profile: [ 'cockroachdb', 'mariadb', 'mysql', 'postgres', 'spanner', 'phoenix', 'sqlserver' ]
4646
steps:
4747
- name: Checkout repo
4848
uses: actions/checkout@v2
@@ -243,3 +243,66 @@ jobs:
243243
- name: Run benchmark
244244
run: |
245245
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/cockroachdb/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true
246+
247+
sqlserver:
248+
needs: package-and-upload
249+
runs-on: ubuntu-latest
250+
strategy:
251+
matrix:
252+
# TODO: add more benchmarks
253+
benchmark: [ 'tpcc', 'tpch' ]
254+
services:
255+
sqlserver:
256+
image: mcr.microsoft.com/mssql/server:2019-latest
257+
env:
258+
ACCEPT_EULA: Y
259+
SA_PASSWORD: SApassword1
260+
options: >-
261+
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P SApassword1 -b -Q 'SELECT 1;'"
262+
--health-interval 10s
263+
--health-timeout 5s
264+
--health-retries 5
265+
ports:
266+
- 1433:1433
267+
steps:
268+
- name: Download artifact
269+
uses: actions/download-artifact@v2
270+
with:
271+
name: benchbase-sqlserver
272+
273+
- name: Extract artifact
274+
run: |
275+
tar xvzf benchbase-sqlserver.tgz --strip-components=1
276+
277+
- name: Delete artifact
278+
run: |
279+
rm -rf benchbase-sqlserver.tgz
280+
281+
- name: Set up JDK
282+
uses: actions/setup-java@v2
283+
with:
284+
java-version: ${{env.JAVA_VERSION}}
285+
distribution: 'temurin'
286+
287+
- name: Setup database
288+
uses: docker://mcr.microsoft.com/mssql-tools:latest
289+
with:
290+
entrypoint: /opt/mssql-tools/bin/sqlcmd
291+
args: -U sa -P SApassword1 -S sqlserver -b -Q "CREATE DATABASE benchbase_${{ matrix.benchmark }};"
292+
293+
- name: Setup login
294+
uses: docker://mcr.microsoft.com/mssql-tools:latest
295+
with:
296+
entrypoint: /opt/mssql-tools/bin/sqlcmd
297+
args: -U sa -P SApassword1 -S sqlserver -Q "CREATE LOGIN benchuser01 WITH PASSWORD='P@ssw0rd';"
298+
299+
- name: Setup access
300+
uses: docker://mcr.microsoft.com/mssql-tools:latest
301+
with:
302+
entrypoint: /opt/mssql-tools/bin/sqlcmd
303+
args: -U sa -P SApassword1 -S sqlserver -b -Q "USE benchbase_${{ matrix.benchmark }}; CREATE USER benchuser01 FROM LOGIN benchuser01; EXEC sp_addrolemember 'db_owner', 'benchuser01';"
304+
305+
- name: Run benchmark
306+
# Note: user/pass should match those used in sample configs.
307+
run: |
308+
java -jar benchbase.jar -b ${{matrix.benchmark}} -c config/sqlserver/sample_${{matrix.benchmark}}_config.xml --create=true --load=true --execute=true
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0"?>
2+
<parameters>
3+
4+
<!-- Connection details -->
5+
<type>sqlserver</type>
6+
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
7+
<url>jdbc:sqlserver://localhost:1433;encrypt=false;database=benchbase_tpcc;</url>
8+
<username>benchuser01</username>
9+
<password>P@ssw0rd</password>
10+
<isolation>TRANSACTION_SERIALIZABLE</isolation>
11+
<batchsize>128</batchsize>
12+
13+
<!-- Scale factor is the number of warehouses in TPCC -->
14+
<scalefactor>1</scalefactor>
15+
16+
<!-- The workload -->
17+
<terminals>1</terminals>
18+
<works>
19+
<work>
20+
<time>60</time>
21+
<rate>10000</rate>
22+
<weights>45,43,4,4,4</weights>
23+
</work>
24+
</works>
25+
26+
<!-- TPCC specific -->
27+
<transactiontypes>
28+
<transactiontype>
29+
<name>NewOrder</name>
30+
<!--<preExecutionWait>18000</preExecutionWait>-->
31+
<!--<postExecutionWait>12000</postExecutionWait>-->
32+
</transactiontype>
33+
<transactiontype>
34+
<name>Payment</name>
35+
<!--<preExecutionWait>3000</preExecutionWait>-->
36+
<!--<postExecutionWait>12000</postExecutionWait>-->
37+
</transactiontype>
38+
<transactiontype>
39+
<name>OrderStatus</name>
40+
<!--<preExecutionWait>2000</preExecutionWait>-->
41+
<!--<postExecutionWait>10000</postExecutionWait>-->
42+
</transactiontype>
43+
<transactiontype>
44+
<name>Delivery</name>
45+
<!--<preExecutionWait>2000</preExecutionWait>-->
46+
<!--<postExecutionWait>5000</postExecutionWait>-->
47+
</transactiontype>
48+
<transactiontype>
49+
<name>StockLevel</name>
50+
<!--<preExecutionWait>2000</preExecutionWait>-->
51+
<!--<postExecutionWait>5000</postExecutionWait>-->
52+
</transactiontype>
53+
</transactiontypes>
54+
</parameters>

config/sqlserver/sample_tpch_config.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<parameters>
33

44
<!-- Connection details -->
5-
<type>SQLSERVER</type>
5+
<type>sqlserver</type>
66
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
7-
<url>jdbc:sqlserver://localhost:1433;encrypt=false;</url>
7+
<url>jdbc:sqlserver://localhost:1433;encrypt=false;database=benchbase_tpch;</url>
88
<username>benchuser01</username>
99
<password>P@ssw0rd</password>
1010
<isolation>TRANSACTION_SERIALIZABLE</isolation>
11-
<batchsize>128</batchsize>
11+
<batchsize>1024</batchsize>
1212

1313
<scalefactor>0.1</scalefactor>
1414

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3.5'
2+
3+
services:
4+
5+
sqlserver:
6+
container_name: sqlserver
7+
hostname: sqlserver
8+
image: mcr.microsoft.com/mssql/server:2019-latest
9+
environment:
10+
ACCEPT_EULA: Y
11+
SA_PASSWORD: SApassword1
12+
ports:
13+
- "1433:1433"
14+
15+
# No sqlserver web UI provided for now.
16+
# See Also: Azure Data Studio
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker compose down --remove-orphans --volumes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker system prune -a -f --volumes

docker/sqlserver-2019-latest/up.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker compose up -d
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
-- Adapted from the Postgres schema
2+
DROP TABLE IF EXISTS lineitem;
3+
DROP TABLE IF EXISTS orders;
4+
DROP TABLE IF EXISTS customer;
5+
DROP TABLE IF EXISTS partsupp;
6+
DROP TABLE IF EXISTS part;
7+
DROP TABLE IF EXISTS supplier;
8+
DROP TABLE IF EXISTS nation;
9+
DROP TABLE IF EXISTS region;
10+
11+
CREATE TABLE region (
12+
r_regionkey integer NOT NULL,
13+
r_name char(25) NOT NULL,
14+
r_comment varchar(152),
15+
INDEX region_cstore CLUSTERED COLUMNSTORE,
16+
-- PRIMARY KEY (r_regionkey),
17+
INDEX r_rk UNIQUE (r_regionkey ASC),
18+
);
19+
20+
CREATE TABLE nation (
21+
n_nationkey integer NOT NULL,
22+
n_name char(25) NOT NULL,
23+
n_regionkey integer NOT NULL,
24+
n_comment varchar(152),
25+
INDEX nation_cstore CLUSTERED COLUMNSTORE,
26+
-- PRIMARY KEY (n_nationkey),
27+
INDEX n_nk UNIQUE (n_nationkey ASC),
28+
INDEX n_rk (n_regionkey ASC),
29+
FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)
30+
);
31+
32+
CREATE TABLE part (
33+
p_partkey integer NOT NULL,
34+
p_name varchar(55) NOT NULL,
35+
p_mfgr char(25) NOT NULL,
36+
p_brand char(10) NOT NULL,
37+
p_type varchar(25) NOT NULL,
38+
p_size integer NOT NULL,
39+
p_container char(10) NOT NULL,
40+
p_retailprice decimal(15, 2) NOT NULL,
41+
p_comment varchar(23) NOT NULL,
42+
INDEX part_cstore CLUSTERED COLUMNSTORE,
43+
-- PRIMARY KEY (p_partkey)
44+
INDEX p_pk UNIQUE (p_partkey ASC)
45+
);
46+
47+
CREATE TABLE supplier (
48+
s_suppkey integer NOT NULL,
49+
s_name char(25) NOT NULL,
50+
s_address varchar(40) NOT NULL,
51+
s_nationkey integer NOT NULL,
52+
s_phone char(15) NOT NULL,
53+
s_acctbal decimal(15, 2) NOT NULL,
54+
s_comment varchar(101) NOT NULL,
55+
INDEX supplier_cstore CLUSTERED COLUMNSTORE,
56+
-- PRIMARY KEY (s_suppkey),
57+
INDEX s_sk UNIQUE (s_suppkey ASC),
58+
INDEX s_nk (s_nationkey ASC),
59+
FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)
60+
);
61+
62+
CREATE TABLE partsupp (
63+
ps_partkey integer NOT NULL,
64+
ps_suppkey integer NOT NULL,
65+
ps_availqty integer NOT NULL,
66+
ps_supplycost decimal(15, 2) NOT NULL,
67+
ps_comment varchar(199) NOT NULL,
68+
INDEX partsupp_cstore CLUSTERED COLUMNSTORE,
69+
-- PRIMARY KEY (ps_partkey, ps_suppkey),
70+
INDEX ps_pk (ps_partkey ASC),
71+
INDEX ps_sk (ps_suppkey ASC),
72+
INDEX ps_pk_sk UNIQUE (ps_partkey ASC, ps_suppkey ASC),
73+
INDEX ps_sk_pk UNIQUE (ps_suppkey ASC, ps_partkey ASC),
74+
FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),
75+
FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)
76+
);
77+
78+
CREATE TABLE customer (
79+
c_custkey integer NOT NULL,
80+
c_name varchar(25) NOT NULL,
81+
c_address varchar(40) NOT NULL,
82+
c_nationkey integer NOT NULL,
83+
c_phone char(15) NOT NULL,
84+
c_acctbal decimal(15, 2) NOT NULL,
85+
c_mktsegment char(10) NOT NULL,
86+
c_comment varchar(117) NOT NULL,
87+
INDEX customer_cstore CLUSTERED COLUMNSTORE,
88+
-- PRIMARY KEY (c_custkey),
89+
INDEX c_ck UNIQUE (c_custkey ASC),
90+
INDEX c_nk (c_nationkey ASC),
91+
FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)
92+
);
93+
94+
CREATE TABLE orders (
95+
o_orderkey integer NOT NULL,
96+
o_custkey integer NOT NULL,
97+
o_orderstatus char(1) NOT NULL,
98+
o_totalprice decimal(15, 2) NOT NULL,
99+
o_orderdate date NOT NULL,
100+
o_orderpriority char(15) NOT NULL,
101+
o_clerk char(15) NOT NULL,
102+
o_shippriority integer NOT NULL,
103+
o_comment varchar(79) NOT NULL,
104+
INDEX o_orderdate_idx CLUSTERED COLUMNSTORE,
105+
-- PRIMARY KEY (o_orderkey),
106+
INDEX o_ok UNIQUE (o_orderkey ASC),
107+
INDEX o_ck (o_custkey ASC),
108+
INDEX o_od (o_orderdate ASC),
109+
FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)
110+
);
111+
112+
CREATE TABLE lineitem (
113+
l_orderkey integer NOT NULL,
114+
l_partkey integer NOT NULL,
115+
l_suppkey integer NOT NULL,
116+
l_linenumber integer NOT NULL,
117+
l_quantity decimal(15, 2) NOT NULL,
118+
l_extendedprice decimal(15, 2) NOT NULL,
119+
l_discount decimal(15, 2) NOT NULL,
120+
l_tax decimal(15, 2) NOT NULL,
121+
l_returnflag char(1) NOT NULL,
122+
l_linestatus char(1) NOT NULL,
123+
l_shipdate date NOT NULL,
124+
l_commitdate date NOT NULL,
125+
l_receiptdate date NOT NULL,
126+
l_shipinstruct char(25) NOT NULL,
127+
l_shipmode char(10) NOT NULL,
128+
l_comment varchar(44) NOT NULL,
129+
INDEX l_shipdate_idx CLUSTERED COLUMNSTORE,
130+
-- PRIMARY KEY (l_orderkey, l_linenumber),
131+
INDEX l_ok (l_orderkey ASC),
132+
INDEX l_pk (l_partkey ASC),
133+
INDEX l_sk (l_suppkey ASC),
134+
INDEX l_sd (l_shipdate ASC),
135+
INDEX l_cd (l_commitdate ASC),
136+
INDEX l_rd (l_receiptdate ASC),
137+
INDEX l_pk_sk (l_partkey ASC, l_suppkey ASC),
138+
INDEX l_sk_pk (l_suppkey ASC, l_partkey ASC),
139+
FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),
140+
FOREIGN KEY (l_partkey, l_suppkey) REFERENCES partsupp (ps_partkey, ps_suppkey)
141+
);

0 commit comments

Comments
 (0)