@@ -250,13 +250,28 @@ func (s *testClusterInfoSuite) TestSetOfflineStore(c *C) {
250
250
for storeID := uint64 (0 ); storeID <= 4 ; storeID ++ {
251
251
store := cluster .GetStore (storeID )
252
252
if store == nil || store .IsUp () {
253
- c .Assert (cluster .buryStore (storeID ), NotNil )
253
+ c .Assert (cluster .BuryStore (storeID , false ), NotNil )
254
254
} else {
255
- c .Assert (cluster .buryStore (storeID ), IsNil )
255
+ c .Assert (cluster .BuryStore (storeID , false ), IsNil )
256
256
}
257
257
}
258
258
}
259
259
260
+ func (s * testClusterInfoSuite ) TestForceBuryStore (c * C ) {
261
+ _ , opt , err := newTestScheduleConfig ()
262
+ c .Assert (err , IsNil )
263
+ cluster := newTestRaftCluster (s .ctx , mockid .NewIDAllocator (), opt , core .NewStorage (kv .NewMemoryKV ()), core .NewBasicCluster ())
264
+ // Put 2 stores.
265
+ stores := newTestStores (2 , "5.3.0" )
266
+ stores [1 ] = stores [1 ].Clone (core .SetLastHeartbeatTS (time .Now ()))
267
+ for _ , store := range stores {
268
+ c .Assert (cluster .PutStore (store .GetMeta ()), IsNil )
269
+ }
270
+ c .Assert (cluster .BuryStore (uint64 (1 ), true ), IsNil )
271
+ c .Assert (cluster .BuryStore (uint64 (2 ), true ), NotNil )
272
+ c .Assert (errors .ErrorEqual (cluster .BuryStore (uint64 (3 ), true ), errs .ErrStoreNotFound .FastGenByArgs (uint64 (3 ))), IsTrue )
273
+ }
274
+
260
275
func (s * testClusterInfoSuite ) TestReuseAddress (c * C ) {
261
276
_ , opt , err := newTestScheduleConfig ()
262
277
c .Assert (err , IsNil )
@@ -272,7 +287,7 @@ func (s *testClusterInfoSuite) TestReuseAddress(c *C) {
272
287
c .Assert (cluster .RemoveStore (3 , true ), IsNil )
273
288
// store 4: tombstone
274
289
c .Assert (cluster .RemoveStore (4 , true ), IsNil )
275
- c .Assert (cluster .buryStore ( 4 ), IsNil )
290
+ c .Assert (cluster .BuryStore ( 4 , false ), IsNil )
276
291
277
292
for id := uint64 (1 ); id <= 4 ; id ++ {
278
293
storeInfo := cluster .GetStore (id )
0 commit comments