d-wang-commit opened a new pull request, #19067: URL: https://github.com/apache/iotdb/pull/19067
## Description ### Fix stale log size accounting DiskGuardian updates its cached size only when open-segment paths change. If it observes a new segment before preallocation, later growth at the same path leaves the cached size at zero and can prevent disk-threshold snapshots. Recompute the lengths of current open and closed log segments on every scan, following Ratis's segment naming rules. This also accounts for segment rotation and deletion. ### Tests - Added `RaftLogSummaryTest`: same-path growth/truncation, recreation, rotation/deletion, and non-log filtering. - Ran `RaftLogSummaryTest` and the existing `DiskGuardianTest`, including `testThresholdSnapshot`: 5 tests passed, with no failures, errors, or skips, using a clean Maven reactor build on Windows/JDK 17. - IT: None added or modified; no IT run in this Apache IoTDB checkout. ### Side effects and risks Each scan queries file metadata for every matching segment without reading log contents, increasing metadata queries for unchanged segments. Concurrent file changes can affect one scan's result; the next scan recomputes it. No configuration or on-disk format changes. <hr> This PR has: - [x] been self-reviewed. - [x] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. - [x] added unit tests to cover the changed code paths. <hr> ##### Key changed/added classes (or packages if there are too many classes) in this PR - `DiskGuardian.RaftLogSummary`: refreshes total log size from current segment files. - `RaftLogSummaryTest`: regression coverage for segment size and lifecycle changes. -- 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]
