Commit 0bddd6f
authored
Adding agg_spill_mem parameter. (#22623)
### **User description**
## What type of PR is this?
- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [x] Code Refactoring
## Which issue(s) this PR fixes:
issue #3433
## What this PR does / why we need it:
Try to add a spill mem session var to config spill threshold. right now
it is NOT auto tuned, but this can be done at
either plan time (we know global resource) or run time (we know real
time resource). But later.
___
### **PR Type**
Enhancement
___
### **Description**
- Add `agg_spill_mem` session variable to configure aggregate spill
threshold
- Propagate `agg_spill_mem` from query builder through plan nodes to
runtime operators
- Define memory size constants (KiB, MiB, GiB, TiB, PiB) in common
package
- Update protobuf definitions to include `spill_mem` field in Group and
Node messages
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["Session Variable: agg_spill_mem"] --> B["QueryBuilder"]
B --> C["Plan Nodes"]
C --> D["Protobuf Messages"]
D --> E["Runtime Operators"]
E --> F["Group Operator"]
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>variables.go</strong><dd><code>Register new `agg_spill_mem`
session variable with default 1GiB</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-07649adc637b0268b12ec915ec819f66db3a4e4375bfc77291116bfa06c4432f">+9/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>14
files</summary><table>
<tr>
<td><strong>const.go</strong><dd><code>Add memory size constants (KiB
through PiB)</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-c9fab2e2ba5d60f621f961e17a9e2bc28c84c2aa793b9849af0320188a4121ed">+23/-0</a>
</td>
</tr>
<tr>
<td><strong>types.go</strong><dd><code>Add `aggSpillMem` field to
QueryBuilder struct</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-fd44fd4ef13ca8bef0473460d6b4298a1beb5cd259562bd013e35433af2b80fb">+3/-0</a>
</td>
</tr>
<tr>
<td><strong>query_builder.go</strong><dd><code>Initialize `aggSpillMem`
from session variable in QueryBuilder</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-144e02a38da50867dc021b9254d10a5fd131671cca344c2323337ba2141440f1">+29/-0</a>
</td>
</tr>
<tr>
<td><strong>build_dml_util.go</strong><dd><code>Set `SpillMem` on
aggregate nodes in DML operations</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-095fb233d51021791cb24454839b013236680bbc6bbc22e0d2f6741ac8fe7dff">+3/-0</a>
</td>
</tr>
<tr>
<td><strong>distinct_agg.go</strong><dd><code>Set `SpillMem` on
aggregate nodes for distinct optimization</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-e00897e8cc6b6ff631988a32501af83198e5eece46eedf0b0e0e9771891b2613">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>agg_pushdown_pullup.go</strong><dd><code>Set `SpillMem` on
aggregate nodes during pushdown optimization</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-4a4bc94bc3fc07c48047ca086ea67a57ab19c129f298dc15a8fd0617bd625363">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>opt_misc.go</strong><dd><code>Set `SpillMem` when rewriting
DISTINCT to aggregate</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-2efd240eb857ad87a1ed05754d9d4f908d148b92ace437b07b55e60b9a6b216f">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>build_insert.go</strong><dd><code>Set `SpillMem` on
aggregate nodes in INSERT plans</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-9d0fd08ed4afb7ebd89ebb05190cd8900fd133473e4ef2e795dd5cea28ddce40">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>build_constraint_util.go</strong><dd><code>Set `SpillMem` on
aggregate nodes in constraint plans</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-6eb56175b52eb3302f1d9ae1cde88ced82c25bb8dd90562238cc8d9757adb76b">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>plan.proto</strong><dd><code>Add `spill_mem` field to Node
message definition</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-22bd2bd1e47d7acf42499abc93266a657dfd1a35f32837167470fd926564dfb5">+3/-0</a>
</td>
</tr>
<tr>
<td><strong>pipeline.proto</strong><dd><code>Add `spill_mem` field to
Group message definition</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-e9c91df4d87ffef63693440b86da7db2a8349c550c6c789bcc8e71f3e81309a6">+1/-0</a>
</td>
</tr>
<tr>
<td><strong>types.go</strong><dd><code>Add `SpillMem` field to Group
operator struct</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-8743f0c66efcf26ec44ff685c6f1a8c38e8e9a362dc8adab5a7e39ee4fc715d5">+3/-2</a>
</td>
</tr>
<tr>
<td><strong>operator.go</strong><dd><code>Copy `SpillMem` when
duplicating and constructing Group operators</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-24c2df3f5c8c484aab6845aa35e6426ba672758aea5c19bb680c08eadec260ee">+2/-0</a>
</td>
</tr>
<tr>
<td><strong>remoterun.go</strong><dd><code>Convert `SpillMem` between
pipeline and VM operator representations</code></dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-5b03ee992b77eaa173e65a1858ac49c0006729e6d0180db8f62d51aada29576d">+2/-0</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Bug
fix</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>compiler_context.go</strong><dd><code>Fix return statement
in `GetLowerCaseTableNames` method</code> </dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-2e1e8cbf97f9cd34095a0a6b95d33456cb53dad2c6fec7eb9cd37893b8048b8b">+1/-1</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Additional
files</strong></td><td><details><summary>2 files</summary><table>
<tr>
<td><strong>pipeline.pb.go</strong></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-966f3a64eaa6e8c3a8815332fec622b1e79c9d999ed32198a74e0038c17a25ec">+292/-256</a></td>
</tr>
<tr>
<td><strong>plan.pb.go</strong></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22623/files#diff-33f2cd3e1c50f35dec893cbff56b5ff6cd269b0b239e51463d4c93f7afdab924">+834/-795</a></td>
</tr>
</table></details></td></tr></tr></tbody></table>
</details>
___1 parent 232e202 commit 0bddd6f
File tree
39 files changed
+1876
-1178
lines changed- pkg
- common
- container/types
- fileservice
- frontend
- monlp/llm
- pb
- pipeline
- plan
- sql
- colexec
- group
- preinsertsecondaryindex
- preinsertunique
- compile
- models
- plan
- explain
- function
- util
- vm/process
- proto
39 files changed
+1876
-1178
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
771 | 770 | | |
772 | 771 | | |
773 | 772 | | |
774 | | - | |
775 | 773 | | |
776 | 774 | | |
777 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
| |||
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
56 | | - | |
| 64 | + | |
57 | 65 | | |
58 | 66 | | |
59 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
1218 | 1219 | | |
1219 | 1220 | | |
1220 | 1221 | | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
3801 | 3802 | | |
3802 | 3803 | | |
3803 | 3804 | | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
3804 | 3813 | | |
3805 | 3814 | | |
3806 | 3815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments