share / sharedb-postgres

PostgreSQL adapter for ShareDB
MIT License
46 stars 22 forks source link

Fix for high concurrency issue #4

Closed billwashere closed 1 year ago

billwashere commented 6 years ago

This pull request does two changes

1) Changes the datatype on the ops and snapshots tables to JSONB

2) Attempts to resolve the high concurrency issue but committing the snapshot and operation in one transaction

billwashere commented 6 years ago

Hi @nornagon I've split out pooling into a seperate change - https://github.com/share/sharedb-postgres/pull/5

billwashere commented 6 years ago

I've this pull request with the required changes.

Additionally

  1. Commit no longer requires jsonb, it works fine without it
  2. On close, the connection pool drains
jasoniangreen commented 6 years ago

Hey @billwashere and @nornagon, what is the state of this? Do you need any help?

billwashere commented 6 years ago

I believe that it working correctly, however due to the fact that it is such a big change more testing may be required (I'll leave how much testing to @nornagon).

If you want to try it out and see if you can break it, that would be great.

nornagon commented 6 years ago

Would you be able to rebase this on top of master? It looks like mostly minor conflicts. Also retitle the PR, since this is now only addressing the concurrency issue.

Thanks! If this is reported working for a few people, I'm happy to merge it (at least, once I sit down and actually understand what's going on with the query...). The code as it is is not particularly well tested, so new untested code at least won't be a regression, but it'd be great to have better test coverage! especially cool would be if you could construct a test that fails with the old code but passes with the new.

ianberdin commented 3 years ago

@billwashere can you merge this to master and update npm package?

Utwo commented 3 years ago

@billwashere can you merge this to master and update npm package?

I think you can use this package: https://github.com/plotdb/sharedb-postgres

nornagon commented 3 years ago

if @zbryikt or someone wants to take over maintenance of this repo, I'm happy to grant access.