Skip to content

Breaking suggestion: add support for transactions #127

Description

@alecgibson

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions