You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "wenbingshen (via GitHub)" <gi...@apache.org> on 2023/05/19 07:12:34 UTC

[GitHub] [bookkeeper] wenbingshen commented on a diff in pull request #3956: Support skip invalid journal record in replying journal stage

wenbingshen commented on code in PR #3956:
URL: https://github.com/apache/bookkeeper/pull/3956#discussion_r1198624139


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java:
##########
@@ -827,22 +828,32 @@ public long scanJournal(long journalId, long journalPos, JournalScanner scanner)
                 }
                 boolean isPaddingRecord = false;
                 if (len < 0) {
-                    if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) {
-                        // skip padding bytes
-                        lenBuff.clear();
-                        fullRead(recLog, lenBuff);
-                        if (lenBuff.remaining() != 0) {
-                            break;
+                    try {
+                        if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) {
+                            // skip padding bytes
+                            lenBuff.clear();
+                            fullRead(recLog, lenBuff);
+                            if (lenBuff.remaining() != 0) {
+                                break;
+                            }
+                            lenBuff.flip();

Review Comment:
   line 820 may throw IOException, this may cause bookie startup failed ==>  fullRead(recLog, lenBuff);
   In this PR, line 835 also may throw IOException, because this future the bookie can continue starting.
   Same behavior here, two results, right?
   
   https://github.com/apache/bookkeeper/pull/3956/files#diff-0a79d54e3dfd4bab1d85510ef957f8f4b7ab6f6acd09aadd634b4d7bbee6e1f4R815-R821
   ```java
               while (true) {
                   // entry start offset
                   long offset = recLog.fc.position();
                   // start reading entry
                   lenBuff.clear();
                   fullRead(recLog, lenBuff);
   ```



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

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