[
https://issues.apache.org/jira/browse/BOOKKEEPER-327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13408846#comment-13408846
]
Sijie Guo commented on BOOKKEEPER-327:
--------------------------------------
@Uma, yes. we need to negative checking for latency. but I don't think we need
to reserve bucket for negative latency, because it doesn't help on calculating
totalLatency and avgLatency. inorder to keep consistency between numSuccessOps
and buckets, so I think the changes could be just outputting error message.
{code}
synchronized public void updateLatency(long latency) {
if (latency < 0) { // less than 0ms . Ideally this should not
// happen. We have seen this latency negative in
// some cases.
LOG.warn("Latency time coming negative");
return;
}
totalLatency += latency;
++numSuccessOps;
if (latency < minLatency) {
minLatency = latency;
}
if (latency > maxLatency) {
maxLatency = latency;
}
int bucket;
if (latency <= 100) { // less than 100ms
bucket = (int)(latency / 10);
} else if (latency <= 1000) { // 100ms ~ 1000ms
bucket = 1 * 9 + (int)(latency / 100);
} else if (latency <= 10000) { // 1s ~ 10s
bucket = 2 * 9 + (int)(latency / 1000);
} else { // more than 10s
bucket = 3 * 9 + 1;
}
++latencyBuckets[bucket];
}
{code}
>>> for nanoTime
+1 for the changes on nanoTime.
> System.currentTimeMillis usage in BookKeeper
> --------------------------------------------
>
> Key: BOOKKEEPER-327
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-327
> Project: Bookkeeper
> Issue Type: Bug
> Affects Versions: 4.0.0, 4.1.0
> Reporter: Rakesh R
> Priority: Minor
> Attachments: BOOKKEEPER-327.patch
>
>
> The following exception occured in the bookie statistics logic due to the
> System time changes. In our bookie cluster its running a periodic syncup
> scripts just to unify the SystemTime in all the machines. This is causing the
> problem and resulting ArrayIndexOutOfBoundException.
> {code}
> Exception in thread "BookieJournal-3181"
> java.lang.ArrayIndexOutOfBoundsException: -423
> at org.apache.bookkeeper.proto.BKStats$OpStats.updateLatency(BKStats.java:126)
> at
> org.apache.bookkeeper.proto.BookieServer.writeComplete(BookieServer.java:655)
> at org.apache.bookkeeper.bookie.Journal.run(Journal.java:507)
> {code}
> This jira is raised to discuss whether to use ??System.nanoTime()?? instead
> of ??System.currentTimeMillis()??
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira