github-actions[bot] commented on code in PR #70846:
URL: https://github.com/apache/doris/pull/70846#discussion_r4669246702


##########
fe/fe-common/src/main/java/org/apache/doris/qe/GlobalVariable.java:
##########
@@ -190,16 +190,22 @@ private static String resolveSystemTimeZone() {
     @VarAttrDef.VarAttr(name = ENABLE_AUDIT_PLUGIN, flag = VarAttrDef.GLOBAL)
     public static boolean enableAuditLoader = true;
 
-    @VarAttrDef.VarAttr(name = AUDIT_PLUGIN_MAX_BATCH_BYTES, flag = 
VarAttrDef.GLOBAL)
+    // A negative batch threshold forces a flush for every record.
+    @VarAttrDef.VarAttr(minValue = "0", name = AUDIT_PLUGIN_MAX_BATCH_BYTES, 
flag = VarAttrDef.GLOBAL)
     public static long auditPluginMaxBatchBytes = 50 * 1024 * 1024;
 
-    @VarAttrDef.VarAttr(name = AUDIT_PLUGIN_MAX_BATCH_INTERVAL_SEC, flag = 
VarAttrDef.GLOBAL)
+    // AuditLoader multiplies seconds by 1000. Long.MAX_VALUE would become 
-1000 ms
+    // and flush every pending batch. Zero keeps its immediate-flush meaning.
+    @VarAttrDef.VarAttr(minValue = "0", maxValue = "9223372036854775",

Review Comment:
   [P1] Validate or normalize bounded global variables during image/edit-log 
replay. `replayGlobalVariableV2` calls `setValue` directly, bypassing the new 
`minValue/maxValue`, so an old `audit_plugin_max_batch_interval_sec=-1` is 
restored and `AuditLoader` sees `-1 * 1000`, flushing every audit event 
synchronously; negative `audit_plugin_max_batch_bytes` has the same effect. 
Apply the bounds on replay with an explicit compatibility policy and test an 
old persisted value.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -3448,10 +3472,12 @@ public void setDetailShapePlanNodes(String 
detailShapePlanNodes) {
     // CLOUD_VARIABLES_END
 
     // fetch remote schema rpc timeout
-    @VarAttrDef.VarAttr(name = FETCH_REMOTE_SCHEMA_TIMEOUT_SECONDS, fuzzy = 
true)
+    // Zero keeps the no-wait behavior; a negative timeout is invalid.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
FETCH_REMOTE_SCHEMA_TIMEOUT_SECONDS, fuzzy = true)

Review Comment:
   [P1] Validate session variables when restoring persisted streaming jobs and 
FE images. The new `minValue = "0"` checks run for SET/forwarding, but 
`readFromMap`/`readFromJson` assign `data_queue_max_blocks` and spill fields 
directly. A negative value persisted by an older FE (or accepted in a new 
streaming-job property) is forwarded to BE, where the new validator rejects 
every fragment, leaving the job/query unusable after upgrade. Apply the same 
validation or an explicit compatibility normalization during restore and add a 
persisted-negative test.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -3490,57 +3517,69 @@ public void setDetailShapePlanNodes(String 
detailShapePlanNodes) {
             needForward = true, fuzzy = true)
     public boolean enableReserveMemory = true;
 
-    @VarAttrDef.VarAttr(name = SPILL_MIN_REVOCABLE_MEM, needForward = true, 
fuzzy = true)
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = SPILL_MIN_REVOCABLE_MEM, 
needForward = true, fuzzy = true)
     public long spillMinRevocableMem = 4 * 1024 * 1024;
 
-    @VarAttrDef.VarAttr(name = SPILL_BUFFER_SIZE_BYTES, fuzzy = true, 
needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = SPILL_BUFFER_SIZE_BYTES, fuzzy 
= true, needForward = true,
             description = "Maximum block size for spill writes (in bytes). 
Blocks larger than this threshold are "
                     + "split before writing to disk. Also controls per-file 
read buffer size during merge sort. "
                     + "Default is 8MB.")
     public long spillBufferSizeBytes = 8L * 1024L * 1024L;
 
-    @VarAttrDef.VarAttr(name = SPILL_AGGREGATION_PARTITION_COUNT, needForward 
= true, fuzzy = true)
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_AGGREGATION_PARTITION_COUNT, needForward = true, fuzzy = true)
     public int spillAggregationPartitionCount = 4;
 
-    @VarAttrDef.VarAttr(name = LOW_MEMORY_MODE_BUFFER_LIMIT, needForward = 
true, fuzzy = false)
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = LOW_MEMORY_MODE_BUFFER_LIMIT, 
needForward = true, fuzzy = false)
     public long lowMemoryModeBufferLimit = 33554432;
 
     // The memory limit of streaming agg when spilling is enabled. It is 
applied on top of the
     // query-limit-based budget (1/5 of the query memory limit shared among 
the tasks);
     // 0 disables this explicit bound.
     // NOTE: streaming agg operator will not spill to disk.
-    @VarAttrDef.VarAttr(name = SPILL_STREAMING_AGG_MEM_LIMIT, needForward = 
true, fuzzy = false)
+    // Zero disables the fixed limit; negative bytes are not a limit.
+    @VarAttrDef.VarAttr(minValue = "0", name = SPILL_STREAMING_AGG_MEM_LIMIT, 
needForward = true, fuzzy = false)
     public long spillStreamingAggMemLimit = 268435456; //256MB
 
-    @VarAttrDef.VarAttr(name = SPILL_HASH_JOIN_PARTITION_COUNT, needForward = 
true, fuzzy = true)
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_HASH_JOIN_PARTITION_COUNT, needForward = true, fuzzy = true)
     public int spillHashJoinPartitionCount = 4;
 
-    @VarAttrDef.VarAttr(name = SPILL_REPARTITION_MAX_DEPTH, fuzzy = true, 
needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = SPILL_REPARTITION_MAX_DEPTH, 
fuzzy = true, needForward = true,
             description = "Maximum depth for repartition recursion. When 
exceeded, repartitioning will stop. Default "
                     + "is 8.")
     public int spillRepartitionMaxDepth = 8;
 
-    @VarAttrDef.VarAttr(name = SPILL_JOIN_BUILD_SINK_MEM_LIMIT_BYTES, fuzzy = 
true, needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_JOIN_BUILD_SINK_MEM_LIMIT_BYTES, fuzzy = true, needForward = true,
             description = "After spill is triggered, join build sink will 
proactively spill when revocable memory "
                     + "exceeds this threshold (in bytes). Default is 64MB.")
     public long spillJoinBuildSinkMemLimitBytes = 64L * 1024L * 1024L;
 
-    @VarAttrDef.VarAttr(name = SPILL_AGGREGATION_SINK_MEM_LIMIT_BYTES, fuzzy = 
true, needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_AGGREGATION_SINK_MEM_LIMIT_BYTES, fuzzy = true, needForward = true,
             description = "After spill is triggered, aggregation sink will 
proactively spill when revocable memory "
                     + "exceeds this threshold (in bytes). Default is 64GB.")
     public long spillAggregationSinkMemLimitBytes = 64L * 1024L * 1024L * 
1024L;
 
-    @VarAttrDef.VarAttr(name = SPILL_SORT_SINK_MEM_LIMIT_BYTES, fuzzy = true, 
needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_SORT_SINK_MEM_LIMIT_BYTES, fuzzy = true, needForward = true,
             description = "After spill is triggered, sort sink will 
proactively spill when revocable memory "
                     + "exceeds this threshold (in bytes). Default is 64MB.")
     public long spillSortSinkMemLimitBytes = 64L * 1024L * 1024L;
 
-    @VarAttrDef.VarAttr(name = SPILL_ANALYTIC_SINK_MEM_LIMIT_BYTES, fuzzy = 
true, needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_ANALYTIC_SINK_MEM_LIMIT_BYTES, fuzzy = true, needForward = true,
             description = "Non-streaming analytic partitions will proactively 
spill when revocable memory "
                     + "exceeds this threshold (in bytes). Default is 64MB.")
     public long spillAnalyticSinkMemLimitBytes = 64L * 1024L * 1024L;
 
-    @VarAttrDef.VarAttr(name = SPILL_SORT_MERGE_MEM_LIMIT_BYTES, fuzzy = true, 
needForward = true,
+    // Reject negative values before BE applies its minimum working size.
+    @VarAttrDef.VarAttr(minValue = "0", name = 
SPILL_SORT_MERGE_MEM_LIMIT_BYTES, fuzzy = true, needForward = true,
             description = "After spill is triggered, total memory budget for 
the sort merge phase (in bytes). "
                     + "Divided by spill_buffer_size_bytes gives the number of 
files that can be merged "
                     + "in parallel. Default is 64MB.")

Review Comment:
   [P1] Propagate checker failures while restoring forwarded session variables. 
`checkMinimumOperatorMemoryRequiredKB` throws a checked `Exception`, which 
`VariableMgr.setValue` converts to `DdlException`; the catch-all at 
`SessionVariable.java:6337` swallows it, so a follower receiving 
`minimum_operator_memory_required_kb=-1` continues with the old value instead 
of returning an invalid-variable error. Re-throw `DdlException` (or make this 
checker throw the same unchecked type as the NumericRange path) and cover the 
forwarded request.



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