Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
Security Level: Public
-
None
-
3
Description
SG creates a new unused sequence for every sequence between nextSequence and the one inside the existing doc metadata.
In cases where the _sync:seq has been reset/wiped this can cause potentially millions of documents to be created with a short TTL.
If we're able to detect this case, we can create one range of unused sequences to save a lot of work and warn that there's something odd occurring that needs further attention (they need to regenerate sequences)
for {
|
var err error
|
if docSequence, err = db.sequences.nextSequence(ctx); err != nil {
|
return unusedSequences, err
|
}
|
|
if docSequence > doc.Sequence {
|
break
|
} else {
|
if err := db.sequences.releaseSequence(ctx, docSequence); err != nil {
|
base.WarnfCtx(ctx, "Error returned when releasing sequence %d. Falling back to skipped sequence handling. Error:%v", docSequence, err)
|
}
|
}
|
}
|
// Could add a db.Sequences.nextSequenceGreaterThan(doc.Sequence) to push the work down into the sequence allocator
|
// - sequence allocator is responsible for releasing unused sequences, could optimize to do that in bulk if needed
|
Attachments
Issue Links
- Clones
-
CBG-3516 Improve behaviour when allocating sequence much lower than existing doc seq
- Closed