Skip to content

Commit

Permalink
create indexes in background, to not prevent startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dsschult committed Jul 10, 2020
1 parent 299766f commit 0c01926
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions file_catalog/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,30 @@ def __init__(self, host=None, port=None, authSource=None, username=None, passwor
authSource=authSource,
username=username, password=password).file_catalog

self.client.files.create_index('uuid', unique=True)
self.client.files.create_index('logical_name', unique=True)
self.client.files.create_index([('logical_name',pymongo.HASHED)])
self.client.files.create_index('locations', unique=True)
self.client.files.create_index([('locations.site',pymongo.DESCENDING),('locations.path',pymongo.DESCENDING)])
self.client.files.create_index('locations.archive')
self.client.files.create_index('create_date')
self.client.files.create_index('content_status')
self.client.files.create_index('processing_level', sparse=True)
self.client.files.create_index('run_number', sparse=True)
self.client.files.create_index('start_datetime', sparse=True)
self.client.files.create_index('end_datetime', sparse=True)
self.client.files.create_index('offline_processing_metadata.first_event', sparse=True)
self.client.files.create_index('offline_processing_metadata.last_event', sparse=True)
self.client.files.create_index('offline.season', sparse=True)
self.client.files.create_index('iceprod.dataset', sparse=True)

self.client.collections.create_index('uuid', unique=True)
self.client.collections.create_index('collection_name')
self.client.collections.create_index('owner')

self.client.snapshots.create_index('uuid', unique=True)
self.client.snapshots.create_index('collection_id')
self.client.snapshots.create_index('owner')
self.client.files.create_index('uuid', unique=True, background=True)
self.client.files.create_index('logical_name', unique=True, background=True)
self.client.files.create_index([('logical_name',pymongo.HASHED)], background=True)
self.client.files.create_index('locations', unique=True, background=True)
self.client.files.create_index([('locations.site',pymongo.DESCENDING),('locations.path',pymongo.DESCENDING)], background=True)
self.client.files.create_index('locations.archive', background=True)
self.client.files.create_index('create_date', background=True)
self.client.files.create_index('content_status', background=True)
self.client.files.create_index('processing_level', sparse=True, background=True)
self.client.files.create_index('run_number', sparse=True, background=True)
self.client.files.create_index('start_datetime', sparse=True, background=True)
self.client.files.create_index('end_datetime', sparse=True, background=True)
self.client.files.create_index('offline_processing_metadata.first_event', sparse=True, background=True)
self.client.files.create_index('offline_processing_metadata.last_event', sparse=True, background=True)
self.client.files.create_index('offline_processing_metadata.season', sparse=True, background=True)
self.client.files.create_index('iceprod.dataset', sparse=True, background=True)

self.client.collections.create_index('uuid', unique=True, background=True)
self.client.collections.create_index('collection_name', background=True)
self.client.collections.create_index('owner', background=True)

self.client.snapshots.create_index('uuid', unique=True, background=True)
self.client.snapshots.create_index('collection_id', background=True)
self.client.snapshots.create_index('owner', background=True)

self.executor = ThreadPoolExecutor(max_workers=10)
logger.info('done setting up Mongo')
Expand Down

0 comments on commit 0c01926

Please # to comment.