Skip to content

Commit 383c49b

Browse files
committed
multi: add --db.sync-graph-cache-load option
Add a new option to opt out of the new asynchronous graph cache loading feature.
1 parent f02f1c5 commit 383c49b

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

config_builder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,9 @@ func (d *DefaultDatabaseBuilder) BuildDatabase(
10341034

10351035
chanGraphOpts := []graphdb.ChanGraphOption{
10361036
graphdb.WithUseGraphCache(!cfg.DB.NoGraphCache),
1037+
graphdb.WithAsyncGraphCachePopulation(
1038+
!cfg.DB.SyncGraphCacheLoad,
1039+
),
10371040
}
10381041

10391042
// We want to pre-allocate the channel graph cache according to what we

lncfg/db.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ type DB struct {
9292

9393
NoGraphCache bool `long:"no-graph-cache" description:"Don't use the in-memory graph cache for path finding. Much slower but uses less RAM. Can only be used with a bolt database backend."`
9494

95+
SyncGraphCacheLoad bool `long:"sync-graph-cache-load" description:"Force synchronous loading of the graph cache. This will block the startup until the graph cache is fully loaded into memory. This is useful if any bugs appear with the new async loading feature of the graph cache."`
96+
9597
PruneRevocation bool `long:"prune-revocation" description:"Run the optional migration that prunes the revocation logs to save disk space."`
9698

9799
NoRevLogAmtData bool `long:"no-rev-log-amt-data" description:"If set, the to-local and to-remote output amounts of revoked commitment transactions will not be stored in the revocation log. Note that once this data is lost, a watchtower client will not be able to back up the revoked state."`

sample-lnd.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,12 @@
14711471
; less RAM. Can only be used with a bolt database backend.
14721472
; db.no-graph-cache=false
14731473

1474+
; Block the start-up of LND until the graph cache has been fully populated.
1475+
; If not set, the graph cache will be populated asynchronously and any read
1476+
; calls made before the cache is fully populated will fall back to the
1477+
; database.
1478+
; db.sync-graph-cache-load=false
1479+
14741480
; Specify whether the optional migration for pruning old revocation logs
14751481
; should be applied. This migration will only save disk space if there are open
14761482
; channels prior to [email protected].

0 commit comments

Comments
 (0)