dataroaring commented on PR #53540:
URL: https://github.com/apache/doris/pull/53540#issuecomment-3284889722
**🚨 CRITICAL: Thread Safety Violation**
**File**: `be/src/cloud/cloud_tablet.cpp` lines 205-210
```cpp
bool CloudTablet::rowset_is_warmed_up(int64_t start_version, int64_t
end_version) {
// ... version calculation ...
auto it = _rs_version_map.find(version); // ❌ NO LOCKING
if (it == _rs_version_map.end()) {
it = _stale_rs_version_map.find(version); // ❌ RACE CONDITION
}
```
**Issue**: This method accesses shared data structures (`_rs_version_map`
and `_stale_rs_version_map`) without holding proper locks, creating potential
race conditions in multi-threaded environments.
**Risks**:
- **Data races** when other threads are modifying the version maps
- **Memory corruption** from concurrent access
- **Inconsistent read results** leading to incorrect warmup status
- **Production crashes** under high concurrency
**Fix**: Add proper synchronization using the existing `_meta_lock`:
```cpp
bool CloudTablet::rowset_is_warmed_up(int64_t start_version, int64_t
end_version) {
// ... version calculation ...
std::shared_lock rlock(_meta_lock); // ✅ THREAD SAFE
auto it = _rs_version_map.find(version);
if (it == _rs_version_map.end()) {
it = _stale_rs_version_map.find(version);
}
if (it == _stale_rs_version_map.end()) {
return false;
}
// ... rest of logic
}
```
**This is a blocking issue** that must be fixed before merge as it could
cause production instability.
--
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]