Skip to content
Permalink
Browse files
[bookie-server-config] Avoid considering empty journalDirectories
As discussed at : apache/pulsar#6042

### Issue
We have config management tool which manages bookie-server configuration and sets empty value of `journalDirectories` if bookie-server is still wants to use single journal dir: `journalDirectory`. In this case, bookie-server doesn't consider `journalDirectory` value and keeps empty list of `journalDirectories` which stats bookie with invalid configuration.

### Expected behavior
Bookie-server should parse empty configuration `journalDirectories=` properly and avoid picking up empty value of `journalDirectories` and in that case, bookie-server should fallback to `journalDirectory` config.

Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Sijie Guo <None>

This closes #2245 from rdhabalia/journal_dir
  • Loading branch information
rdhabalia committed Mar 31, 2020
1 parent 665565e commit e7430ce25e3609bf77b028e4f0475dad2147c22d
Showing 1 changed file with 4 additions and 2 deletions.
@@ -41,6 +41,7 @@
import org.apache.bookkeeper.stats.NullStatsProvider;
import org.apache.bookkeeper.stats.StatsProvider;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.lang3.StringUtils;

/**
* Configuration manages server-side settings.
@@ -1096,8 +1097,9 @@ public ServerConfiguration setAllowStorageExpansion(boolean val) {
*/
public String[] getJournalDirNames() {
String[] journalDirs = this.getStringArray(JOURNAL_DIRS);
if (journalDirs == null || journalDirs.length == 0) {
return new String[] {getJournalDirName()};
if (journalDirs == null || journalDirs.length == 0
|| (journalDirs.length == 1 && StringUtils.isEmpty(journalDirs[0]))) {
return new String[] { getJournalDirName() };
}
return journalDirs;
}

0 comments on commit e7430ce

Please sign in to comment.