Breaking suggestion: add support for transactions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 152
- Forks
- 68
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 3
Description
MongoDB 3.x was end-of-lifed in April 2021, which means that all currently-supported versions of MongoDB now support transactions.
sharedb-mongo currently uses an optimistic write mechanism to deal with the fact that it has to write both an op and a snapshot as part of a single "commit". This results in some non-canonical ops being committed to the database, and means we need to do some painful work to get a range of canonical ops.
If we moved to using MongoDB transactions, we would know that all committed ops are canonical (since a conflicting transaction can be made to roll back), which means we could vastly simplify op range fetches.
This would be a breaking change, since it would require MongoDB >= 4.X.
We'd also want to do some thinking about how to enable this feature on already-established databases. For example, if you turn on transactions in sharedb-mongo, any documents that were created after the change can be considered to only have canonical ops, but any "legacy" documents created before that time would not. We could potentially set a flag on the snapshots?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing sharedb-mongo’s current optimistic write mechanism for committing an op and snapshot, then review MongoDB transactions and the existing canonical-op range-fetch behavior. Define how transactions would replace the current mechanism, how legacy documents would be identified, and how enabling the change would affect existing databases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100