-
Notifications
You must be signed in to change notification settings - Fork 5
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
Handle duplicate document view insertions #410
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## development #410 +/- ##
===============================================
- Coverage 90.32% 90.30% -0.02%
===============================================
Files 87 87
Lines 8203 8223 +20
===============================================
+ Hits 7409 7426 +17
- Misses 794 797 +3
☔ View full report in Codecov by Sentry. |
From our meeting today: We like handling the check on a higher level (inside the
That's especially useful if we're working with the inner parts of |
This is ready, but the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I've removed the ON CONFLICT check in our SQL as well, since we handle the case in our code. Will merge now!
* development: (23 commits) Implement `dialer` behaviour (#444) Sort expected results in strategy tests Update CHANGELOG Replicate operations in topo order (#442) Maintain sorted operation indexes (#438) Use fork of `asynchronous-codec` (#440) Ingest check for duplicate entries (#439) Reverse lookup for pinned relations in dependency task (#434) Remove unnecessary exact version pinning in Cargo.toml Make `TaskInput` an enum and other minor clean ups in materialiser (#429) Use `libp2p` `v0.52.0` (#425) Fix race condition when check for existing view ids was too early (#420) Reduce logging verbosity CI: Temporary workaround for Rust compiler bug (#417) Fix early document view insertion (#413) Handle duplicate document view insertions (#410) Decouple p2panda's authentication data types from libp2p's (#408) Remove dead_code attribute in lib Integrate replication manager with networking stack (#387) Implement naive replication protocol (#380) ...
Document views have a
UNIQUE
constraint on theirdocument_view_id
which means if double insertion of the same document view occurs then a fatal database error is returned. Although this is the expected behaviour, and there is no reason to want to update a document view (once inserted, no values on a document view should change), it can happen that a document is inserted twice because of two materializer tasks working towards the same document view (see issue and discussion here: #398).This PR retains the
UNIQUE
restraint on document view id, andchanges the behaviour ofchecks if a document view has already been materialized in the reduce task before performing any insertion.insert_document_view
onSqlStore
Closes #398
📋 Checklist
CHANGELOG.md