wenbingshen opened a new pull request, #3965:
URL: https://github.com/apache/bookkeeper/pull/3965

   ### Motivation
   
   When the DefaultEntryLogger fails to delete the entryLogFile, it will still 
clear the corresponding entryLogId from the entryLogMetaMap. When the 
entryLogFile file exists, the GC thread will scan all the entryLogFile files 
and rebuild the LogMeta information of the entryLogFile that is not in the 
entryLogMetaMap when the next GC is executed. This will bring To unnecessary 
additional disk IO, it is necessary to scan the entire entryLogFile file in 
severe cases.
   
   ```java
       public void runWithFlags(boolean force, boolean suspendMajor, boolean 
suspendMinor) {
               ......
               extractMetaFromEntryLogs();  // 1
               ......
       }
   ```
   
   ```java
       public EntryLogMetadata getEntryLogMetadata(long entryLogId, 
AbstractLogCompactor.Throttler throttler)
           throws IOException {
           // First try to extract the EntryLogMetadata from the index, if 
there's no index then fallback to scanning the
           // entry log
           try {
               return extractEntryLogMetadataFromIndex(entryLogId);     <== 
here scan from index
           } catch (Exception e) {
               LOG.info("Failed to get ledgers map index from: {}.log : {}", 
entryLogId, e.getMessage());
   
               // Fall-back to scanning
               return extractEntryLogMetadataByScanning(entryLogId, throttler); 
     <== here scan all entryLogFile
           }
       }
   
   ```


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