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

sync2: implement database-backed sync based on FPTree #6406

Open
wants to merge 14 commits into
base: sync2/sqlstore
Choose a base branch
from

Conversation

ivan4th
Copy link
Contributor

@ivan4th ivan4th commented Oct 23, 2024


Motivation

The new set reconciliation mechanism requires an efficient data structure for handling range fingerprint queries.

Description

fptree.FPTree provides a sufficiently efficient data structure for
performing range fingerprinting on data residing in database tables,
speeding up the queries at expense of some memory use.

dbset.DBSet builds on fptree.FPTree and provides a database-backed
implementation of the multipeer.OrderedSet interface.

#6405 needs to be merged before this one.

Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 80.26735% with 310 lines in your changes missing coverage. Please review.

Project coverage is 79.9%. Comparing base (bb43161) to head (1f5fd56).

Files with missing lines Patch % Lines
sync2/fptree/fptree.go 85.9% 91 Missing and 34 partials ⚠️
sync2/dbset/dbset.go 62.9% 43 Missing and 20 partials ⚠️
sync2/fptree/trace.go 16.9% 43 Missing and 1 partial ⚠️
sync2/fptree/nodepool.go 74.1% 18 Missing and 11 partials ⚠️
sync2/fptree/refcountpool.go 74.0% 7 Missing and 7 partials ⚠️
sync2/fptree/prefix.go 89.3% 7 Missing and 5 partials ⚠️
node/node.go 56.2% 4 Missing and 3 partials ⚠️
config/config.go 0.0% 5 Missing ⚠️
activation/activation.go 62.5% 3 Missing ⚠️
sync2/fptree/testtree.go 95.7% 1 Missing and 2 partials ⚠️
... and 3 more
Additional details and impacted files
@@               Coverage Diff                @@
##           sync2/sqlstore   #6406     +/-   ##
================================================
  Coverage            79.8%   79.9%             
================================================
  Files                 342     350      +8     
  Lines               44310   45818   +1508     
================================================
+ Hits                35391   36613   +1222     
- Misses               6920    7128    +208     
- Partials             1999    2077     +78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

`fptree.FPTree` provides a sufficiently efficient data structure for
performing range fingerprinting on data residing in database tables,
speeding up the queries at expense of some memory use.

`dbset.DBSet` builds on `fptree.FPTree` and provides a database-backed
implementation of the `multipeer.OrderedSet` interface.
fasmat and others added 2 commits October 23, 2024 13:49
## Motivation

Ensure an active statement is reset even if `decoder` in `db.Exec` panics
fasmat and others added 11 commits October 24, 2024 18:15
…6403)

## Motivation

To detect errors that would break compatibility with previous versions of the node I extended `TestSmeshing` to deploy 25% of the nodes in the test using an older version of go-spacemesh. So if any change changes protocol rules that would break consensus like the error fixed in #6398 or the error fixed in #5839.
## Motivation

In rare cases where building the initial ATX times out the initial PoST stored in the local DB is deleted. This leads to an endless loop of the node not being able to publish its first ATX because it expects an initial PoST but never generates one.

This PR fixes this issue.
## Motivation

All tests have been updated to ensure that DB connections are closed at the end of the test. This ensures that any open connections that weren't returned to the pool at the end of the test cause it to fail and would otherwise go unnoticed.
## Motivation

Given that after recent item sync is done (if it's needed at all), the
range set reconciliation algorithm no longer depends on newly received
item being added to the set, we can save memory by not adding the
received items during reconciliation, except for the recent items
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.

2 participants