Skip to content

Fixes to op version tracking #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed

Fixes to op version tracking #6

wants to merge 12 commits into from

Conversation

ZechyW
Copy link

@ZechyW ZechyW commented Mar 31, 2018

When the ShareDB backend commits an op/snapshot pair, the version of the snapshot is always 1 higher than the version of the op.

  • When checking for the maximum current snapshot version, we should therefore query the snapshots table directly, not the ops table.

  • When committing ops, we should therefore also use op.v, not snapshot.v. If we use snapshot.v, the version field in the ops table will contain a different number from the JSON representation of the op in the operation field. (This is precisely what happens with the current version of the library.)

  • When getting a range of operations with .getOps(), I found that rows were sometimes being returned out of order; adding an explicit ORDER BY clause to the query fixes the issue.

billwashere and others added 12 commits March 10, 2018 12:28
- In .commit(), the version for the op and version for the snapshot
are different. We should use `op.v` instead of `snapshot.v` when
committing the op.

- In .getOps(), rows are sometimes returned out of order. Adding an
explicit `ORDER BY` clause to the SQL query fixes this.
- For the max version check in .commit(), we should query the snapshot
table, not the ops table. (Op versions start from 0, whereas snapshot
versions start from 1)
- Bringing in changes from other ShareDB-Postgres fork
- ShareDB sets `doc_type` and `data` to null in the `snapshots` table
when a document is deleted
@huntj88
Copy link

huntj88 commented Jul 16, 2019

Is this branch stable, or ever going to be reviewed? It supports jsonb which is what i'm looking for

@alecgibson
Copy link
Collaborator

Thanks for the submission. I'm closing this as it's pretty old. The driver should now be fully compliant with ShareDB database driver specs as of #24

Please feel free to reopen if I've missed something.

@alecgibson alecgibson closed this Jun 25, 2024
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.

4 participants