add metric for rocksdb getLastEntryInLedger to help find out bottleneck #4529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
One of our cluster occur a case that read ledger LAC timeout and ledger can not recover, which make topic unavailable. After adding extra log in bookie-server, we finally found the bottleneck is in EntryLocationIndex#getLastEntryInLedgerInternal, it spend 2.5 minute to scan the rocksdb.
Currently it may be hard to find out the bottleneck is in getLastEntryInLedgerInternal. Because if getLastEntryInLedgerInternal throw noEntry exception, the read-locations-index-time is not able to record the long latency. There is no way to know the bottleneck is in getLastEntryInLedgerInternal.
Because once the bottleneck in getLastEntry occur, the worst it would cause ledger unavailable and pulsar topic unavailable, I think is important to add this metric
Changes
add metric.