horizonzy commented on code in PR #4220:
URL: https://github.com/apache/bookkeeper/pull/4220#discussion_r1500529735
##########
bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java:
##########
@@ -89,7 +89,7 @@ private static void readLedger(ClientConfiguration conf, long
ledgerId, byte[] p
lh = bk.openLedgerNoRecovery(ledgerId,
BookKeeper.DigestType.CRC32,
passwd);
long lastConfirmed = Math.min(lh.getLastAddConfirmed(),
absoluteLimit);
- if (lastConfirmed == lastRead) {
+ if (lastConfirmed <= lastRead) {
Review Comment:
if the read is batched, the lastRead may be greater than lastConfirmed.
##########
bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java:
##########
@@ -102,14 +102,14 @@ private static void readLedger(ClientConfiguration conf,
long ledgerId, byte[] p
}
long starttime = System.nanoTime();
- while (entriesRead <= lastConfirmed) {
+ while (entriesRead < lastConfirmed) {
long nextLimit = lastRead + 100000;
Enumeration<LedgerEntry> entries;
if (batchEntries <= 0) {
long readTo = Math.min(nextLimit, lastConfirmed);
entries = lh.readEntries(lastRead + 1, readTo);
Review Comment:
If the read is single read, we should make sure that entriesRead is less
than lastConfirmed. Or the `lastRead + 1` will be greater than `readTo`.
##########
bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java:
##########
@@ -102,14 +102,14 @@ private static void readLedger(ClientConfiguration conf,
long ledgerId, byte[] p
}
long starttime = System.nanoTime();
- while (entriesRead <= lastConfirmed) {
+ while (entriesRead < lastConfirmed) {
long nextLimit = lastRead + 100000;
Enumeration<LedgerEntry> entries;
if (batchEntries <= 0) {
long readTo = Math.min(nextLimit, lastConfirmed);
entries = lh.readEntries(lastRead + 1, readTo);
} else {
- entries = lh.batchReadEntries(lastRead, batchEntries,
-1);
+ entries = lh.batchReadEntries(lastRead + 1,
batchEntries, -1);
Review Comment:
The `lastRead` entry already be read, so we should read next entry at the
next read.
--
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]