MCPcopy
hub / github.com/OpenTSDB/opentsdb / main

Method main

src/tools/Search.java:53–86  ·  view source on GitHub ↗

Entry point to run the search utility @param args Command line arguments @throws Exception If something goes wrong

(String[] args)

Source from the content-addressed store, hash-verified

51 * @throws Exception If something goes wrong
52 */
53 public static void main(String[] args) throws Exception {
54 ArgP argp = new ArgP();
55 CliOptions.addCommon(argp);
56 argp.addOption("--use-data-table",
57 "Scan against the raw data table instead of the meta data table.");
58 args = CliOptions.parse(argp, args);
59 if (args == null) {
60 usage(argp, "Invalid usage");
61 System.exit(2);
62 } else if (args.length < 1) {
63 usage(argp, "Not enough arguments");
64 System.exit(2);
65 }
66
67 final boolean use_data_table = argp.has("--use-data-table");
68
69 Config config = CliOptions.getConfig(argp);
70 final TSDB tsdb = new TSDB(config);
71 tsdb.checkNecessaryTablesExist().joinUninterruptibly();
72
73 int rc;
74 try {
75 rc = runCommand(tsdb, use_data_table, args);
76 } finally {
77 try {
78 tsdb.getClient().shutdown().joinUninterruptibly();
79 LOG.info("Gracefully shutdown the TSD");
80 } catch (Exception e) {
81 LOG.error("Unexpected exception while shutting down", e);
82 rc = 42;
83 }
84 }
85 System.exit(rc);
86 }
87
88 /**
89 * Determines the command requested of the user can calls the appropriate

Callers

nothing calls this directly

Calls 11

addCommonMethod · 0.95
addOptionMethod · 0.95
parseMethod · 0.95
usageMethod · 0.95
hasMethod · 0.95
getConfigMethod · 0.95
runCommandMethod · 0.95
getClientMethod · 0.95
errorMethod · 0.80
shutdownMethod · 0.65

Tested by

no test coverage detected