dataroaring commented on PR #60310:
URL: https://github.com/apache/doris/pull/60310#issuecomment-3867556132

   ### Code review
   
   Found 1 issue:
   
   1. Missing `has_mtime()` check when accessing `cluster.mtime()` in 
`get_cluster_status()`. On the server side (`meta_service_resource.cpp`), 
`mtime` is conditionally set only when `cluster.has_mtime()` is true. When it 
is not set, protobuf3 returns the default value `0`, so `0 * 1000 = 0` is 
stored as `mtime_ms` in the `ClusterStatusCache`. Downstream in 
`should_skip_compaction()`, the elapsed time is computed as `now - 
status_mtime`. When `status_mtime` is 0, `elapsed` equals the current Unix time 
in milliseconds (~1.7 trillion), which is always greater than the 5-minute 
takeover timeout. This causes immediate compaction takeover by non-writer 
clusters, bypassing the timeout safety mechanism entirely.
   
   
https://github.com/apache/doris/blob/4d3741931e91c2c543f1ed8d076ff29efcc64a84/be/src/cloud/cloud_meta_mgr.cpp#L2281-L2283
   
   Server-side conditional setting that proves `mtime` is optional:
   
   
https://github.com/apache/doris/blob/4d3741931e91c2c543f1ed8d076ff29efcc64a84/cloud/src/meta-service/meta_service_resource.cpp#L4587-L4589
   
   Downstream timeout bypass when `mtime_ms` is 0:
   
   
https://github.com/apache/doris/blob/4d3741931e91c2c543f1ed8d076ff29efcc64a84/be/src/cloud/cloud_cluster_info.cpp#L166-L180
   
   🤖 Generated with [Claude Code](https://claude.ai/code)
   
   <sub>- If this code review was useful, please react with 👍. Otherwise, react 
with 👎.</sub>


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