CBG-4636: have check for skipped sequences on recent sequence handling #7530
+85
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CBG-4636
We need to check if its possible that a recent_sequence got pushed to skipped on recent sequence handing, when pending gets to max or is flushed due to age we move the next expected sequence at the cache to the oldest pending sequence. Hence this loop was not running on some sequences that were in recent sequences on a doc but were also present in skipped sequences. This meant skipped would grow exponentially with no prospect of ever removing the sequences until we abandoned them. This lead to high sequence stable being stuck until abandoned sequences job was run.
I chose not to do an actual check in skipped given this is done inside
processEntry
and it would be less expensive to just check if seq in recent sequence is less than current sequence and it is greater than or equal to the oldest skipped sequence.Before changes high_seq_stable:

After changes high_seq_stable:

Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/3114/