HDDS-14219. Add metrics for ReadBlock#9535
Conversation
| } | ||
| }; | ||
|
|
||
| RandomAccessFileChannel blockFile = new RandomAccessFileChannel(); |
There was a problem hiding this comment.
must call close() on this object to release file description upon close.
RandomAccessFileChannel should have been made a Closeable object. Too bad that's not the case.
There was a problem hiding this comment.
There was a problem hiding this comment.
Ok,get it!
thanks for the review!
jojochuang
left a comment
There was a problem hiding this comment.
I thought I added this comment too but it didn't show up before. Sorry for back and forth.
| // TODO metrics.incContainerBytesStats(Type.ReadBlock, readBlock.getLen()); | ||
| final ReadBlockRequestProto readBlock = request.getReadBlock(); | ||
| final BlockID blockID = BlockID.getFromProtobuf(readBlock.getBlockID()); | ||
| final BlockData blockData = getBlockManager().getBlock(kvContainer, blockID); |
There was a problem hiding this comment.
this is an expensive operation because it involves reading from rocksdb. And for the most part this blockData is not going to be used since readBlock usually has length. So this is a waste.
IMO, we should let readBlockImpl() to return the length it actually read and use that as the counter for bytesRead.
jojochuang
left a comment
There was a problem hiding this comment.
request change not approval.
|
I've tried to resolve this problem and update. |
|
We should also update the Volume statistic. Something like:
|
|
@ss77892 IMO the volume level metrics should be updated within RandomAccessFileChannel itself. But yeah, since this request readBlock does not use the regular ChunkUtils/FilePerBlockStrategy, volume level metrics are not automatically updated. |
What changes were proposed in this pull request?
This PR adds metrics tracking for readBlock operations and unit test.
What is the link to the Apache JIRA
HDDS-14219
How was this patch tested?
test all passed locally.
https://github.com/rich7420/ozone/actions/runs/20390167387/