mrhhsg opened a new pull request, #70944:
URL: https://github.com/apache/doris/pull/70944

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #70876 (backport to `branch-4.1`)
   
   Problem Summary:
   
   FE initializes `spill_aggregation_sink_mem_limit_bytes` to 64 GiB instead of 
the protocol default of 64 MiB, so BE silently caps the value at 4 GiB. Six 
spill settings can also retain out-of-range values in FE, making the displayed, 
forwarded and persisted settings differ from the values used during execution.
   
   This backport corrects the compiled aggregation default and normalizes FE 
values to the bounds already enforced by BE. It does not change BE spill 
algorithms, Thrift fields or absent-field fallbacks.
   
   ### Changes
   
   - Correct `SessionVariable.spillAggregationSinkMemLimitBytes` from 64 GiB to 
64 MiB.
   - Share int/long normalization between `VariableMgr` assignment and 
`SessionVariable` reads. This covers SESSION/GLOBAL assignment, hints and 
restoration, forwarded variables, image/JSON reads, job maps and GLOBAL journal 
replay.
   - Retain `branch-4.1`'s bilingual `VariableMgr.VarAttr` metadata and 
existing APIs; enable forwarding for the aggregation and hash-join partition 
settings.
   - Document the effective ranges and clarify that the aggregation threshold 
applies after aggregation starts spilling. The sort merge budget derives merge 
fan-in; it is not a hard memory limit.
   - Add boundary/default, invalid-number, forwarding and persistence coverage, 
plus a SQL regression with expected output.
   
   ### Configuration and compatibility
   
   | 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 |
   
   Only the aggregation compiled default changes. Parseable out-of-range values 
are clamped to the nearest bound, including the existing BE-effective 
lower-bound behavior of 0 and -1. Non-integer values and numeric overflow still 
fail; unrelated variables are unchanged.
   
   Historical 64 GiB aggregation values normalize to 4 GiB, preserving their 
previous effective threshold rather than replacing them with 64 MiB. Restored 
GLOBAL settings remain authoritative for new connections. The 64 MiB compiled 
default applies without a GLOBAL override, or after an explicit `SET 
spill_aggregation_sink_mem_limit_bytes=DEFAULT` in the session.
   
   This threshold is neither the initial spill trigger nor the query memory 
limit. The lower default may change proactive memory revocation and spill I/O 
frequency; explicitly setting 
`spill_aggregation_sink_mem_limit_bytes=4294967296` retains the previous 
effective threshold.
   
   ### Testing
   
   Local validation of the `branch-4.1` backport:
   
   - `timeout 2400 bash run-fe-ut.sh --run 
org.apache.doris.qe.SessionVariableSpillContractTest,org.apache.doris.qe.VariableMgrTest,org.apache.doris.qe.RuntimeFilterTypeHelperTest`:
 61 tests passed, zero failures/errors/skips.
   - `timeout 2400 bash build.sh --fe -j 16`: passed, including Checkstyle with 
zero violations.
   - `timeout 3600 bash build.sh --be -j 32`: Release build passed.
   - `timeout 1500 ./run-regression-test.sh --conf "$REG_CONF" --run -d 
query_p0/session_variable -s test_spill_session_variable_ranges`: passed, 
comparing all 78 output sections against the unchanged expected output from 
#70876.
   - `timeout 900 ./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 complete backport diff.
   
   `REG_CONF` was an isolated local regression configuration. The native-only 
regression cluster used `enable_java_support=false`; Java UDF/connector paths 
were not exercised. Full CI, BE unit tests, mixed-version upgrades, S3 and 
spill workload performance were not run.
   
   ### Release note
   
   Correct the compiled aggregation spill sink threshold to 64 MiB and make six 
spill settings display and persist the bounded values used by BE. Previously 
saved aggregation values retain their prior effective behavior.
   
   ### Check List (For Author)
   
   - Test:
       - [x] Regression test
       - [x] Unit Test
   - Behavior changed:
       - [x] Yes. FE stores normalized spill values and uses the corrected 
aggregation compiled default; see compatibility details above.
   - Does this need documentation?
       - [x] Yes. The session-variable reference should reflect the ranges and 
corrected aggregation default; no website documentation change is included here.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Backport adaptations and this description; source code/tests 
originated in #70876.
   - 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]

Reply via email to