@@ -842,42 +842,6 @@ public ByteBuf readEntry(long location) throws IOException, Bookie.NoEntryExcept
842842 return internalReadEntry (-1L , -1L , location , false /* validateEntry */ );
843843 }
844844
845- @ Override
846- public ByteBuf readEntryIfFits (long ledgerId , long entryId , long entryLocation , long maxEntrySize )
847- throws IOException , Bookie .NoEntryException {
848- long entryLogId = logIdForOffset (entryLocation );
849- long pos = posForOffset (entryLocation );
850-
851- BufferedReadChannel fc = null ;
852- int entrySize ;
853- try {
854- fc = getFCForEntryInternal (ledgerId , entryId , entryLogId , pos );
855-
856- ByteBuf sizeBuff = readEntrySize (ledgerId , entryId , entryLogId , pos , fc );
857- entrySize = sizeBuff .getInt (0 );
858- if (entrySize + Integer .BYTES > maxEntrySize ) {
859- // Oversized entries are treated as budget misses; a later unbounded read will validate them.
860- return null ;
861- }
862- validateEntry (ledgerId , entryId , entryLogId , pos , sizeBuff );
863- } catch (EntryLookupException e ) {
864- throw new IOException ("Bad entry read from log file id: " + entryLogId , e );
865- }
866-
867- ByteBuf data = allocator .buffer (entrySize , entrySize );
868- int rc = readFromLogChannel (entryLogId , fc , data , pos );
869- if (rc != entrySize ) {
870- ReferenceCountUtil .release (data );
871- throw new IOException ("Bad entry read from log file id: " + entryLogId ,
872- new EntryLookupException ("Short read for " + ledgerId + "@"
873- + entryId + " in " + entryLogId + "@"
874- + pos + "(" + rc + "!=" + entrySize + ")" ));
875- }
876- data .writerIndex (entrySize );
877- return data ;
878- }
879-
880-
881845 private ByteBuf internalReadEntry (long ledgerId , long entryId , long location , boolean validateEntry )
882846 throws IOException , Bookie .NoEntryException {
883847 long entryLogId = logIdForOffset (location );
0 commit comments