You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/01/10 07:49:03 UTC

[GitHub] [bookkeeper] lordcheng10 opened a new pull request #2982: fix ReadCache bad case : entrySize > segmentSize

lordcheng10 opened a new pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982


   ### Motivation
   If entrySize > segmentSize ,will throw IndexOutOfBoundsException when put entry into ReadCache.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1009578149


   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1008994897


   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh commented on a change in pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
pkumar-singh commented on a change in pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#discussion_r781509902



##########
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:
       Never mind. I misread the code.




-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1010382383


   ping


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1008994629


   rerun failure checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
pkumar-singh commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1009298782


   LGTM.


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1009623895


   ping


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1008771666


   /pulsarbot run-failure-checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh commented on a change in pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on a change in pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on a change in pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#discussion_r781711779



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ReadCache.java
##########
@@ -46,6 +48,7 @@
  * the read cache.
  */

Review comment:
       OK I will fix




-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh commented on a change in pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1008938075


   /pulsarbot run-failure-checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] lordcheng10 commented on pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#issuecomment-1008992815


   /pulsarbot run-failure-checks


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh commented on a change in pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
pkumar-singh commented on a change in pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982#discussion_r781504327



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/ReadCache.java
##########
@@ -46,6 +48,7 @@
  * the read cache.
  */

Review comment:
       Consider using @Slf4j annotation. It will have the same effect. 




-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] pkumar-singh merged pull request #2982: fix ReadCache bad case : entrySize > segmentSize

Posted by GitBox <gi...@apache.org>.
pkumar-singh merged pull request #2982:
URL: https://github.com/apache/bookkeeper/pull/2982


   


-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org