Current state: Accepted
Discussion thread: here
Voting thread: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Storage is one of the key resources in a Kafka cluster. Administrators typically monitor the disk usage of each log directory via metrics to enable them to properly manage the storage attached to brokers. Metrics provide an easy way to see trends and set alerts and administrators should always use them to monitor disk usage.
There are also use cases where metrics are not a good way to retrieve the disk usage. For example, in tooling and automation, it would be useful to also be able to retrieve disk capacity and usable space directly. That would allow to easily validate whether disk operations (like a resize), or topic deletion (log deletion only happen after a short delay) have completed. For that reason this KIP proposes exposing disk total and usable sizes via the Kafka API.
We already have the DescribeLogDirs API that returns logdirs and details about the replicas they contain. To expose logdirs total and usable space, this KIP proposes adding 2 new fields to the DescribeLogDirsResponse message and bumping its protocol version to 4. The LogDirDescription class will also be updated to expose these 2 new fields to the Admin API.
No changes in the Request. Two new fields are added to the Response: TotalBytes and UsableBytes
When handling a DescribeLogDirs request, ReplicaManager will retrieve the total and usable space in bytes of the volume each logdir is into. In case these sizes are larger than Long.MAX_VALUE, (see https://bugs.openjdk.java.net/browse/JDK-8162520), brokers will return Long.MAX_VALUE.
LogDirDescription is used by the Admin API to represent the results from describeLogDirs(). Two new methods are added to this type:
If multiple log directories are on the same actual volume, they will both return the sizes of that volume.
Compatibility, Deprecation, and Migration Plan
Only new clients will use the new version, this does not change the behavior of existing clients.