Skip to content

Commit 9d14796

Browse files
committed
parallel-workload: Introduce bad queries
1 parent 7ae4ef2 commit 9d14796

File tree

4 files changed

+66
-15
lines changed

4 files changed

+66
-15
lines changed

ci/nightly/pipeline.template.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,8 +1903,20 @@ steps:
19031903
- group: "Parallel Workload"
19041904
key: parallel-workload
19051905
steps:
1906+
- id: parallel-workload-bad-queries
1907+
label: "Parallel Workload + Bad Queries"
1908+
depends_on: build-x86_64
1909+
artifact_paths: [parallel-workload-queries.log.zst]
1910+
timeout_in_minutes: 90
1911+
agents:
1912+
queue: hetzner-x86-64-8cpu-16gb
1913+
plugins:
1914+
- ./ci/plugins/mzcompose:
1915+
composition: parallel-workload
1916+
args: [--runtime=1500, --complexity=bad, --threads=8]
1917+
19061918
- id: parallel-workload-read-only
1907-
label: "Parallel Workload (Read-Only)"
1919+
label: "Parallel Workload + Read-Only"
19081920
depends_on: build-x86_64
19091921
artifact_paths: [parallel-workload-queries.log.zst]
19101922
timeout_in_minutes: 90
@@ -1916,7 +1928,7 @@ steps:
19161928
args: [--runtime=1500, --complexity=read, --threads=8]
19171929

19181930
- id: parallel-workload-dml
1919-
label: "Parallel Workload (DML)"
1931+
label: "Parallel Workload + DML"
19201932
depends_on: build-x86_64
19211933
artifact_paths: [parallel-workload-queries.log.zst]
19221934
timeout_in_minutes: 90
@@ -1928,7 +1940,7 @@ steps:
19281940
args: [--runtime=1500, --complexity=dml, --threads=8]
19291941

19301942
- id: parallel-workload-ddl
1931-
label: "Parallel Workload (DDL)"
1943+
label: "Parallel Workload + DDL"
19321944
depends_on: build-x86_64
19331945
artifact_paths: [parallel-workload-queries.log.zst]
19341946
timeout_in_minutes: 90
@@ -1940,7 +1952,7 @@ steps:
19401952
args: [--runtime=1500, --threads=8]
19411953

19421954
- id: parallel-workload-ddl-only
1943-
label: "Parallel Workload (DDL Only)"
1955+
label: "Parallel Workload + DDL Only"
19441956
depends_on: build-x86_64
19451957
artifact_paths: [parallel-workload-queries.log.zst]
19461958
timeout_in_minutes: 90
@@ -1952,7 +1964,7 @@ steps:
19521964
args: [--runtime=1500, --complexity=ddl-only, --threads=8]
19531965

19541966
- id: parallel-workload-many-threads
1955-
label: "Parallel Workload (many threads)"
1967+
label: "Parallel Workload + many threads"
19561968
depends_on: build-x86_64
19571969
artifact_paths: [parallel-workload-queries.log.zst]
19581970
timeout_in_minutes: 90
@@ -1966,7 +1978,7 @@ steps:
19661978
skip: "Too unstable at the moment"
19671979

19681980
- id: parallel-workload-rename-naughty
1969-
label: "Parallel Workload (rename + naughty identifiers)"
1981+
label: "Parallel Workload + rename + naughty identifiers"
19701982
depends_on: build-x86_64
19711983
artifact_paths: [parallel-workload-queries.log.zst]
19721984
timeout_in_minutes: 90
@@ -1978,7 +1990,7 @@ steps:
19781990
args: [--runtime=1500, --scenario=rename, --naughty-identifiers, --threads=8]
19791991

19801992
- id: parallel-workload-rename
1981-
label: "Parallel Workload (rename)"
1993+
label: "Parallel Workload + rename"
19821994
depends_on: build-x86_64
19831995
artifact_paths: [parallel-workload-queries.log.zst]
19841996
timeout_in_minutes: 90
@@ -1990,7 +2002,7 @@ steps:
19902002
args: [--runtime=1500, --scenario=rename, --threads=8]
19912003

19922004
- id: parallel-workload-cancel
1993-
label: "Parallel Workload (cancel)"
2005+
label: "Parallel Workload + cancel"
19942006
depends_on: build-x86_64
19952007
artifact_paths: [parallel-workload-queries.log.zst]
19962008
timeout_in_minutes: 90
@@ -2002,7 +2014,7 @@ steps:
20022014
args: [--runtime=1500, --scenario=cancel, --threads=8]
20032015

20042016
- id: parallel-workload-kill
2005-
label: "Parallel Workload (kill)"
2017+
label: "Parallel Workload + kill"
20062018
depends_on: build-x86_64
20072019
artifact_paths: [parallel-workload-queries.log.zst]
20082020
timeout_in_minutes: 90
@@ -2014,7 +2026,7 @@ steps:
20142026
args: [--runtime=1500, --scenario=kill, --threads=8]
20152027

20162028
- id: parallel-workload-backup-restore
2017-
label: "Parallel Workload (backup & restore)"
2029+
label: "Parallel Workload + backup & restore"
20182030
depends_on: build-x86_64
20192031
artifact_paths: [parallel-workload-queries.log.zst]
20202032
timeout_in_minutes: 90
@@ -2027,7 +2039,7 @@ steps:
20272039
args: [--runtime=1500, --scenario=backup-restore, --naughty-identifiers, --threads=8]
20282040

20292041
- id: parallel-workload-0dt
2030-
label: "Parallel Workload (0dt deploy)"
2042+
label: "Parallel Workload + 0dt deploy"
20312043
depends_on: build-x86_64
20322044
artifact_paths: [parallel-workload-queries.log.zst]
20332045
timeout_in_minutes: 90

misc/python/materialize/parallel_workload/action.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,31 @@ def run(self, exe: Executor) -> bool:
396396
return True
397397

398398

399+
class BadAction(Action):
400+
keywords: list[str]
401+
objects: list[str]
402+
def __init__(self, rng: random.Random, composition: Composition | None):
403+
super().__init__(rng, composition)
404+
self.keywords = []
405+
with open("src/sql-lexer/src/keywords.txt", "r") as f:
406+
for line in f:
407+
line = line.strip()
408+
if not line or line.startswith("#"):
409+
continue
410+
self.keywords.append(line.upper())
411+
self.objects = []
412+
413+
def errors_to_ignore(self, exe: Executor) -> list[str]:
414+
# TODO: Ignore all errors except internal errors
415+
result = super().errors_to_ignore(exe)
416+
return result
417+
418+
def run(self, exe: Executor) -> bool:
419+
420+
exe.execute(query, explainable=True, http=Http.RANDOM, fetch=True)
421+
return True
422+
423+
399424
class SelectOneAction(Action):
400425
def run(self, exe: Executor) -> bool:
401426
exe.execute("SELECT 1", explainable=True, http=Http.RANDOM, fetch=True)
@@ -2781,10 +2806,19 @@ def __init__(
27812806
autocommit=True,
27822807
)
27832808

2809+
# TODO: Should we have some "bad" actions in all scenarios or keep it isolated in one?
2810+
bad_action_list = ActionList(
2811+
[
2812+
(BadAction, 100),
2813+
],
2814+
autocommit=True,
2815+
)
2816+
27842817
action_lists = [
27852818
read_action_list,
27862819
fetch_action_list,
27872820
write_action_list,
27882821
dml_nontrans_action_list,
27892822
ddl_action_list,
2823+
bad_action_list,
27902824
]

misc/python/materialize/parallel_workload/parallel_workload.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
ZeroDowntimeDeployAction,
3333
action_lists,
3434
ddl_action_list,
35+
bad_action_list,
3536
dml_nontrans_action_list,
3637
fetch_action_list,
3738
read_action_list,
@@ -166,13 +167,15 @@ def run(
166167
for i in range(num_threads):
167168
weights: list[float]
168169
if complexity == Complexity.DDL:
169-
weights = [60, 30, 30, 30, 100]
170+
weights = [60, 30, 30, 30, 100, 0]
170171
elif complexity == Complexity.DML:
171-
weights = [60, 30, 30, 30, 0]
172+
weights = [60, 30, 30, 30, 0, 0]
172173
elif complexity == Complexity.Read:
173-
weights = [60, 30, 0, 0, 0]
174+
weights = [60, 30, 0, 0, 0, 0]
174175
elif complexity == Complexity.DDLOnly:
175-
weights = [0, 0, 0, 0, 100]
176+
weights = [0, 0, 0, 0, 100, 0]
177+
elif complexity == Complexity.Bad:
178+
weights = [0, 0, 0, 0, 0, 100]
176179
else:
177180
raise ValueError(f"Unknown complexity {complexity}")
178181
worker_rng = random.Random(rng.randrange(SEED_RANGE))
@@ -183,6 +186,7 @@ def run(
183186
write_action_list,
184187
dml_nontrans_action_list,
185188
ddl_action_list,
189+
bad_action_list,
186190
],
187191
weights,
188192
)[0]

misc/python/materialize/parallel_workload/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313

1414
class Complexity(Enum):
15+
Bad = "bad"
1516
Read = "read"
1617
DML = "dml"
1718
DDL = "ddl"

0 commit comments

Comments
 (0)