mrhhsg opened a new pull request, #70876: URL: https://github.com/apache/doris/pull/70876
### Background Doris FE stores spill session variables and explicitly sends them to BE in query options. BE bounds several of these options before spill operators use them. The aggregation sink threshold controls proactive memory revocation after aggregation has started spilling. ### What problem does this PR solve? Issue Number: None Related PR: #61212 (introduced the aggregation default mismatch) PR Type: Bugfix Problem Summary: FE initializes the aggregation spill sink threshold to 64 GiB instead of the protocol's 64 MiB, so BE silently caps it at 4 GiB. Six spill settings also retain out-of-range values in FE, making displayed and persisted values differ from execution. Restore the compiled aggregation default to 64 MiB and normalize FE assignments and historical reads to the existing BE ranges. Most of the diff is boundary and compatibility coverage. For the constructor's `spillAggregationSinkMemLimitBytes` value, the default-value test observes: | Before | After | |---|---| | 68719476736 (64 GiB) | 67108864 (64 MiB) | ### Details - **Change map:** Production code: +41/-13 in two FE files; tests: +309/-0; generated expected output: +234/-0; docs: 0. Production changes correct the default/descriptions and share normalization across assignment and deserialization. - **Frequency:** Always for the compiled aggregation default and parseable out-of-range values of the six settings. - **Root cause:** `SessionVariable` has an extra factor of 1024 in the aggregation initializer. FE storage paths omit the bounds already enforced by `RuntimeState` getters. - **Why existing tests missed it:** Unit tests in `VariableMgrTest` covered generic assignment/persistence, not spill defaults or effective ranges. The `aggregate_spill` regression checked query results, not configuration values or historical oversized settings. - **Fix:** Normalize three int and three long settings at FE storage boundaries, including SQL/GLOBAL, hints, forwarding, image JSON, job maps and journal replay. Preserve numeric parse failures and unrelated variables. - **Other paths and branches:** Historical and forwarded values use the same normalization. BE algorithms, Thrift fields and absent-field fallbacks are unchanged. #61212 introduced the initializer mismatch. Only master was validated; release branches were not assessed. - **Configs and defaults:** Existing variables remain runtime-settable through SESSION/GLOBAL and hints. Bounds and compiled defaults are below; only the aggregation default changes. For these six settings, 0 and -1 retain their existing BE-effective lower-bound behavior. | Variable | Inclusive range | Compiled default | |---|---|---| | `spill_hash_join_partition_count` | [2, 32] | 4 | | `spill_aggregation_partition_count` | [2, 32] | 4 | | `spill_repartition_max_depth` | [1, 128] | 8 | | `spill_buffer_size_bytes` | [1 MiB, 256 MiB] | 8 MiB | | `spill_aggregation_sink_mem_limit_bytes` | [1 MiB, 4 GiB] | 64 MiB | | `spill_sort_merge_mem_limit_bytes` | [1 MiB, 4 GiB] | 64 MiB | - **Behavior change:** FE displays and persists normalized values. Historical 64 GiB aggregation values become 4 GiB, preserving their prior effective value. The 64 MiB default applies without a restored GLOBAL override or after explicit `SET spill_aggregation_sink_mem_limit_bytes=DEFAULT`; new and reset connections still inherit GLOBAL settings. This is not an initial spill trigger or query memory limit. The lower default may change revocation and spill I/O frequency; explicitly setting 4294967296 retains the old effective threshold. ### Testing All runs below were local: - Baseline `SessionVariableSpillContractTest`: 34 tests, 22 assertion failures, 0 errors. After the fix, all 34 pass. - `bash run-fe-ut.sh --run org.apache.doris.qe.SessionVariableSpillContractTest,org.apache.doris.qe.VariableMgrTest,org.apache.doris.qe.SessionVariableParallelismTest`: 61 tests passed, no failures/errors/skips. - `DISABLE_JAVA_CHECK_STYLE=OFF bash build.sh --fe -j 16`: passed, 0 Checkstyle violations. - `bash build.sh --be -j 24`: ASAN build passed. - `./run-regression-test.sh --conf "$REG_CONF" --run -d query_p0/session_variable -s test_spill_session_variable_ranges`: passed using an isolated local config, after runner generation with `-forceGenOut` and independent verification of all 78 output sections. - `./run-regression-test.sh --conf "$REG_CONF" --run -d spill_p0 -s aggregate_spill`: passed as a compatibility smoke test, not a threshold-performance test. - `git diff --check`: passed for the committed diff. ### Release note The compiled aggregation spill sink threshold is corrected to 64 MiB. Six spill settings now display and persist the bounded values used by BE. Existing saved aggregation values retain their prior effective behavior, and restored GLOBAL settings remain authoritative for new connections. ### Check List (For Author) - Behavior changed: Yes (see Details) - Does this need documentation: Yes (update the session-variable reference in apache/doris-website with the ranges and aggregation default). - Pre-submission status: Partially verified: full CI, BE unit tests, mixed-version upgrades, S3 and spill workload performance were not run. ### AI Disclosure - Tool: Codex - Generated: Code, tests, and this description. - Human review: No human review is claimed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
