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

   ### Motivation
   
   Now we have written indexDir into Cookie in #3372 .
   
   When we configure an independent indexDir, the `FileSystemUpgrade` tool will 
fail when the cookie is an old version or a new cookie version will be added in 
the future, because it does not consider indexDirs when upgrading, so we should 
add indexDirs to the upgrade step.
   
   ### Changes
   You can use the following two implementations of getAllDirectories in 
FileSystemUpgrade, and then run some tests added by this PR in UpgradeTest, and 
you will find that the first implementation will fail the test, while the 
second implementation will succeed.
   1:
   ```java
       private static List<File> getAllDirectories(ServerConfiguration conf) {
           List<File> dirs = new ArrayList<>();
           dirs.addAll(Lists.newArrayList(conf.getJournalDirs()));
           Collections.addAll(dirs, conf.getLedgerDirs());
           return dirs;
       }
   ```
   
![image](https://user-images.githubusercontent.com/35599757/216272842-e21cf916-0bf7-4d88-ad24-2864d5b207ec.png)
   
   
   2:
   ```java
       private static List<File> getAllDirectories(ServerConfiguration conf) {
           List<File> dirs = new ArrayList<>();
           dirs.addAll(Lists.newArrayList(conf.getJournalDirs()));
           final File[] ledgerDirs = conf.getLedgerDirs();
           final File[] indexDirs = conf.getIndexDirs();
           if (indexDirs != null && indexDirs != ledgerDirs) {
               dirs.addAll(Lists.newArrayList(indexDirs));
           }
           Collections.addAll(dirs, ledgerDirs);
           return dirs;
       }
   ```
   
![image](https://user-images.githubusercontent.com/35599757/216273056-608267be-9631-46fc-9046-a5431f764363.png)
   
   


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