in ambari-infra-solr-client/src/main/python/migrationHelper.py [0:0]
def evaluate_check_shard_result(collection, result, skip_index_size = False):
evaluate_result = {}
active_shards = result['active_shards']
all_shards = result['all_shards']
warnings = 0
print 30 * "-"
print "Number of shards: {0}".format(str(len(all_shards)))
for shard in all_shards:
if shard in active_shards:
print "{0}OK{1}: Found active leader replica for {2}" \
.format(colors.OKGREEN, colors.ENDC, shard)
else:
warnings=warnings+1
print "{0}WARNING{1}: Not found any active leader replicas for {2}, migration will probably fail, fix or delete the shard if it is possible." \
.format(colors.WARNING, colors.ENDC, shard)
if not skip_index_size:
index_size_map = result['index_size_map']
host_index_size_map = result['host_index_size_map']
if index_size_map:
print "Index size per shard for {0}:".format(collection)
for shard in index_size_map:
print " - {0}: {1}".format(shard, human_size(index_size_map[shard]))
if host_index_size_map:
print "Index size per host for {0} (consider this for backup): ".format(collection)
for host in host_index_size_map:
print " - {0}: {1}".format(host, human_size(host_index_size_map[host]))
evaluate_result['host_index_size_map'] = host_index_size_map
print 30 * "-"
evaluate_result['warnings'] = warnings
return evaluate_result