-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix BenchReadThroughputLatency batch read can't stop problems. #4220
Changes from all commits
7afa103
8e2bc77
317f9e1
aecae1a
7004a51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ private static void readLedger(ClientConfiguration conf, long ledgerId, byte[] p | |
BookKeeper bk = null; | ||
long time = 0; | ||
long entriesRead = 0; | ||
long lastRead = 0; | ||
long lastRead = -1; | ||
int nochange = 0; | ||
|
||
long absoluteLimit = 5000000; | ||
|
@@ -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 + 1) { | ||
nochange++; | ||
if (nochange == 10) { | ||
break; | ||
|
@@ -102,14 +102,14 @@ private static void readLedger(ClientConfiguration conf, long ledgerId, byte[] p | |
} | ||
long starttime = System.nanoTime(); | ||
|
||
while (entriesRead <= lastConfirmed) { | ||
while (lastRead < lastConfirmed) { | ||
long nextLimit = lastRead + 100000; | ||
Enumeration<LedgerEntry> entries; | ||
if (batchEntries <= 0) { | ||
long readTo = Math.min(nextLimit, lastConfirmed); | ||
entries = lh.readEntries(lastRead + 1, readTo); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the read is single read, we should make sure that entriesRead is less than lastConfirmed. Or the |
||
} else { | ||
entries = lh.batchReadEntries(lastRead, batchEntries, -1); | ||
entries = lh.batchReadEntries(lastRead + 1, batchEntries, -1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need init the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch. |
||
} | ||
while (entries.hasMoreElements()) { | ||
LedgerEntry e = entries.nextElement(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we from the entry 0 to start read, so here we should make
lastRead + 1
to compare with lastConfirmed.