Skip to content

Conversation

@Nuu-maan
Copy link

This PR fixes a concurrency bug in the IndexedDB adapter where parallel bulkDocs() transactions could result in metadata.seq being lower than the highest doc.seq, breaking replication logic.

Fix

Tracks maxSeqThisTxn during the transaction and ensures metadata.seq = Math.max(metadata.seq, maxSeqThisTxn) before writing metadata.

Test

Added integration test to test.bulk_docs.js:

  • Runs 2 parallel bulkDocs()
  • Verifies all doc.seq values are unique and strictly increasing
  • Verifies metadata.seq >= max(doc.seq)

Fix is minimal, scoped, and backward-compatible.

@alxndrsn
Copy link
Contributor

Added integration test to test.bulk_docs.js:

This file doesn't seem to have changed in the PR.

@alxndrsn
Copy link
Contributor

I think this is attempting to fix the same bug as #8495

If that's correct, then my comment at #8495 (comment) is probably relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants