config+sqldb: make native SQL query config options configurable

Here, we make the sql query option params (batch size and pagination
size) configurable. The defaults for SQLite vs Postgres are still the
same but will be changed in an upcoming commit.
This commit is contained in:
Elle Mouton committed 2025-08-13 14:43:31 +02:00
1 parent 75691163a9
commit ee292786b1
5 files changed
+34 -6

No files matched your search

+7 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/btcsuite/btcd/chaincfg/chainhash"
graphdb "github.com/lightningnetwork/lnd/graph/db"
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lncfg"
"github.com/lightningnetwork/lnd/sqldb"
"github.com/lightningnetwork/lnd/sqldb/sqlc"
)
@@ -30,10 +31,15 @@ func (d *DefaultDatabaseBuilder) getGraphStore(baseDB *sqldb.BaseDB,
},
)
queryConfig := d.cfg.DB.Sqlite.QueryConfig
if d.cfg.DB.Backend == lncfg.PostgresBackend {
queryConfig = d.cfg.DB.Postgres.QueryConfig
}
return graphdb.NewSQLStore(
&graphdb.SQLStoreConfig{
ChainHash: *d.cfg.ActiveNetParams.GenesisHash,
QueryCfg: sqldb.DefaultQueryConfig(),
QueryCfg: &queryConfig,
},
graphExecutor, opts...,
)