Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/man-group/arctic
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerr, Duncan (London) authored and Kerr, Duncan (London) committed Jan 20, 2022
2 parents c01edcf + 97947b2 commit 7670ea5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion arctic/store/version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def _last_version_seqnum(self, symbol):
last_seq = self._version_nums.find_one({'symbol': symbol})
return last_seq['version'] if last_seq else 0

# new index named because of 127 char restriction on fully qualified index names
@mongo_retry
def _ensure_index(self):
collection = self._collection
Expand All @@ -79,7 +80,9 @@ def _ensure_index(self):
background=True)
collection.versions.create_index([('symbol', pymongo.ASCENDING), ('version', pymongo.DESCENDING)], unique=True,
background=True)
collection.versions.create_index([('symbol', pymongo.ASCENDING), ('version', pymongo.DESCENDING), ('metadata.deleted', pymongo.ASCENDING)],
collection.versions.create_index([('symbol', pymongo.ASCENDING), ('version', pymongo.DESCENDING),
('metadata.deleted', pymongo.ASCENDING)],
name='versionstore_idx',
background=True)
collection.version_nums.create_index('symbol', unique=True, background=True)
for th in _TYPE_HANDLERS:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_indexes(arctic):
u'ns': u'arctic.library.versions',
u'unique': True,
u'v': index_version},
u'symbol_1_version_-1_metadata.deleted_1': {u'background': True,
u'versionstore_idx': {u'background': True,
u'key': [(u'symbol', 1), (u'version', -1), (u'metadata.deleted', 1)],
u'ns': u'arctic.library.versions',
u'v': index_version}}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/store/test_version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_ensure_index():
assert vs._collection.versions.create_index.call_args_list == [
call([('symbol', 1), ('_id', -1)], background=True),
call([('symbol', 1), ('version', -1)], unique=True, background=True),
call([('symbol', 1), ('version', -1), ('metadata.deleted', 1)], background=True),
call([('symbol', 1), ('version', -1), ('metadata.deleted', 1)], background=True, name='versionstore_idx'),
]
assert vs._collection.version_nums.create_index.call_args_list == [call('symbol', unique=True, background=True)]
th._ensure_index.assert_called_once_with(vs._collection)
Expand Down

0 comments on commit 7670ea5

Please sign in to comment.