208
return nil
209
210
>
case *serviceerror.NotFound:
db.go
211
>
db.rangeID = initialRangeID
212
>
db.subqueues = db.ensureDefaultSubqueuesLocked(nil, 0, 0)
213
>
214
>
// If we are the draining one, then assume the other has tasks, so we can migrate
215
>
// backwards safely. Also assume other has tasks if the config allows for migration
216
>
// (and the partition supports fairness) since we may have just turned on fairness and need to migrate.
217
>
canMigrate := (db.config.NewMatcher || db.config.EnableFairness) && db.queue.Partition().SupportsFairness()
218
>
db.otherHasTasks = canMigrate || db.isDraining
219
>
220
>
if _, err := db.store.CreateTaskQueue(ctx, &persistence.CreateTaskQueueRequest{
221
>
RangeID: db.rangeID,
222
>
TaskQueueInfo: db.cachedQueueInfo(),
223
>
}); err != nil {
224
db.rangeID = 0
225
return err
226
}
227
>
db.lastWrite = time.Now()
db.go
228
>
// In this case, ensureDefaultSubqueuesLocked already initialized subqueue 0 to have
229
>
// ackLevel and maxReadLevel 0, so we don't need to initialize them.
230
>
softassert.That(db.logger, db.subqueues[0].maxReadLevel == 0, "should have maxReadLevel 0 here")
231
>
softassert.That(db.logger, db.subqueues[0].FairMaxReadLevel == nil, "should have maxReadLevel 0 here")
232
>
softassert.That(db.logger, db.subqueues[0].AckLevel == 0, "should have ackLevel 0 here")
233
>
softassert.That(db.logger, db.subqueues[0].FairAckLevel == nil, "should have ackLevel 0 here")
234
>
return nil
235
236
default: