pkumar-singh commented on a change in pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#discussion_r781503491



##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ReadCache.java
##########
@@ -90,6 +93,10 @@ public void put(long ledgerId, long entryId, ByteBuf entry) {
         lock.readLock().lock();
 
         try {
+            if (entrySize > segmentSize) {
+                log.warn("entrySize {} > segmentSize {}, skip update read 
cache!", entrySize, segmentSize);
+                return;
+            }
             int offset = currentSegmentOffset.getAndAdd(alignedSize);
             if (offset + entrySize > segmentSize) {
                 // Roll-over the segment (outside the read-lock)

Review comment:
       If you must return it can be returned from here, instead of rewriting 
this segment.
    if (entrySize > segmentSize) {
                   log.warn("entrySize {} > segmentSize {}, skip update read 
cache!", entrySize, segmentSize);
                   return;
               } 




-- 
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]


Reply via email to