fix-#746: Stop ensure_indexes running on a secondaries unless connection is through mongos

This commit is contained in:
DavidBord
2014-08-24 10:48:54 +03:00
parent 41cfe5d2ca
commit c1b202c119
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -594,7 +594,9 @@ class Document(BaseDocument):
index_cls = cls._meta.get('index_cls', True)
collection = cls._get_collection()
if collection.read_preference > 1:
# 746: when connection is via mongos, the read preference is not necessarily an indication that
# this code runs on a secondary
if not collection.is_mongos and collection.read_preference > 1:
return
# determine if an index which we are creating includes