Doris-Breakwater commented on issue #70809:
URL: https://github.com/apache/doris/issues/70809#issuecomment-7035075459

   ### Initial assessment
   
   This is a source-confirmed MySQL session-variable compatibility gap in the 
reported `4.0.8-rc02` commit, `bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36`. It 
can surface as a client connection-test failure when session initialization 
executes the rejected `SET`. The issue currently has no labels; suggested 
triage area: **FE / MySQL compatibility / time zones**. The available evidence 
does not establish a regression or Cloud Mode-specific cause.
   
   ### Verified mechanism
   
   1. 
[`SetSessionVarOp.validate()`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/SetSessionVarOp.java#L94-L97)
 passes the string to `TimeUtils.checkTimeZoneValidAndStandardize()` before 
applying the session variable.
   2. In 
[`TimeUtils`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java#L308-L348),
 `SYSTEM` is absent from the alias map, contains no `/`, and matches neither an 
offset nor a supported `GMT`/`UTC` prefix. It therefore reaches 
`ERR_UNKNOWN_TIME_ZONE` at line 329. This directly accounts for the reported 
message, without requiring backend query execution. An isolated Java probe 
using the extracted validator, with error reporting stubbed, rejected `SYSTEM`, 
`system`, and `SyStEm`, while accepting `UTC`, `Asia/Shanghai`, and explicit 
offsets. **This was not a full Doris cluster reproduction.**
   3. The version already exposes a read-only 
[`system_time_zone`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java#L119-L121),
 initialized through 
[`TimeUtils.getSystemTimeZone()`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java#L155-L165)
 from the FE JVM default. That initialization alone does not define a 
persisted, cluster-wide meaning for the `SYSTEM` token.
   4. Execution needs a resolvable zone: FE 
[`getTimeZone()`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java#L137-L145)
 calls `ZoneId.of()`, and 
[`Coordinator`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java#L365-L369)
 sends the session zone through query globals to backend 
[`RuntimeState`](https://github.com/apache/doris/blob/bc8ea1bac6d62d92cdebd2e3ac33cc668961ec36/be/src/runtime/runtime_state.cpp#L161-L183).
 Simply allowing the literal through validation would leave downstream 
resolution incomplete.
   
   [MySQL documents `SYSTEM` as a valid, case-insensitive 
value](https://dev.mysql.com/doc/refman/8.4/en/time-zone-support.html). [TiDB 
documents a bootstrap-resolved system 
zone](https://docs.pingcap.com/tidb/stable/configure-time-zone/); that is a 
useful design precedent, rather than an existing Doris guarantee.
   
   ### Recommended next steps
   
   - Define the authoritative system-zone source and its behavior across FEs, 
restarts, and failover. A persisted cluster zone is one option; independently 
resolving each execution node's local zone would not satisfy the requested 
consistency.
   - Resolve `SYSTEM` case-insensitively during session-variable assignment and 
ensure FE evaluation and all execution paths receive the same concrete zone. 
Decide and document whether variable readback retains `SYSTEM` or displays the 
resolved ID. Review the scope carefully: the shared validator also serves load 
properties and `CONVERT_TZ`.
   - Add coverage for mixed-case values, changing an already customized session 
back to the system zone, invalid values, and global/new-session behavior if 
supported. Compare FE constant evaluation with backend evaluation over table 
rows, including a DST-observing region and differing node defaults.
   
   ### Missing deployment confirmation and immediate workaround
   
   Please attach the following output from the affected connection before the 
failing statement:
   
   ```sql
   SELECT @@version_comment, @@session.time_zone,
          @@global.time_zone, @@system_time_zone;
   ```
   
   For client impact, provide the Tabularis/driver version and complete 
initialization SQL/error. For multi-FE semantics, compare `system_time_zone` 
across FEs and identify any differing JVM/TZ settings. The rejection itself is 
already explained by the code; a query profile is unnecessary for this 
validation failure.
   
   Meanwhile, configure the client to send an explicit supported region name or 
offset matching the intended application zone. Alternatively, omit the 
initialization assignment if the client supports doing so. The linked 
[Tabularis report](https://github.com/TabularisDB/tabularis/issues/1640) says 
clearing its field still falls back to `SYSTEM`, so clearing that field alone 
is not a demonstrated workaround. No fixed release or upgrade remedy has been 
verified here.
   
   Breakwater-GitHub-Analysis-Slot: slot_53da9d91258b
   


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