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;
}
```

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;
}
```

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