@@ -15,18 +15,18 @@ def test(self):
15
15
self ._run_tests (
16
16
[
17
17
UpgradePath ('4.2.x' , '4.3.x' ),
18
- # UpgradePath('4.3.0', 'latest-nightly'),
18
+ UpgradePath ('4.3.0' , 'latest-nightly' ),
19
19
],
20
20
[
21
- self ._test_recovery_with_concurrent_indexing ,
22
- # self._test_recovery,
23
- # self._test_update_docs,
24
- # self._test_recovery_closed_index,
25
- # self._test_closed_index_during_rolling_upgrade,
26
- # self._test_auto_expand_indices_during_rolling_upgrade,
27
- # self._test_retention_leases_established_when_promoting_primary,
28
- # self._test_closed_index_noop_recovery,
29
- # self._test_relocation_with_concurrent_indexing
21
+ self ._test_relocation_with_concurrent_indexing ,
22
+ self ._test_recovery ,
23
+ self ._test_update_docs ,
24
+ self ._test_recovery_closed_index ,
25
+ self ._test_closed_index_during_rolling_upgrade ,
26
+ self ._test_auto_expand_indices_during_rolling_upgrade ,
27
+ self ._test_retention_leases_established_when_promoting_primary ,
28
+ self ._test_closed_index_noop_recovery ,
29
+ self ._test_relocation_with_concurrent_indexing
30
30
]
31
31
)
32
32
@@ -206,41 +206,43 @@ def _test_relocation_with_concurrent_indexing(self, path, nodes):
206
206
# remove the replica and guaranteed the primary is placed on the old node
207
207
c .execute ('''alter table doc.test set (
208
208
"number_of_replicas"=0,
209
- "routing.allocation.enable"='NONE ',
209
+ "routing.allocation.enable"='all ',
210
210
"routing.allocation.include._id"=?
211
211
)''' , (old_node_id , ))
212
212
213
213
self ._assert_is_green (conn , 'doc' , 'test' )
214
214
215
215
c .execute ('''alter table doc.test set ("routing.allocation.include._id"=?)''' , (new_node_id , ))
216
-
217
216
insert_data (conn , 'doc' , 'test' , 50 )
218
- self ._assert_is_green (conn , 'doc' , 'test' )
219
217
218
+ # ensure the relocation from old node to new node has occurred; otherwise ensureGreen can
219
+ # return true even though shards haven't moved to the new node yet (allocation was throttled).
220
+ time .sleep (3 )
221
+ c .execute ('select current_state from sys.allocations where node_id =?' , (new_node_id ,))
222
+ current_state = c .fetchone ()[0 ]
223
+ self .assertEqual (current_state , 'STARTED' )
224
+ self ._assert_is_green (conn , 'doc' , 'test' )
220
225
c .execute ('refresh table doc.test' )
221
-
222
- c .execute ('select count(*) from doc.test' )
223
- res = c .fetchone ()
224
- self .assertEqual (res [0 ], 60 )
226
+ self ._assert_count_by_node_id (conn , 'doc' , 'test' , new_node_id , 60 )
225
227
226
228
# upgrade the whole cluster to the new version
227
229
self ._upgrade_cluster (cluster , path .to_version , nodes )
228
230
229
- c .execute ('''
230
- alter table doc.test set(
231
- "number_of_replicas"=2,
232
- "routing.allocation.include._id"='null')
233
- ''' )
231
+ c .execute ('''alter table doc.test set("number_of_replicas"=2)''' )
232
+ c .execute ('''alter table doc.test reset("routing.allocation.include._id")''' )
234
233
235
234
insert_data (conn , 'doc' , 'test' , 45 )
236
235
237
- time .sleep (30 )
236
+ time .sleep (10 )
238
237
self ._assert_is_green (conn , 'doc' , 'test' )
239
238
c .execute ('refresh table doc.test' )
239
+ time .sleep (5 )
240
+ c .execute ('select id from sys.nodes' )
241
+ node_ids = c .fetchall ()
242
+ self .assertEqual (len (node_ids ), 3 )
240
243
241
- c .execute ('select count(*) from doc.test' )
242
- res = c .fetchone ()
243
- self .assertEqual (res [0 ], 105 )
244
+ for node_id in node_ids :
245
+ self ._assert_count_by_node_id (conn , 'doc' , 'test' , node_id [0 ], 105 )
244
246
245
247
def _test_recovery (self , path , nodes ):
246
248
"""
0 commit comments