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

   ### Motivation
   
   Fixes issue #2665 
   
   When the disk is full, `InterleavedLedgerStorage` creates a new entryLog and 
index file, copies and moves the old index `FileInfo` to the new directory, and 
finally deletes the old index file.
   
   The old file of `FileInfo` was `deleted`, but it was copied and moved to a 
new directory. Therefore, the delete status flag should be restored. If it is 
not set to false,`checkOpen` will throw `FileInfoDeletedException` when judging 
the fence status of `ledgerHandle` when adding an entry, causing the writing to 
fail. When the client changes the `ensemble`, it throws an exception because 
the test has only two bookie nodes and cannot satisfy the two writeSet: `Not 
enough non-faulty bookies available`.
   ```java
       public synchronized boolean isFenced() throws IOException {
           checkOpen(false);
           return (stateBits & STATE_FENCED_BIT) == STATE_FENCED_BIT;
       }
   
       private synchronized void checkOpen(boolean create, boolean 
openBeforeClose)
               throws IOException {
           if (deleted) {
               throw new FileInfoDeletedException();
           }
         .....
       }
   ``` 
   
   ### Changes
   When `FileInfo` moves to a new directory by `moveToNewLocation`,delete the 
old index file and restore the `delete` flag, because the new index file is 
ready.
   
   
   Set the disk check interval to the `Integer.MAX_VALUE`, which is stable 
   `assertEquals("writable dirs should have one dir", 1, ledgerDirsManager
                   .getWritableLedgerDirs().size());`
   Because once the test thrashes, the disk check thread will restore the full 
disk to a writable state.
   ```java
   newConf.setDiskCheckInterval(Integer.MAX_VALUE);
   ```
   
   


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