@@ -223,26 +223,28 @@ def validate_vb_seqno_stats():
223223 % (vb_id ,
224224 vb_info ["init" ][node .ip ][vb_id ],
225225 vb_info ["post_timeout" ][node .ip ][vb_id ]))
226- elif int (vb_id ) in target_nodes_vbuckets ["active" ]:
226+ elif int (vb_id ) \
227+ in target_nodes_vbuckets [Bucket .vBucket .ACTIVE ]:
227228 if vb_id in vb_info ["init" ][node .ip ].keys () \
228229 and vb_info ["init" ][node .ip ][vb_id ] \
229230 != vb_info ["post_timeout" ][node .ip ][vb_id ]:
230231 self .log .warning (
231232 err_msg
232233 % (node .ip ,
233- "active" ,
234+ Bucket . vBucket . ACTIVE ,
234235 vb_id ,
235236 vb_info ["init" ][node .ip ][vb_id ],
236237 vb_info ["post_timeout" ][node .ip ][vb_id ]))
237- elif int (vb_id ) in target_nodes_vbuckets ["replica" ]:
238+ elif int (vb_id ) \
239+ in target_nodes_vbuckets [Bucket .vBucket .REPLICA ]:
238240 if vb_id in vb_info ["init" ][node .ip ].keys () \
239241 and vb_info ["init" ][node .ip ][vb_id ] \
240242 == vb_info ["post_timeout" ][node .ip ][vb_id ]:
241243 retry_validation = True
242244 self .log .warning (
243245 err_msg
244246 % (node .ip ,
245- "replica" ,
247+ Bucket . vBucket . REPLICA ,
246248 vb_id ,
247249 vb_info ["init" ][node .ip ][vb_id ],
248250 vb_info ["post_timeout" ][node .ip ][vb_id ]))
@@ -257,8 +259,8 @@ def validate_vb_seqno_stats():
257259 doc_gen = dict ()
258260 affected_vbs = list ()
259261
260- target_nodes_vbuckets ["active" ] = []
261- target_nodes_vbuckets ["replica" ] = []
262+ target_nodes_vbuckets [Bucket . vBucket . ACTIVE ] = list ()
263+ target_nodes_vbuckets [Bucket . vBucket . REPLICA ] = list ()
262264 vb_info ["init" ] = dict ()
263265 vb_info ["post_timeout" ] = dict ()
264266 vb_info ["afterCrud" ] = dict ()
@@ -270,25 +272,25 @@ def validate_vb_seqno_stats():
270272 for node in target_nodes :
271273 shell_conn [node .ip ] = RemoteMachineShellConnection (node )
272274 cbstat_obj [node .ip ] = Cbstats (shell_conn [node .ip ])
273- target_nodes_vbuckets ["active" ] += \
274- cbstat_obj [node .ip ].vbucket_list (self . bucket . name ,
275- vbucket_type = "active" )
276- target_nodes_vbuckets ["replica" ] += \
277- cbstat_obj [node .ip ].vbucket_list (self . bucket . name ,
278- vbucket_type = "replica" )
275+ target_nodes_vbuckets [Bucket . vBucket . ACTIVE ] += \
276+ cbstat_obj [node .ip ].vbucket_list (
277+ self . bucket . name , vbucket_type = Bucket . vBucket . ACTIVE )
278+ target_nodes_vbuckets [Bucket . vBucket . REPLICA ] += \
279+ cbstat_obj [node .ip ].vbucket_list (
280+ self . bucket . name , vbucket_type = Bucket . vBucket . REPLICA )
279281 vb_info ["init" ][node .ip ] = cbstat_obj [node .ip ].vbucket_seqno (
280282 self .bucket .name )
281283 error_sim [node .ip ] = CouchbaseError (self .log , shell_conn [node .ip ])
282284
283285 curr_time = int (time .time ())
284286 expected_timeout = curr_time + self .sdk_timeout
285287
286- target_vbs = target_nodes_vbuckets ["active" ]
288+ target_vbs = target_nodes_vbuckets [Bucket . vBucket . ACTIVE ]
287289 if self .nodes_init == 1 :
288290 pass
289291 elif self .durability_level \
290292 == Bucket .DurabilityLevel .PERSIST_TO_MAJORITY :
291- target_vbs = target_nodes_vbuckets ["replica" ]
293+ target_vbs = target_nodes_vbuckets [Bucket . vBucket . REPLICA ]
292294
293295 # Create required doc_generators
294296 doc_gen ["insert" ] = sub_doc_generator (
@@ -343,7 +345,7 @@ def validate_vb_seqno_stats():
343345 self .task .jython_task_manager .get_task_result (tasks [op_type ])
344346
345347 # Validate task failures
346- if op_type == "read" :
348+ if op_type == DocLoading . Bucket . DocOps . READ :
347349 # Validation for read task
348350 if len (tasks [op_type ].fail .keys ()) != 0 :
349351 self .log_failure ("Read failed for few docs: %s"
@@ -369,7 +371,7 @@ def validate_vb_seqno_stats():
369371 self .log_failure ("Timed-out before expected time" )
370372
371373 for op_type in doc_gen .keys ():
372- if op_type == "read" :
374+ if op_type == DocLoading . Bucket . DocOps . READ :
373375 continue
374376 while doc_gen [op_type ].has_next ():
375377 doc_id , _ = doc_gen [op_type ].next ()
@@ -403,7 +405,8 @@ def validate_vb_seqno_stats():
403405 if self .nodes_init == self .num_replicas + 1 :
404406 read_gen = doc_generator (self .key , 0 , self .num_items )
405407 read_task = self .task .async_load_gen_docs (
406- self .cluster , self .bucket , read_gen , "read" , 0 ,
408+ self .cluster , self .bucket , read_gen ,
409+ DocLoading .Bucket .DocOps .READ , 0 ,
407410 batch_size = 500 , process_concurrency = 1 ,
408411 timeout_secs = self .sdk_timeout )
409412 self .task_manager .get_task_result (read_task )
0 commit comments