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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicate operations in topo order #442

Merged
merged 6 commits into from
Jul 9, 2023

Conversation

sandreae
Copy link
Member

@sandreae sandreae commented Jul 9, 2023

We want to validate all operations which arrive at a node via replication before persisting them to the node and performing materialization. In order to do this the document they are part of needs to be in it's most recent state before the in-coming operation was published. This can be achieved if entries are ordered appropriately before they are sent to a remote node in replication request responses.

When preparing entries response messages in LogHeighStrategy they should be grouped by document id and then ordered by sorted_index of their operations. This way a remote can simply use publish to ingest all arriving entries as they arrive in their topologically sorted order and can be directly validated and added to the document.

When consuming entries in Ingest we should use the publish method provided by p2panda-rs, this already performs all required validation.

  • Use publish to ingest entries arriving on a node via replication
  • Order entries correctly before sending them to a node during replication
  • Tests

These changes mean that we now require that authors don't publish concurrently to the same document with the same key pair, this needs adding to the spec: p2panda/handbook#284

馃搵 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 merged commit 88e1605 into development Jul 9, 2023
5 of 6 checks passed
@adzialocha adzialocha deleted the replicate-operations-in-topo-order branch July 9, 2023 07:17
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
2 participants