Skip to content
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

Fix race condition when check for existing view ids was too early #420

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

adzialocha
Copy link
Member

@adzialocha adzialocha commented Jun 21, 2023

This fixes a race condition where the check for duplicate document view ids in the database was too early.

The reduce task started, checked if a view id existed, if not, it happily went on, while another task could have created the view id in the meantime before we come to the point where we created the view id (again). Probably because of the ON CONFLICT clause we didn't notice that issue before.

📋 Checklist

  • Add tests that cover your changes
  • Add this PR to the Unreleased section in CHANGELOG.md
  • Link this PR to any issues it closes
  • New files contain a SPDX license header

@adzialocha adzialocha changed the base branch from main to development June 21, 2023 16:30
@adzialocha adzialocha requested a review from sandreae June 21, 2023 16:34
@adzialocha adzialocha marked this pull request as ready for review June 21, 2023 16:34
@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage: 83.33% and project coverage change: -0.02 ⚠️

Comparison is base (7cb0732) 90.18% compared to head (bfece59) 90.17%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #420      +/-   ##
===============================================
- Coverage        90.18%   90.17%   -0.02%     
===============================================
  Files               87       87              
  Lines             8225     8226       +1     
===============================================
  Hits              7418     7418              
- Misses             807      808       +1     
Impacted Files Coverage Δ
aquadoggo/src/materializer/tasks/reduce.rs 91.17% <83.33%> (-0.39%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@sandreae sandreae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@sandreae sandreae merged commit 3407076 into development Jun 22, 2023
8 checks passed
@adzialocha adzialocha deleted the fix-race-in-view-check branch June 22, 2023 06:22
adzialocha added a commit that referenced this pull request Jul 14, 2023
* 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)
  ...
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.

None yet

2 participants