Skip to content
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

BenchReadThroughputLatency support config the way of gen ledger path. #4219

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.bookkeeper.client.LedgerEntry;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.bookkeeper.util.StringUtils;
import org.apache.bookkeeper.zookeeper.ZooKeeperClient;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Expand Down Expand Up @@ -153,6 +154,9 @@ public static void main(String[] args) throws Exception {
Options options = new Options();
options.addOption("ledger", true, "Ledger to read. If empty, read all ledgers which come available. "
+ " Cannot be used with -listen");
//How to generate ledger node path.
options.addOption("ledgerManagerType", true, "The ledger manager type. "
+ "The optional value: flat, hierarchical, legacyHierarchical, longHierarchical. Default: flat");
options.addOption("listen", true, "Listen for creation of <arg> ledgers, and read each one fully");
options.addOption("password", true, "Password used to access ledgers (default 'benchPasswd')");
options.addOption("zookeeper", true, "Zookeeper ensemble, default \"localhost:2181\"");
Expand Down Expand Up @@ -190,7 +194,21 @@ public static void main(String[] args) throws Exception {
}

final CountDownLatch shutdownLatch = new CountDownLatch(1);
final String nodepath = String.format("/ledgers/L%010d", ledger.get());

String ledgerManagerType = cmd.getOptionValue("ledgerManagerType", "flat");
String nodepath;
if ("flat".equals(ledgerManagerType)) {
nodepath = String.format("/ledgers/L%010d", ledger.get());
} else if ("hierarchical".equals(ledgerManagerType)) {
nodepath = String.format("/ledgers%s", StringUtils.getHybridHierarchicalLedgerPath(ledger.get()));
} else if ("legacyHierarchical".equals(ledgerManagerType)) {
nodepath = String.format("/ledgers%s", StringUtils.getShortHierarchicalLedgerPath(ledger.get()));
} else if ("longHierarchical".equals(ledgerManagerType)) {
nodepath = String.format("/ledgers%s", StringUtils.getLongHierarchicalLedgerPath(ledger.get()));
} else {
LOG.warn("Unknown ledger manager type: {}, use flat as the value", ledgerManagerType);
nodepath = String.format("/ledgers/L%010d", ledger.get());
}

final ClientConfiguration conf = new ClientConfiguration();
conf.setReadTimeout(sockTimeout).setZkServers(servers);
Expand Down
Loading