hangc0276 commented on code in PR #4384:
URL: https://github.com/apache/bookkeeper/pull/4384#discussion_r1614985215
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -411,14 +415,20 @@ public void runWithFlags(boolean force, boolean
suspendMajor, boolean suspendMin
try {
// gc inactive/deleted ledgers
// this is used in extractMetaFromEntryLogs to calculate the usage
of entry log
+ long gcLedgersStart = MathUtils.nowInNano();
doGcLedgers();
Review Comment:
The same as extractMetaFromEntryLogs and doGcEntryLogs
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -411,14 +415,20 @@ public void runWithFlags(boolean force, boolean
suspendMajor, boolean suspendMin
try {
// gc inactive/deleted ledgers
// this is used in extractMetaFromEntryLogs to calculate the usage
of entry log
+ long gcLedgersStart = MathUtils.nowInNano();
doGcLedgers();
Review Comment:
doGcLedgers may fail, can we record the metric in doGcLedgers method so that
we can record the failed metrics?
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:
##########
@@ -411,14 +415,20 @@ public void runWithFlags(boolean force, boolean
suspendMajor, boolean suspendMin
try {
// gc inactive/deleted ledgers
// this is used in extractMetaFromEntryLogs to calculate the usage
of entry log
+ long gcLedgersStart = MathUtils.nowInNano();
doGcLedgers();
+ gcStats.getGcLedgerRuntime()
+ .registerSuccessfulEvent(MathUtils.nowInNano() -
gcLedgersStart, TimeUnit.NANOSECONDS);
Review Comment:
We can use `MathUtils.elapsedNanos(gcLedgersStart)` instead
--
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]