-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve] Support specifying multiple journalDirs for the bookie server start cmd options #4181
Open
zwOvO
wants to merge
9
commits into
apache:master
Choose a base branch
from
zwOvO:multiple_journalDirs_cmd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ee29e28
Support specifying multiple journalDir as bookie start command parame…
zwOvO 839afd7
fix sJournalDirs is string array
zwOvO 3b535f0
update conf#journalDirectories for gke\docer bookkeeper
zwOvO 0ff1615
update conf#journalDirectories for gke\docer bookkeeper v2
zwOvO 02d637a
update conf#journalDirectories for gke\docer bookkeeper v3
zwOvO 2220764
fix getOptionValues
zwOvO 51489ca
Delete extra spaces
zwOvO f252258
Delete extra spaces
zwOvO 1e5a985
Iteration from BK_journalDirectory to BK_JohannalDirectories and ensu…
zwOvO File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,9 @@ public class Main { | |
BK_OPTS.addOption("m", "zkledgerpath", true, "Zookeeper ledgers root path"); | ||
BK_OPTS.addOption("p", "bookieport", true, "bookie port exported"); | ||
BK_OPTS.addOption("hp", "httpport", true, "bookie http port exported"); | ||
BK_OPTS.addOption("j", "journal", true, "bookie journal directory"); | ||
Option journalDirs = new Option ("j", "journaldirs", true, "bookie journal directories"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eolivelli I didn't break the compatibility |
||
journalDirs.setArgs(10); | ||
BK_OPTS.addOption(journalDirs); | ||
Option indexDirs = new Option ("i", "indexdirs", true, "bookie index directories"); | ||
indexDirs.setArgs(10); | ||
BK_OPTS.addOption(indexDirs); | ||
|
@@ -81,8 +83,10 @@ private static void printUsage() { | |
+ "The settings in configuration file will be overwrite by provided arguments.\n" | ||
+ "Options including:\n"; | ||
String footer = "Here is an example:\n" | ||
+ "\tBookieServer -c bookie.conf -z localhost:2181 -m /bookkeeper/ledgers " | ||
+ "-p 3181 -j /mnt/journal -i \"/mnt/index1 /mnt/index2\"" | ||
+ "\tBookieServer -c bookie.conf -z localhost:2181 -m /bookkeeper/ledgers" | ||
+ " -p 3181" | ||
+ " -j \"/mnt/journal1 /mnt/journal2\"" | ||
+ " -i \"/mnt/index1 /mnt/index2\"" | ||
+ " -l \"/mnt/ledger1 /mnt/ledger2 /mnt/ledger3\"\n"; | ||
hf.printHelp("BookieServer [options]\n", header, BK_OPTS, footer, true); | ||
} | ||
|
@@ -165,9 +169,12 @@ private static ServerConfiguration parseArgs(String[] args) | |
} | ||
|
||
if (cmdLine.hasOption('j')) { | ||
String sJournalDir = cmdLine.getOptionValue('j'); | ||
log.info("Get cmdline journal dir: {}", sJournalDir); | ||
conf.setJournalDirName(sJournalDir); | ||
String[] sJournalDirs = cmdLine.getOptionValues('j'); | ||
log.info("Get cmdline journal dirs: "); | ||
for (String journal : sJournalDirs) { | ||
log.info("journalDir : {}", journal); | ||
} | ||
conf.setJournalDirsName(sJournalDirs); | ||
} | ||
|
||
if (cmdLine.hasOption('i')) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ export BK_metadataServiceUri=${BK_metadataServiceUri:-"zk://${BK_zkServers}${BK_ | |
export BK_bookiePort=${BK_bookiePort:-${PORT0}} | ||
export BK_httpServerEnabled=${BK_httpServerEnabled:-"true"} | ||
export BK_httpServerPort=${BK_httpServerPort:-${BOOKIE_HTTP_PORT}} | ||
export BK_journalDirectory=${BK_journalDirectory:-${BK_DATA_DIR}/journal} | ||
export BK_journalDirectories=${BK_journalDirectories:-${BK_journalDirectory:-${BK_DATA_DIR}/journal}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @liangyuanpeng PTAL |
||
export BK_ledgerDirectories=${BK_ledgerDirectories:-${BK_DATA_DIR}/ledgers} | ||
export BK_indexDirectories=${BK_indexDirectories:-${BK_ledgerDirectories}} | ||
# dlog | ||
|
@@ -55,7 +55,7 @@ echo "" | |
echo " [bookie]" | ||
echo " BK_bookiePort bookie service port is $BK_bookiePort" | ||
echo " BK_DATA_DIR is $BK_DATA_DIR" | ||
echo " BK_journalDirectory is ${BK_journalDirectory}" | ||
echo " BK_journalDirectories is ${BK_journalDirectories}" | ||
echo " BK_ledgerDirectories are ${BK_ledgerDirectories}" | ||
echo " BK_indexDirectories are ${BK_indexDirectories}" | ||
echo "" | ||
|
@@ -77,15 +77,15 @@ export BOOKIE_CONF=${BK_HOME}/conf/bk_server.conf | |
export SERVICE_PORT=${PORT0} | ||
|
||
function create_bookie_dirs() { | ||
mkdir -p "${BK_journalDirectory}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" | ||
mkdir -p "${BK_journalDirectories}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" | ||
echo "Created bookie dirs : " | ||
echo " journal = ${BK_journalDirectory}" | ||
echo " journal = ${BK_journalDirectories}" | ||
echo " ledger = ${BK_ledgerDirectories}" | ||
echo " index = ${BK_indexDirectories}" | ||
# -------------- # | ||
# Allow the container to be started with `--user` | ||
if [ "$(id -u)" = '0' ]; then | ||
chown -R "${BK_USER}:${BK_USER}" "${BK_journalDirectory}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" | ||
chown -R "${BK_USER}:${BK_USER}" "${BK_journalDirectories}" "${BK_ledgerDirectories}" "${BK_indexDirectories}" | ||
fi | ||
# -------------- # | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is a broken change? What happens if people still use BK_journalDirectory instead of BK_journalDirectories after upgrading?
We can retain the original parameters to ensure compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't break compatibility