From 279933b1fa70ba5013dd925f1457dc8de2d6ae47 Mon Sep 17 00:00:00 2001 From: Yiming Zang Date: Tue, 17 Jan 2017 17:52:15 -0800 Subject: [PATCH] Compaction should dump invalid entry body length instead of the whole entry body Reviewers: psu, jbull, fcuny, drusek, sijieg, mpatidar, lstewart Reviewed By: sijieg Subscribers: #rb_ds-messaging Differential Revision: https://phabricator.twitter.biz/D19613 --- .../bookkeeper/bookie/GarbageCollectorThread.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java index 3c98569e..ae179457 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java @@ -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); @@ -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); - } }