MCPcopy Create free account
hub / github.com/apache/solr / runImpl

Method runImpl

solr/core/src/java/org/apache/solr/cli/ZkMvTool.java:70–100  ·  view source on GitHub ↗
(CommandLine cli)

Source from the content-addressed store, hash-verified

68 }
69
70 @Override
71 public void runImpl(CommandLine cli) throws Exception {
72 String zkHost = CLIUtils.getZkHost(cli);
73
74 try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) {
75 echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...");
76 String src = cli.getArgs()[0];
77 String dst = cli.getArgs()[1];
78
79 if (src.toLowerCase(Locale.ROOT).startsWith("file:")
80 || dst.toLowerCase(Locale.ROOT).startsWith("file:")) {
81 throw new SolrServerException(
82 "mv command operates on znodes and 'file:' has been specified.");
83 }
84 String source = src;
85 if (src.toLowerCase(Locale.ROOT).startsWith("zk")) {
86 source = src.substring(3);
87 }
88
89 String dest = dst;
90 if (dst.toLowerCase(Locale.ROOT).startsWith("zk")) {
91 dest = dst.substring(3);
92 }
93
94 echo("Moving Znode " + source + " to " + dest + " on ZooKeeper at " + zkHost);
95 zkClient.moveZnode(source, dest);
96 } catch (Exception e) {
97 log.error("Could not complete mv operation for reason: ", e);
98 throw (e);
99 }
100 }
101}

Callers

nothing calls this directly

Calls 8

getZkHostMethod · 0.95
getSolrZkClientMethod · 0.95
echoIfVerboseMethod · 0.80
echoMethod · 0.80
getArgsMethod · 0.45
substringMethod · 0.45
moveZnodeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected