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

refactor+graph: move all graph related DB code to the graph package #151

Closed
wants to merge 17 commits into from

Conversation

ellemouton
Copy link
Owner

@ellemouton ellemouton commented Oct 24, 2024

This PR is part of the larger graph separation & gossip updates projects.

This PR is mostly a refactor:

  1. (refactor) The first set of commits is a pure refactor that moves all graph related code out of channeldb and into graph/db.
  2. (refactor) Then, it completely removes the ChannelGraph from channeldb.DB. The only place where the two are used together is for AddrSource, so a couple of commits extract this.
  3. (logic change): currently the local channel manager mixes db transactions and passes the same Tx to both calls to the channelDB and the graphDB. So one commit ensures that this is no longer the case.
  4. the final commit (prefixed with TEMP) uses different files/DBs for the graph and channeldb. This is just to demonstrate the clean separation of the two. It is for reviewer confirmation of CI only & will be removed before merge.

Copy link

Pull reviewers stats

Stats of the last 30 days for lnd:

User Total reviews Time to review Total comments

@coveralls
Copy link

coveralls commented Oct 24, 2024

Pull Request Test Coverage Report for Build 11578759094

Details

  • 363 of 498 (72.89%) changed or added relevant lines in 43 files are covered.
  • 101 unchanged lines in 16 files lost coverage.
  • Overall coverage increased (+0.04%) to 58.903%

Changes Missing Coverage Covered Lines Changed/Added Lines %
chainreg/no_chain_backend.go 0 1 0.0%
discovery/gossiper.go 8 9 88.89%
lnrpc/devrpc/dev_server.go 0 1 0.0%
netann/chan_status_manager.go 1 2 50.0%
pilot.go 0 1 0.0%
server.go 14 15 93.33%
channeldb/addr_source.go 24 26 92.31%
channeldb/codec.go 4 6 66.67%
rpcserver.go 6 8 75.0%
graph/db/log.go 6 9 66.67%
Files with Coverage Reduction New Missed Lines %
peer/brontide.go 2 77.6%
server.go 2 63.63%
htlcswitch/mailbox.go 2 93.92%
contractcourt/htlc_timeout_resolver.go 2 88.9%
htlcswitch/switch.go 2 83.42%
htlcswitch/mock.go 2 74.48%
discovery/syncer.go 2 86.0%
channeldb/db.go 3 82.17%
lnrpc/websocket_proxy.go 3 77.58%
chainntnfs/mempool.go 3 89.19%
Totals Coverage Status
Change from base Build 11577406755: 0.04%
Covered Lines: 131534
Relevant Lines: 223307

💛 - Coveralls

We'll move these to the new graphdb package later and import them from
there.
We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
Then use both to construct a multiAddrSource AddrSource and use that
around the code-base.
So that this fails earlier on if the actual call to UpdateChannelPolicy
fails.
Demonstrate CI passes if we persist graph data in a completely separate
DB to other channel data.
@ellemouton ellemouton changed the title Move graph db code refactor+graph: move all graph related DB code to the graph package Oct 29, 2024
@ellemouton ellemouton closed this Oct 29, 2024
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