-
Notifications
You must be signed in to change notification settings - Fork 2.2k
graph/db: only fetch required info for graph cache population #9923
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
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 (
|
8aa80d0 to
2fbba94
Compare
ziggie1984
left a comment
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.
Looks good 🫡, had some minor comments.
bhandras
left a comment
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 🎉
ellemouton
left a comment
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.
Thanks for the review yall! 🙏 updated.
Cool - just waiting on the second review of #9897, then we can merge that and rebase this one on master & merge (after 2nd approval here too) 👍
Remove the unused UpdateChannel method.
Remove the redundant "edge2" param and rather use the "policy" param to derive the boolean.
Update the GraphCache.UpdatePolicy method to take a `models.CachedEdgePolicy` instead of a `models.ChannelEdgePolicy`. Doing this will allow us later on to only fetch the necessary info for populating the CachedEdgePolicy when we are populating the cache via UpdatePolicy.
So that the call-sites of this method dont necessarily need to fetch all the data required to populate the full ChannelEdgePolicy.
Define a new CachedEdgeInfo type and let the graph cache's AddChannel use this. This will let us later on (for the SQL impl of the graph db) only load from the DB what we actually need for the graph cache.
Implement ForEachChannelCacheable which is like ForEachChannel but its call-back takes the cached versions of channel info & policies. This is then used during graph cache population. This will be useful once the SQL implementation is added so that we can reduce the number of DB trips on cache population.
|
|
ziggie1984
left a comment
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
In this PR, we adjust the various methods of the
GraphCachesuch that they all only take themodels.Cached*versionsof various types (namely
CachedEdgeInfoandCachedEdgePolicy).This then allows us to implement a new
ForEachChannelCacheablemethod which only requires theDB layer to fetch the info needed to construct the cache types. This will be useful when we add the SQL version
of the graph store so that we can reduce the number of DB round trips.
Part of #9795