27 Commits
Author SHA1 Message Date
Elle Mouton dc9dae8dd6 graph/db: thread context through ChanUpdatesInHorizon 2026-02-25 15:33:34 +02:00
Elle Mouton 2f0d2962dd graph/db: thread context through NodeUpdatesInHorizon 2026-02-25 15:33:34 +02:00
Elle Mouton f5c91691bc graph/db: version cacheable iteration methods
Add gossip version parameters to ForEachNodeCacheable and
ForEachChannelCacheable in the Store interface and both implementations.

Thread the version through SQL helpers and update call sites/tests
accordingly.
2026-02-20 08:50:43 +02:00
Elle Mouton 0cfb9c9d2c graph/db: add gossip version parameter to ForEachChannel
Update ForEachChannel to accept a gossip version parameter, allowing
callers to specify which gossip version's channels should be iterated.
This change prepares the graph database for supporting multiple gossip
versions while maintaining backward compatibility.

The KVStore implementation validates that only GossipVersion1 is
requested, returning ErrVersionNotSupportedForKVDB for other versions.
The SQLStore implementation validates known versions and passes the
version through to the underlying paginated query.

Update VersionedGraph to include a ForEachChannel method that
automatically uses its configured gossip version, and update the
DescribeGraph RPC handler to use the v1Graph instead of the global
graphDB.
2026-02-13 07:21:24 +02:00
Elle Mouton bc76383e15 graph/db: rename V1Store to Store
The underling store will store gossip messages across gossip versions
and we will instead expose version parameters on many of the methods. So
this interface really just abstracts the underlying store/schema type.
2026-02-13 07:21:20 +02:00
Elle Mouton 07d0f0842c graph/db: remove TestPopulateViaMigration
This tests was a temporary helper to let devs test the graph SQL
migration before it was plugged in to LND. But that migration has now
shipped and so we can remove this.
2025-11-12 22:54:05 +08:00
Olaoluwa Osuntokun f3a8fd842d graph+discovery: update graph/db gossip backlog interfaces to use iter.Seq2
This lets us emit a rich error if things fail when first creating the
iterator, or if any of the yield attempts fail.
2025-09-26 17:01:11 -07:00
Yong e46c676894 Merge pull request #10162 from ellemouton/graphMigUnwrapDNSAddrs
graph/db: unwrap dns addresses from opaque ones during migration
2025-09-04 22:29:49 +08:00
Elle Mouton 060219780b multi: rename AddLightningNode methods
to AddNode
2025-09-03 10:14:35 +02:00
Elle Mouton c663a557c4 multi: rename models.LightningNode to models.Node 2025-09-03 10:14:35 +02:00
Elle Mouton a74f0b133a graph/db: expand test comment with build tag info 2025-09-03 10:11:49 +02:00
Boris Nagaev dee8ad3754 multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings.

This change was produced by:
 - running golangci-lint run --fix
 - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go`
 - manually fixing broken tests
 - itest, lntest: use ht.Context() where ht or hn is available
 - in HarnessNode.Stop() we keep using context.Background(), because it is
   called from a cleanup handler in which t.Context() is canceled already.
2025-08-30 14:13:44 -03:00
Elle Mouton ec17f8bc4e graph/db: expand TestPopulateViaMigration for easy testing
Expand the test and make it easily configurable for the purposes of
locally testing the graph SQL migration.
2025-08-14 16:31:04 +02:00
Elle Mouton f560c4d95b sqldb: use uint32 for config values 2025-08-14 08:03:28 +02:00
Elle Mouton d5729845d0 graph/db: remove outdated TODO 2025-08-14 08:00:07 +02:00
Elle Mouton b1deddec44 multi: remove DefaultQueryConfig
And always make use of either the new DefaultSQLiteConfig or
DefaultPostgresConfig.
2025-08-13 14:43:31 +02:00
Elle Mouton 6a31e06817 graph/db+sqldb: find best default query cfg values for sqlite & postgres
This commit adds a BenchmarkFindOptimalSQLQueryConfig test in the
graph/db package which runs ForEachNode and ForEachChannel queries
against a local backend using various different values for the sql
QueryConfig struct. This is done to determine good default values to
use for the config options for sqlite vs postgres.
2025-08-13 14:43:31 +02:00
Elle Mouton 4cc5cfef2a graph/db: add ChanUpdatesInHorizon benchmark 2025-08-07 08:04:19 +02:00
Elle Mouton 8aa8c7cc42 multi: remove the NodeRTx interface type 2025-08-06 09:56:21 +02:00
Elle Mouton 5727bfa688 graph/db: let ForEachNodeCached maybe fetch node addresses
Here we adjust the ForEachNodeCached graph DB method to pass in a node's
addresses into the provided call-back if requested. This will allow us
to improve the performance of node/channel iteration in the autopilot
subserver.
2025-08-06 09:50:54 +02:00
Elle Mouton 6ac19b4330 graph/db: cover more DB methods in benchmark test
So that we can properly measure upcoming performance improvements.
2025-08-05 08:00:18 +02:00
Elle Mouton a6248872cb sqldb: rename ExecutePagedQuery to ExecuteBatchQuery
We rename this helper along the config types & helper types for it
because the word "page" is used more often in the context of paging
through results using an offset and limit whereas this helper is
specifically used to split up the slice in queries of the form
"WHERE x in []slice". We do this rename so that there is mimimal
confusion in contexts where we use batching along with actual paging.

The config struct is also renamed to QueryConfig in preparation for it
holding more config options.
2025-07-31 15:32:53 +02:00
Elle Mouton c8c86717f2 graph/db: add NodeUpdatesInHorizon benchmark 2025-07-30 19:29:22 +02:00
Elle Mouton 5800a3e054 graph/db: benchmark various graph read calls
This commit adds benchmark tests for the ForEachNode and ForEachChannel
DB calls which are called by DescribeGraph.
2025-07-30 14:06:33 +02:00
Elle Mouton f5ce4a5656 graph/db: add BenchmarkCacheLoading
Add a benchmark test to test graph cache loading against various local
graph DBs.
2025-07-30 14:06:33 +02:00
Elle Mouton 77fe1816f6 graph/db: add test helper for populating via migration
This commit adds a helper test that is similar to TestPopulateDBs except
for the fact that it uses the MigrateGraphToSQL function directly to
migrate a local kvdb-sql graph to a native SQL one.
2025-07-30 14:06:33 +02:00
Elle Mouton afbe6b12ed graph/db: define various db connection helpers for incoming tests
This is a prep commit that just adds all the boilerplate connection
logic for connecting to various graph DBs. These will be used in
upcoming commits which will add tests and benchmarks.
2025-07-30 14:06:33 +02:00