Skip to content

Commit 93c22fb

Browse files
jamesblackburnbmoscon
authored andcommitted
MDP-1292 Don't ensure_index on every VersionStore.append() / write() (pandas-dev#265)
1 parent 9b76afd commit 93c22fb

File tree

3 files changed

+1
-16
lines changed

3 files changed

+1
-16
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Bugfix: #249 open ended range reads on data without index fail
99
* Bugfix: #262 VersionStore.append must check data is written correctly during repack
1010
* Bugfix: #263 Quota: Improve the error message when near soft-quota limit
11+
* Perf: #265 VersionStore.write / append don't aggressively add indexes on each write
1112

1213
### 1.31 (2016-09-29)
1314

arctic/store/version_store.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ def append(self, symbol, data, metadata=None, prune_previous_version=True, upser
465465
upsert : `bool`
466466
Write 'data' if no previous version exists.
467467
"""
468-
self._ensure_index()
469468
self._arctic_lib.check_quota()
470469
version = {'_id': bson.ObjectId()}
471470
version['symbol'] = symbol
@@ -556,7 +555,6 @@ def write(self, symbol, data, metadata=None, prune_previous_version=True, **kwar
556555
VersionedItem named tuple containing the metadata and verison number
557556
of the written symbol in the store.
558557
"""
559-
self._ensure_index()
560558
self._arctic_lib.check_quota()
561559
version = {'_id': bson.ObjectId()}
562560
version['symbol'] = symbol

tests/unit/store/test_version_store.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,6 @@ def test_read_metadata_no_asof():
129129
sort=[('version', pymongo.DESCENDING)])]
130130

131131

132-
def test_write_ensure_index():
133-
write_handler = Mock(write=Mock(__name__=""))
134-
vs = create_autospec(VersionStore, instance=True,
135-
_collection=Mock(),
136-
_version_nums=Mock(find_one_and_update=Mock(return_value={'version':1})),
137-
_versions=Mock(insert_one=lambda x:None),
138-
_arctic_lib=Mock(),
139-
_publish_changes=False)
140-
vs._collection.database.connection.nodes = []
141-
vs._write_handler.return_value = write_handler
142-
VersionStore.write(vs, 'sym', sentinel.data, prune_previous_version=False)
143-
vs._ensure_index.assert_called_once_with()
144-
145-
146132
def test_write_check_quota():
147133
write_handler = Mock(write=Mock(__name__=""))
148134
vs = create_autospec(VersionStore, instance=True,

0 commit comments

Comments
 (0)