-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[15] graph/db: SQL prune log #9939
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
[15] graph/db: SQL prune log #9939
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
cd16adc
to
71d907c
Compare
71d907c
to
dc2182d
Compare
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.
Very nice!
graph/db/sql_store.go
Outdated
err) | ||
} | ||
|
||
nodeID, _, err := s.getSourceNode(ctx, db, ProtocolV1) |
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.
Not sure how you are planning on doing the whole V2 stuff, but perhaps the version could be a parameter to this method so in the future it can just be called twice, once for each version?
Or I guess since GetUnconnectedNodes
returns nodes for both versions, the two different versions would be handled in the loop below?
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 catch. Going to update this to work across any protocol since the rule of "what is an unconnected node" stays the same.
Going to update the GetUnconnectedNodes
to ignore any nodes in the source_nodes
table
dc2182d
to
6aac2f9
Compare
graph/db/sql_store.go
Outdated
err) | ||
} | ||
|
||
nodeID, _, err := s.getSourceNode(ctx, db, ProtocolV1) |
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 catch. Going to update this to work across any protocol since the rule of "what is an unconnected node" stays the same.
Going to update the GetUnconnectedNodes
to ignore any nodes in the source_nodes
table
graph/db/sql_store.go
Outdated
for _, outpoint := range spentOutputs { | ||
row, err := db.GetChannelByOutpoint( | ||
ctx, sqlc.GetChannelByOutpointParams{ | ||
Outpoint: outpoint.String(), |
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.
NOTE: i've updated the GetChannelByOutpointParams
query to no longer have the version caveat since:
- our prune log is not protocol version dependent. So if an entry is there, it must mean the prune is complete for all versions.
- So we want to ensure that PruneGraph & PruneGraphNodes are both protocol independent. For now: PruneGraph will error when
getAndBuildEdgeInfo
is called for a non-V1 channel since the method requires us to build the full in-memory model of the channel & we dont have that defined for v2 channels yet.
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.
LGTM 🎉
Define the schema for the prune log.
Which lets us run `TestChannelEdgePruningUpdateIndexDeletion` against our SQL backends.
6aac2f9
to
78fc052
Compare
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.
LGTM 🎉
Which lets us run `TestGraphPruning` and `TestBatchedAddChannelEdge` against our SQL backends.
Which lets us run `TestDisconnectBlockAtHeight` and `TestStressTestChannelGraphAPI` against our SQL backends.
78fc052
to
e875183
Compare
Here we add the schema, queries and CRUD for the prune log. The following methods are implemented:
Part of #9795
Depends on #9938
See #9932 for the full picture that we are aiming at