Skip to content
Permalink
Browse files
AMBARI-23945. Create dump collections file even if no available colle…
…ctions.
  • Loading branch information
oleewere committed Jun 18, 2018
1 parent cdd8d03 commit 9453e260339d190f2c45c43b044abe31711f84b8
Showing 1 changed file with 10 additions and 11 deletions.
@@ -54,9 +54,8 @@ public DumpCollectionsCommand(int maxRetries, int interval, List<String> collect

@Override
protected String executeZkCommand(AmbariSolrCloudClient client, SolrZkClient zkClient, SolrZooKeeper solrZooKeeper) throws Exception {
Map<String, SolrCollection> collectionMap = new HashMap<>();
if (!this.collections.isEmpty()) {
ObjectMapper objectMapper = new ObjectMapper();
Map<String, SolrCollection> collectionMap = new HashMap<>();
for (String collection : this.collections) {
SolrCollection solrCollection = new SolrCollection();
Collection<Slice> slices = getSlices(client.getSolrCloudClient(), collection);
@@ -112,16 +111,16 @@ protected String executeZkCommand(AmbariSolrCloudClient client, SolrZkClient zkC
solrCollection.setName(collection);
collectionMap.put(collection, solrCollection);
}
File file = new File(client.getOutput());
if (!file.exists()) {
file.createNewFile();
}
final ObjectWriter objectWriter = objectMapper
.writerWithDefaultPrettyPrinter();
objectWriter.writeValue(file, collectionMap);
return objectWriter.writeValueAsString(collectionMap);
}
return null;
ObjectMapper objectMapper = new ObjectMapper();
final ObjectWriter objectWriter = objectMapper
.writerWithDefaultPrettyPrinter();
File file = new File(client.getOutput());
if (!file.exists()) {
file.createNewFile();
}
objectWriter.writeValue(file, collectionMap);
return objectWriter.writeValueAsString(collectionMap);
}

private String getHostFromNodeName(String nodeName) {

0 comments on commit 9453e26

Please sign in to comment.