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

   
   
   ### Background
   
   Eight `INVISIBLE` session variables override omitted `VARIANT` column 
properties (`max_subcolumns_count`, `enable_typed_paths_to_sparse`, 
`max_sparse_column_statistics_size`, `sparse_hash_shard_count`, 
`enable_doc_mode`, `doc_materialization_min_rows`, `doc_hash_shard_count`, 
`enable_nested_group`) during DDL parsing. PR #70501 made them test-only: their 
checker rejects `SET` unless `enable_debug_points` is enabled, and 
`LogicalPlanBuilder` reads them only when `enable_debug_points` is enabled.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70501 (made the variables test-only)
   PR Type: Bugfix
   
   Problem Summary:
   
   After #70501, upgraded clusters whose persisted metadata holds a non-default 
`default_variant_*` value—such as Doris 3.1's built-in 
`default_variant_max_subcolumns_count = 0` (changed to `2048` in 4.0) or a 
pre-upgrade `SET GLOBAL default_variant_*`—propagate that value into every new 
session, causing `UNSET VARIABLE ALL` and `UNSET GLOBAL VARIABLE ALL` to fail 
without `enable_debug_points` because resetting the value back to the built-in 
default runs through the rejected checker. The `default_variant_*` prefix also 
does not indicate that these variables are test-only. This PR renames all eight 
variables to `debug_variant_*` (and switches `test_index_disk_usage_tvf` to set 
`variant_enable_doc_mode = false` in the column definition); 131 of the 137 
changed files are regression test renames. After an upgrade, old 
`default_variant_*` entries in images and edit logs are ignored so sessions 
keep built-in values and `UNSET [GLOBAL] VARIABLE ALL` succeeds, while 
explicitly setting an
  old `default_variant_*` name fails as an unknown system variable.
   
   ### Details
   
   - **Change map:** 137 files changed (`+374/-337`): 3 FE production files 
(`+26/-26`), 3 FE unit test files (`+53/-14`), and 131 regression test files 
(`+295/-297`).
     - FE production (`SessionVariable.java`, `LogicalPlanBuilder.java`, 
`PropertyAnalyzer.java`, `+26/-26`): rename the eight variable names and 
constants from `default_variant_*` / `DEFAULT_VARIANT_*` to `debug_variant_*` / 
`DEBUG_VARIANT_*` (keeping Java field and getter names unchanged), update the 
checker error message and comments, and drop the `or turn off 
default_variant_enable_nested_group` hint from the escaped-table NestedGroup 
error in `PropertyAnalyzer`.
     - FE unit tests (`VariableMgrTest.java`, `PropertyAnalyzerTest.java`, 
`TypeTest.java`, `+53/-14`): update variable names in existing tests and add 
`testOldDefaultVariantNamesIgnored` covering image JSON load, edit-log replay, 
and `SET` of an old name.
     - Regression tests (131 `.groovy` files, `+295/-297`): replace 
`default_variant_*` with `debug_variant_*` across 130 suites, and change 
`test_index_disk_usage_tvf` to specify `PROPERTIES("variant_enable_doc_mode" = 
"false")` on the `VARIANT` column instead of setting session variables.
   - **Frequency:** Every `UNSET VARIABLE ALL` / `UNSET GLOBAL VARIABLE ALL` on 
an upgraded cluster whose image or edit log holds a non-default 
`default_variant_*` global value (such as any cluster upgraded from 3.1), and 
`test_index_disk_usage_tvf` whenever a pipeline runs without 
`enable_debug_points`.
   - **Root cause:** `SessionVariable` persisted global variable values under 
the same `default_variant_*` names across versions. When 
`VariableMgr.setAllVarsToDefaultValue` (`UNSET [GLOBAL] VARIABLE ALL`) saw a 
value differing from the built-in default, it attempted to write the built-in 
default back through `SessionVariable.checkDefaultVariantSettable`, which 
rejects all writes when `Config.enable_debug_points` is `false`.
   - **Why existing tests missed it:** Master CI pipelines run with 
`enable_debug_points = true` and start from fresh metadata, so neither 
pre-upgrade persisted `default_variant_*` values nor debug-points-off `UNSET 
VARIABLE ALL` / `test_index_disk_usage_tvf` were exercised.
   - **Fix:** Rename all eight variables from `default_variant_*` to 
`debug_variant_*`. Unknown keys in persisted images 
(`SessionVariable.readFromJson`) and edit logs 
(`VariableMgr.replayGlobalVariableV2`) are ignored, so upgraded clusters keep 
built-in values for `debug_variant_*` and `UNSET [GLOBAL] VARIABLE ALL` skips 
them because the current value already equals the default. Update 
`test_index_disk_usage_tvf` to set `variant_enable_doc_mode = false` in the 
`VARIANT` column definition.
   - **Other paths and branches:** Checked all references to `default_variant_` 
/ `DEFAULT_VARIANT_` across `fe/`, `be/`, and `regression-test/`; none remain 
in FE or regression suites outside the new upgrade test in `VariableMgrTest`. 
BE constants (`DEFAULT_VARIANT_MAX_SPARSE_COLUMN_STATS_SIZE`, 
`DEFAULT_VARIANT_SPARSE_HASH_SHARD_COUNT`) are BE-internal defaults unrelated 
to session variables. A follow-up pick to `branch-4.2` will be submitted 
separately.
   - **Behavior change:** The eight test-only variables are renamed from 
`default_variant_*` to `debug_variant_*`. Setting an old `default_variant_*` 
name now fails with `Unknown system variable` (suggesting `debug_variant_*`), 
and persisted pre-upgrade `default_variant_*` values in images/edit logs are 
ignored on upgrade.
   
   ### Testing
   
   - **FE build & checkstyle (local):** `build.sh --fe` succeeded (`BUILD 
SUCCESS`, 0 checkstyle violations).
   - **FE UT (local):** `run-fe-ut.sh --run 
org.apache.doris.qe.VariableMgrTest,org.apache.doris.common.PropertyAnalyzerTest,org.apache.doris.catalog.TypeTest,org.apache.doris.nereids.parser.NereidsParserTest,org.apache.doris.catalog.CreateTableLikeTest,org.apache.doris.catalog.VariantEscapeTableTest`
 — 6 classes, 191/191 passed (`VariableMgrTest` 19, `PropertyAnalyzerTest` 35, 
`TypeTest` 22, `NereidsParserTest` 92, `CreateTableLikeTest` 14, 
`VariantEscapeTableTest` 9), including 
`testDebugVariantVariablesOnlyForTesting`, 
`testPersistedDebugVariantVariableDroppedOnReplay`, and 
`testOldDefaultVariantNamesIgnored`.
   - **4.1 -> upgraded FE test with production config (local, 
`enable_debug_points = false`, `use_fuzzy_session_variable = false`):**
     - Started a Doris 4.1 FE, ran `SET GLOBAL 
default_variant_max_subcolumns_count = 0` and `SET GLOBAL 
default_variant_enable_doc_mode = true`, waited until persisted in checkpoint 
`image.25`, then ran `SET GLOBAL default_variant_sparse_hash_shard_count = 3` 
(edit-log-only) and stopped the 4.1 FE.
     - Started the newly built FE on the 4.1 `doris-meta` without 
`enable_debug_points` or fuzzy variables; verified 4.1 databases loaded and 
edit-log replay ignored `default_variant_sparse_hash_shard_count`.
     - Verified via `mysql`: `UNSET VARIABLE ALL` and `UNSET GLOBAL VARIABLE 
ALL` both succeed; `SET` / `SET GLOBAL` / `UNSET VARIABLE` / `SET_VAR` on 
`debug_variant_*` are rejected (`only for testing`); `SET` / `SET GLOBAL` / 
`UNSET VARIABLE` / `SET_VAR` on `default_variant_*` fail as unknown system 
variables; `SHOW VARIABLES LIKE 'debug_variant_%'` and `'default_variant_%'` 
are empty.
   - **Regression tests (local, debug points on + fuzzy):** 14 suites passed 
covering all 8 renamed variables, `SET_VAR` hints, `test_index_disk_usage_tvf`, 
`test_variant_create_table_like`, `test_variant_search_subcolumn`, `rqg7`, and 
`check_before_quit`.
   
   ### Release note
   
   The eight test-only `VARIANT` session variables (`default_variant_*`) are 
renamed to `debug_variant_*`. Setting a `default_variant_*` variable now fails 
with `Unknown system variable`. Upgraded clusters with previously persisted 
`default_variant_*` global values ignore those old keys and no longer fail on 
`UNSET VARIABLE ALL` / `UNSET GLOBAL VARIABLE ALL`.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No (the variables are `INVISIBLE` and 
test-only; they are not documented)
   - Pre-submission status: Ready
   
   ### AI Disclosure
   
   - Tool: Claude Code and Antigravity
   - Generated: code edits, unit test updates, regression test renames, and 
this description
   - Human review: Directed the final design (pure rename without adding a 
`VarAttrDef` flag, old names error as unknown variable, column-level property 
in `test_index_disk_usage_tvf`) and reviewed the changes.
   
   <!-- Recommended: develop the change with the develop-with-evidence skill 
and write this description with the doris-pr-description skill, both from 
https://github.com/apache/doris-skills (the doris-skills submodule of this 
repository). -->
   
   ### Background
   
   <!-- How the feature or module this PR touches works today, in two to four 
plain sentences, for a reviewer who doesn't know it. Link the user doc if there 
is one. Leave the problem and the fix to Problem Summary. -->
   
   ### What problem does this PR solve?
   
   <!-- Issue Number: "close #N" if this PR resolves the issue, "#N" if it only 
relates to it, "None" if there is none. A Feature needs an issue. -->
   <!-- Related PR: "#N (relation)" for each PR a reviewer should know about, 
such as "#123 (introduced the bug)", separated by commas. Write "None" if no 
related PR is known. -->
   <!-- PR Type: Bugfix, Performance, Feature, Enhancement, Refactor, Test, 
Build/CI/Chore, Revert, Release/Dependency, or Other. -->
   
   Issue Number:
   Related PR:
   PR Type:
   
   Problem Summary:
   
   <!-- Two to five sentences: the problem or need and who is affected; the 
approach in one sentence; when the diff is larger than that suggests, what else 
it had to handle, or that most of it is tests; and what existing users see 
after an upgrade. -->
   
   ### Details
   
   <!--
   For a diff of more than about 300 changed lines, start with "- **Change 
map:**": how many lines are production code, tests, generated files, and docs, 
then the code in parts, each with the problem it handles and its size.
   Then answer each field of your PR type on its own line, as "- **Field:** 
answer", in this order:
     Bugfix: Frequency, Root cause, Why existing tests missed it, Fix, Other 
paths and branches
     Performance: Why it was slow, Optimization, Results, Applicability and cost
     Feature: Scope, Design, Usage, Default behavior, Compatibility
     Enhancement: Before and after, Configs and defaults, Impact on existing 
users
     Refactor: Moves vs. logic changes, Behavior change, Compatibility, 
Performance impact, Rollback
     Test, adding tests: Scenarios, What existing tests miss, Fails when broken
     Test, fixing a test: Failure, Cause, Stability evidence
     Build/CI/Chore: Affected, Developer and release impact, License and 
third-party, Rollback
     Revert: Why not fix forward, Original author notified, Follow-up
     Release/Dependency: Versions, Upstream changes, Compatibility, Rollback
     Other: Why Other
   "None" is a valid answer when it is true. Don't restate the diff.
   -->
   
   ### Testing
   
   <!-- The tests, suites, or commands that ran, what each shows, and where it 
ran (locally or in CI). For a fix, the test that fails before it and passes 
after. -->
   
   ### Notes for Reviewers
   
   <!-- Optional; delete this section if there is nothing to say. Why each 
non-obvious edit was made, what you are unsure about, and where to start 
reading if Details has no Change map. -->
   
   ### Release note
   
   <!-- One paragraph on what users will notice, or None. -->
   
   ### Check List (For Author)
   
   <!-- Behavior changed: "No", or "Yes (see Details)" with a Behavior change 
field in Details. -->
   <!-- Does this need documentation: "No", or "Yes" with the 
apache/doris-website PR or the plan. -->
   <!-- Pre-submission status: "Ready"; "Partially verified: " and what is not 
verified; or "Not ready: " and why, for a Draft PR. -->
   
   - Behavior changed:
   - Does this need documentation:
   - Pre-submission status:
   
   ### AI Disclosure
   
   <!-- Tool: the agent and model, or None. Generated: the parts it wrote 
(code, tests, this description), or None. Human review: what you reviewed of 
the generated parts, or "Not applicable" without AI tools. You may add "- 
Prompts:" to summarize how you directed the agent. -->
   
   - Tool:
   - Generated:
   - Human review:
   


-- 
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