in ambari-infra-solr-client/src/main/python/migrationHelper.py [0:0]
def backup_collections(options, accessor, parser, config, service_filter):
collections=list_collections(options, config, COLLECTIONS_DATA_JSON_LOCATION.format("backup_collections.json"), include_number_of_docs=True)
collections=filter_collections(options, collections)
num_docs_map = get_number_of_docs_map(COLLECTIONS_DATA_JSON_LOCATION.format("backup_collections.json"))
if is_ranger_available(config, service_filter):
collection_name = config.get('ranger_collection', 'ranger_collection_name')
if collection_name in collections:
if is_collection_empty(num_docs_map, collection_name):
print("Collection '{0}' is empty. Backup is not required.".format(collection_name))
else:
ranger_index_location=get_ranger_index_location(collection_name, config, options)
do_backup_request(options, accessor, parser, config, collection_name, ranger_index_location)
else:
print('Collection {0} does not exist or filtered out. Skipping backup operation.'.format(collection_name))
if is_atlas_available(config, service_filter):
fulltext_index_collection = config.get('atlas_collections', 'fulltext_index_name')
if fulltext_index_collection in collections:
if is_collection_empty(num_docs_map, fulltext_index_collection):
print("Collection '{0}' is empty. Backup is not required.".format(fulltext_index_collection))
else:
fulltext_index_location = get_atlas_index_location(fulltext_index_collection, config, options)
do_backup_request(options, accessor, parser, config, fulltext_index_collection, fulltext_index_location)
else:
print('Collection {0} does not exist or filtered out. Skipping backup operation.'.format(fulltext_index_collection))
vertex_index_collection = config.get('atlas_collections', 'vertex_index_name')
if vertex_index_collection in collections:
if is_collection_empty(num_docs_map, vertex_index_collection):
print("Collection '{0}' is empty. Backup is not required.".format(vertex_index_collection))
else:
vertex_index_location = get_atlas_index_location(vertex_index_collection, config, options)
do_backup_request(options, accessor, parser, config, vertex_index_collection, vertex_index_location)
else:
print('Collection {0} does not exist or filtered out. Skipping backup operation.'.format(vertex_index_collection))
edge_index_collection = config.get('atlas_collections', 'edge_index_name')
if edge_index_collection in collections:
if is_collection_empty(num_docs_map, edge_index_collection):
print("Collection '{0}' is empty. Backup is not required.".format(edge_index_collection))
else:
edge_index_location = get_atlas_index_location(edge_index_collection, config, options)
do_backup_request(options, accessor, parser, config, edge_index_collection, edge_index_location)
else:
print('Collection {0} does not exist or filtered out. Skipping backup operation.'.format(edge_index_collection))