eolivelli commented on code in PR #4161:
URL: https://github.com/apache/bookkeeper/pull/4161#discussion_r1435149593
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java:
##########
@@ -1036,16 +1037,33 @@ public void scanEntryLog(long entryLogId,
EntryLogScanner scanner) throws IOExce
}
// read the entry
data.clear();
- data.capacity(entrySize);
- int rc = readFromLogChannel(entryLogId, bc, data, pos);
- if (rc != entrySize) {
- LOG.warn("Short read for ledger entry from entryLog {}@{}
({} != {})",
- entryLogId, pos, rc, entrySize);
- return;
+ int rc;
+ // process the entry based on the read length type
+ switch (scanner.getReadLengthType()) {
+ case READ_NOTHING:
+ // skip read
+ scanner.process(ledgerId, offset, entrySize);
+ break;
+ case READ_LEDGER_ENTRY_ID:
+ data.capacity(READ_LEDGER_ENTRY_ID.getLengthToRead());
+ rc = readFromLogChannel(entryLogId, bc, data, pos);
+ if (rc != READ_LEDGER_ENTRY_ID.getLengthToRead()) {
+ LOG.warn("Short read for ledger entry id from
entrylog {}", entryLogId);
+ return;
+ }
+ long entryId = data.getLong(Long.BYTES);
+ scanner.process(ledgerId, offset, entrySize, entryId);
+ break;
+ case READ_ALL:
+ data.capacity(entrySize);
+ rc = readFromLogChannel(entryLogId, bc, data, pos);
+ if (rc != entrySize) {
+ LOG.warn("Short read for ledger entry id from
entrylog {}", entryLogId);
+ return;
+ }
+ scanner.process(ledgerId, offset, data);
+ break;
Review Comment:
please add the "default" case
--
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]