Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Compaction should dump invalid entry body length instead of the whole…
Browse files Browse the repository at this point in the history
… entry body

Reviewers: psu, jbull, fcuny, drusek, sijieg, mpatidar, lstewart

Reviewed By: sijieg

Subscribers: #rb_ds-messaging

Differential Revision: https://phabricator.twitter.biz/D19613
  • Loading branch information
Yiming Zang authored and Sijie Guo committed Mar 17, 2017
1 parent 540eeb9 commit 279933b
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,9 @@ public void process(final long ledgerId, long offset, ByteBuffer entry)
long entryId = entry.getLong();
entry.rewind();

if(entryId < 0) {
String hexEntry = dumpEntryToHexString(entry);
LOG.warn("Invalid entry with negative entryId found @ offset {} for ledger {}. " +
"Entry body in hex format is: {}", new Object[] { offset, lid, hexEntry});
if (entryId < 0) {
LOG.warn("Invalid entry found with negative entryId {} @ offset {} for ledger {}. " +
"Entry size is: {}", new Object[]{entryId, offset, lid, entry.remaining()});
}

long newoffset = entryLogger.addEntry(ledgerId, entry);
Expand Down Expand Up @@ -314,13 +313,6 @@ synchronized void flush() throws IOException {
deletedLedgers.clear();
}

private String dumpEntryToHexString(ByteBuffer entry) {
entry.rewind();
byte[] buf = new byte[entry.remaining()];
entry.get(buf);
entry.rewind();
return Hex.encodeHexString(buf);
}
}


Expand Down

0 comments on commit 279933b

Please sign in to comment.