You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#15274] docdb: Fix wal_size metric to reflect on-disk size, include active segment
Summary:
The `wal_size` metric reflects only the file size of readable log segments. `wal_size` is initialized to the size of all readable segments on `Log::Init()`, and only increased on the close of a current segment. This logic omits the size of the current active writable segment.
This code change fixes the metric by tracking the active segment size at these stages:
1. Allocation
1. Growth during append
1. Truncation at close before transition to readable segment
This change also introduces the APIs `WritableLogSegment::SizeOnDisk()` and `WritableFile::SizeOnDisk()` to get the true file size for the active segment, since the current `Size()` API returns the data size and not the file size.
The test `TestLogMetrics` grows the log to six segments and verifies the `wal_size` metric against actual file-sizes.
Jira: DB-4439
Test Plan:
```sh
./yb_build.sh --cxx-test='TEST_F(LogTest, TestLogMetrics) {' --test-args --vmodule=log=4
./yb_build.sh --cxx-test='TEST_F(TestEnv, TestHolePunch) {'
./yb_build.sh --cxx-test='TEST_F(TestEnv, TestRWFile) {'
```
Jenkins
Reviewers: yyan, rthallam, bkolagani, timur, sergei, mbautin, hector, qhu
Reviewed By: yyan, sergei
Subscribers: ybase, rthallam
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D46791
0 commit comments