11
11
from pandas .compat import pickle_compat
12
12
from pymongo .errors import OperationFailure
13
13
14
+ from arctic ._util import mongo_count
15
+
14
16
15
17
def _split_arrs (array_2d , slices ):
16
18
"""
@@ -113,7 +115,7 @@ def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
113
115
matching = 0
114
116
else :
115
117
spec = {'symbol' : sym , 'parent' : v .get ('base_version_id' , v ['_id' ]), 'segment' : {'$lt' : v .get ('up_to' , 0 )}}
116
- matching = l ._collection . find ( spec ). count ( ) if not is_deleted else 0
118
+ matching = mongo_count ( l ._collection , filter = spec ) if not is_deleted else 0
117
119
118
120
base_id = v .get ('base_version_id' )
119
121
snaps = ['/' .join ((str (x ), str (x .generation_time ))) for x in v .get ('parent' )] if v .get ('parent' ) else None
@@ -129,7 +131,21 @@ def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
129
131
corrupted = not is_deleted and (is_corrupted (l , sym , v ) if do_reads else fast_is_corrupted (l , sym , v ))
130
132
131
133
logging .info (
132
- "v{: <6} {: <6} {: <5} ({: <20}): expected={: <6} found={: <6} last_row={: <10} new_rows={: <10} append count={: <10} append_size={: <10} type={: <14} {: <14} base={: <24}/{: <28} snap={: <30}[{:.1f} mins delayed] {: <20} {: <20}" .format (
134
+ "v{: <6} "
135
+ "{: <6} "
136
+ "{: <5} "
137
+ "({: <20}): "
138
+ "expected={: <6} "
139
+ "found={: <6} "
140
+ "last_row={: <10} "
141
+ "new_rows={: <10} "
142
+ "append count={: <10} "
143
+ "append_size={: <10} "
144
+ "type={: <14} {: <14} "
145
+ "base={: <24}/{: <28} "
146
+ "snap={: <30}[{:.1f} mins delayed] "
147
+ "{: <20} "
148
+ "{: <20}" .format (
133
149
n ,
134
150
prev_v_diff ,
135
151
'DEL' if is_deleted else 'ALIVE' ,
@@ -144,7 +160,7 @@ def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
144
160
'meta-same' if meta_match_with_prev else 'meta-changed' ,
145
161
str (base_id ),
146
162
str (base_id .generation_time ) if base_id else '' ,
147
- snaps ,
163
+ str ( snaps ) ,
148
164
delta_snap_creation ,
149
165
'PREV_MISSING' if prev_n < n - 1 else '' ,
150
166
'CORRUPTED VERSION' if corrupted else '' )
@@ -159,7 +175,7 @@ def analyze_symbol(l, sym, from_ver, to_ver, do_reads=False):
159
175
hashlib .sha1 (seg ['sha' ]).hexdigest (),
160
176
seg .get ('segment' ),
161
177
'compressed' if seg .get ('compressed' , False ) else 'raw' ,
162
- [str (p ) for p in seg .get ('parent' , [])]
178
+ str ( [str (p ) for p in seg .get ('parent' , [])])
163
179
))
164
180
165
181
@@ -193,7 +209,7 @@ def _fast_check_corruption(collection, sym, v, check_count, check_last_segment,
193
209
# collection.find_one(spec, {'segment': 1}, sort=[('segment', pymongo.DESCENDING)])
194
210
195
211
if check_count :
196
- total_segments = collection . find ( spec , { 'segment' : 1 }). count ( )
212
+ total_segments = mongo_count ( collection , filter = spec )
197
213
# Quick check: compare segment count
198
214
if total_segments != v .get ('segment_count' , 0 ):
199
215
return True # corrupted, don't proceed with fetching from mongo the first hit
0 commit comments