JackieTien97 opened a new pull request, #19347:
URL: https://github.com/apache/iotdb/pull/19347

   ## Description
   
   The DataNode uses the estimated heap of sealed TsFile resources to decide 
when to degrade device indexes. The previous estimate omitted the file path, 
per-resource locks and atomic objects, and lazily created modification-file 
handles. It also cached the first device-index estimate across changes. On 
removal, the manager recalculated the charge, so a resource whose progress 
index had grown could release bytes belonging to another file.
   
   `TsFileResource` now measures resident metadata separately from the current 
time index. `ArrayDeviceTimeIndex` includes the device map's buckets and 
entries alongside the device IDs and time arrays. `TsFileResourceManager` 
records each registration's charge, applies changes as deltas, and releases the 
remaining balance on removal. Metadata-only changes reuse the registered index 
size. Compaction accounts for the device index it actually caches, and LOAD 
accounts for a shared file handle once.
   
   ### Example
   
   For a sealed resource with a 54-character file path on JDK 17.0.5 with 
compressed references, creating the exclusive mods handle previously left the 
estimate at 272 bytes.
   
   | Resource state | Previous estimate | Updated estimate | Measured owned 
heap after the change |
   | --- | ---: | ---: | ---: |
   | Degraded to a file-level index | 272 B | 528 B | 472 B |
   | After creating the exclusive mods handle | 272 B | 848 B | 768 B |
   
   The measurements count each owned object once. The budget uses estimates for 
strings and hash-table capacity.
   
   ### Verification
   
   - [x] Self-reviewed the registration, degradation, and removal paths.
   - [x] Added regression coverage for index growth, degradation before the 
first estimate, metadata changes after registration, and release of LOAD last 
values.
   - [x] Ran 92 tests across six DataNode test classes covering resources, 
progress indexes, compaction, and LOAD.
   - [x] Packaged all 50 Maven reactor modules with both the default English 
messages and the `with-zh-locale` profile on JDK 17.
   - [x] Ran 32 concurrent degradation, metadata-update, and removal checks in 
an isolated JVM. Each removal returned the memory balance to its starting value.
   


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

Reply via email to