linrrzqqq opened a new pull request, #70907:
URL: https://github.com/apache/doris/pull/70907
### Background
In Doris, FE session variables are validated in `VariableMgr` via `checker`
methods and stored on `SessionVariable` or rewritten through `setter` callbacks
before being consumed by FE planners, Hive/BE Thrift options, and query-result
hashes. Static and mutable FE configurations in `Config` are validated during
startup by `ConfigBase.setFields()` and at runtime via
`ConfigBase.setMutableConfig()` handlers such as `OptionsConfHandler`, while BE
startup flags, HTTP load headers, and node role heartbeats are parsed in C++
utilities under `be/src/`.
### What problem does this PR solve?
Issue Number: None
Related PR: None
PR Type: Bugfix
Problem Summary:
Several Doris session variables, FE `Config` options, BE `config` flags, and
HTTP load headers either accepted any letter case during validation and
silently broke downstream exact-match comparisons, or rejected valid
uppercase/lowercase spellings outright. For example, `SET serde_dialect =
"PRESTO"` passed `checkSerdeDialect` (`equalsIgnoreCase`) and stored
`"PRESTO"`, after which `SessionVariable.getSerdeDialect()` threw
`IllegalArgumentException: Unknown serde dialect: PRESTO`; likewise `SET
block_encryption_mode = "aes_256_cbc"` stored lowercase and failed in Nereids
crypto functions with `AnalysisException`. This fix normalizes each affected
option at its setter, callback, config handler, or consumer boundary so all
letter cases behave identically.
### Details
- **Change map:** 41 files (+724 / -135 lines): 21 FE production files (+223
/ -90), 9 BE production files (+130 / -42), and 11 unit/regression test files
and `.out` data files (+371 / -3).
- FE session variables & planners: normalize `sql_dialect`,
`serde_dialect`, `block_encryption_mode`,
`pre_materialized_view_rewrite_strategy`, `force_sort_algorithm`, `"random"` in
`file_cache_base_path` (preserving directory path case),
`hive_text_compression` (including `"uncompressed"` -> `"plain"`),
`enable_sql_convertor_features`, `mongodb_read_concern`, `group_commit`,
case-insensitive `ignore_shape_nodes` / `detail_shape_nodes`, `trace_id` key
lookup in `session_context`, `Config.fuzzy_test_type` checks, and
derived-variable / JSON / forward refresh.
- FE configs & node role tags: bind `OptionsConfHandler` to
`sys_log_roll_interval`, `audit_log_roll_interval`, `default_compression_type`
(`DEFAULT_COMPRESSION` -> `LZ4F`), and `cloud_warm_up_for_rebalance_type`; add
`LowerCaseConfHandler` for `fuzzy_test_type` (`p0`, `p1`, `daily`, `rqg`,
`external`, and empty clear override); normalize `Tag.TYPE_ROLE` across `Tag`,
`Backend`, and `HeartbeatMgr`.
- BE configs, HTTP load headers, & stack trace cache: normalize
`group_commit` HTTP headers (`http_stream.cpp`, `stream_load.cpp`), validate
`be_node_role` and `memory_mode` case-insensitively and normalize `hb` node
role (`config.cpp`, `daemon.cpp`, `heartbeat_server.cpp`), case-insensitive
`"random"` in `FileFactory::get_reader_options`, case-insensitive
`sys_log_roll_mode` parsing (`logconfig.h`, `logconfig.cpp`), and lowercase
cache keys for `dwarf_location_info_mode` in `stack_trace.cpp`.
- **Frequency:** Always triggers whenever a caller configures or passes one
of the affected session variables, configs, or load headers in a non-canonical
letter case.
- **Root cause:** Validation helpers used `equalsIgnoreCase` or enum/string
lookup independently from storage and downstream consumers (`switch`
statements, `Map`/hash computations, `Enum.valueOf`, BE `==` string checks, or
`OptionsConfHandler` gaps), leaving non-canonical spellings unnormalized or
rejected.
- **Why existing tests missed it:** Existing unit tests
(`SessionVariableBackendSelectionTest`, `SessionVariableMongoReadPolicyTest`,
`FlightSessionOptionsTest`, `VariableMgrTest`, `ConfigTest`,
`HiveConnectorMetadataDdlTest`, `HiveWritePlanProviderTest`, `LogConfigTest`,
`ConfigValidatorTest`) and P0 regression suites
(`datatype_p0/serde/test_serde_dialect.groovy` and
`query_p0/sql_functions/encryption_digest/test_encryption_function.groovy`)
only exercised one fixed letter case for each option (or asserted `"LOCAL"`
staying uppercase in `SessionVariableMongoReadPolicyTest`).
- **Fix:** Canonicalize inputs at setter, config-handler, and
`refreshDerivedSessionVariables()` boundaries using `Locale.ROOT` while keeping
consumer comparisons (`equalsIgnoreCase`, BE `iequal` / `to_lower`) defensive,
preserving filesystem path case for `file_cache_base_path`, preserving
`trace_id` value case, and normalizing stack trace cache keys.
- **Other paths and branches:** Checked FE `SessionVariable` setters,
JSON/forward restore (`refreshDerivedSessionVariables`), FE
`Config`/`OptionsConfHandler`/`LowerCaseConfHandler`, FE/BE
`Tag`/`HeartbeatMgr`/`Backend` role handling, Hive text compression resolution,
Nereids planner/crypto/pre-MV paths, `SortNode`,
`StreamLoadHandler`/`FrontendServiceImpl`, and BE
`file_factory.cpp`/`http_stream.cpp`/`stream_load.cpp`/`config.cpp`/`daemon.cpp`/`logconfig.cpp`/`stack_trace.cpp`.
`file_cache_base_path` intentionally keeps case sensitivity for directory
paths; `trace_id` values keep original case. Release branches older than
`master` were not checked in this worktree.
- **Behavior change:** Case-normalized storage means callers reading
`mongodb_read_concern`, `sql_dialect`, `serde_dialect`,
`block_encryption_mode`, `force_sort_algorithm`, `hive_text_compression`,
`group_commit`, `Tag` role values, and canonicalized FE `Config` fields observe
canonical lowercase or uppercase values rather than raw mixed case, and invalid
values for `sys_log_roll_interval`, `audit_log_roll_interval`,
`default_compression_type`, `fuzzy_test_type`,
`cloud_warm_up_for_rebalance_type`, BE `memory_mode`, and `be_node_role` are
now rejected earlier during loading/validation.
### Testing
All checks ran locally in the `doris-param-case` worktree (`master` base):
- Baseline-RED before FE fixes (`run-fe-ut.sh --run
org.apache.doris.qe.SessionVariableCaseInsensitiveTest`): `Tests run: 14,
Failures: 12, Errors: 2`.
- Post-fix FE UTs (`run-fe-ut.sh --run` across `ConfigTest` (19),
`HiveWritePlanProviderTest` (33), `HiveConnectorMetadataDdlTest` (24),
`FlightSessionOptionsTest` (15), `SessionVariableBackendSelectionTest` (13),
`SessionVariableMongoReadPolicyTest` (3), `SessionVariableCaseInsensitiveTest`
(15), `VariableMgrTest` (19)): all 141 tests passed (`Failures: 0, Errors: 0`);
after the final polish, `ConfigTest` (19) and
`SessionVariableCaseInsensitiveTest` (15) re-ran and passed, and `fe-common` +
`fe-core` Checkstyle reported 0 violations.
- BE UTs (`./run-be-ut.sh --run
"--filter=LogConfigTest.*:ConfigValidatorTest.*" -j50 --coverage`): 10 tests
passed (`failures=0`, `errors=0`).
- Full ASAN build & static checks: `sh build.sh -t doris-param-case`, `bash
build-support/check-build-hygiene.sh`, `clang-format --style=file` diff checks
on edited C++ files, and `bash build-support/run-clang-tidy.sh`
(`be/build_ASAN`, `be/ut_build_ASAN`, and `be/src/common/logconfig.h`) all
passed cleanly.
- P0 regression suites on started single-node FE/BE cluster:
`./run-regression-test.sh --run -f datatype_p0/serde/test_serde_dialect.groovy`
and `./run-regression-test.sh --run -f
query_p0/sql_functions/encryption_digest/test_encryption_function.groovy`
passed (`Test 1 suites, failed 0 suites, fatal 0 scripts`).
### Notes for Reviewers
- `be/src/common/logconfig.h` isolates `parse_sys_log_roll_mode` instead of
adding it to the widely included `be/src/common/logging.h` hub header so BE
header hygiene checks stay clean and rebuild fan-out stays minimal.
- `SessionVariableMongoReadPolicyTest` was updated from expecting `"LOCAL"`
to `"local"` after normalizing `mongodb_read_concern` in
`SessionVariable.setMongoDBReadConcern`.
### Release note
Session variables (`sql_dialect`, `serde_dialect`, `block_encryption_mode`,
`pre_materialized_view_rewrite_strategy`, `force_sort_algorithm`,
`file_cache_base_path`, `hive_text_compression`,
`enable_sql_convertor_features`, `ignore_shape_nodes`, `detail_shape_nodes`,
`mongodb_read_concern`, `session_context` trace key), FE configurations
(`sys_log_roll_interval`, `audit_log_roll_interval`,
`default_compression_type`, `fuzzy_test_type`,
`cloud_warm_up_for_rebalance_type`), BE configurations (`be_node_role`,
`memory_mode`, `sys_log_roll_mode`, `dwarf_location_info_mode`), and
`group_commit` HTTP load headers now accept and normalize values
case-insensitively.
### Check List (For Author)
- Behavior changed: Yes (see Details)
- Does this need documentation: No
- Pre-submission status: Ready
### AI Disclosure
- Tool: Codex (`gpt-6.2-sol`)
- Generated: Production fixes, unit tests, regression additions, and
commit/PR description draft
- Human review: Pending author review before opening PR
--
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]