Skip to content

Commit e20cc85

Browse files
author
Edward J M Easton
committed
ReviewFix: always use primary for has_symbol, it's safer.
1 parent e7e2700 commit e20cc85

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

arctic/store/version_store.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def list_symbols(self, all_symbols=False, snapshot=None, regex=None, **kwargs):
172172
return sorted([x['symbol'] for x in results])
173173

174174
@mongo_retry
175-
def has_symbol(self, symbol, as_of=None, allow_secondary=None):
175+
def has_symbol(self, symbol, as_of=None):
176176
"""
177177
Return True if the 'symbol' exists in this library AND the symbol
178178
isn't deleted in the specified as_of.
@@ -188,14 +188,10 @@ def has_symbol(self, symbol, as_of=None, allow_secondary=None):
188188
`int` : specific version number
189189
`str` : snapshot name which contains the version
190190
`datetime.datetime` : the version of the data that existed as_of the requested point in time
191-
allow_secondary : `bool` or `None`
192-
Override the default behavior for allowing reads from secondary members of a cluster:
193-
`None` : use the settings from the top-level `Arctic` object used to query this version store.
194-
`True` : allow reads from secondary members
195-
`False` : only allow reads from primary members
196191
"""
197192
try:
198-
self._read_metadata(symbol, as_of=as_of, read_preference=self._read_preference(allow_secondary))
193+
# Always use the primary for has_symbol, it's safer
194+
self._read_metadata(symbol, as_of=as_of, read_preference=ReadPreference.PRIMARY)
199195
return True
200196
except NoDataFoundException:
201197
return False
@@ -667,7 +663,7 @@ def delete(self, symbol):
667663
'metadata.deleted': {'$ne': True}})
668664
if not snapped_version:
669665
self._delete_version(symbol, sentinel.version)
670-
assert not self.has_symbol(symbol, allow_secondary=False)
666+
assert not self.has_symbol(symbol)
671667

672668
def _write_audit(self, user, message, changed_version):
673669
"""

0 commit comments

Comments
 (0)