etcd: make max message size configurable

This commit is contained in:
Andras Banki-Horvath 2021-12-02 20:55:05 +01:00
parent 8d3fec35fe
commit 1ccc5e8014
No known key found for this signature in database
GPG Key ID: 80E5375C094198D8
5 changed files with 11 additions and 2 deletions

2
go.mod
View File

@ -46,7 +46,7 @@ require (
github.com/lightningnetwork/lnd/cert v1.1.0
github.com/lightningnetwork/lnd/clock v1.1.0
github.com/lightningnetwork/lnd/healthcheck v1.2.0
github.com/lightningnetwork/lnd/kvdb v1.2.1
github.com/lightningnetwork/lnd/kvdb v1.2.3
github.com/lightningnetwork/lnd/queue v1.1.0
github.com/lightningnetwork/lnd/ticker v1.1.0
github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796

View File

@ -30,6 +30,8 @@ type Config struct {
CollectStats bool `long:"collect_stats" description:"Whether to collect etcd commit stats."`
MaxMsgSize int `long:"max_msg_size" description:"The maximum message size in bytes that we may send to etcd."`
// SingleWriter should be set to true if we intend to only allow a
// single writer to the database at a time.
SingleWriter bool

View File

@ -141,7 +141,7 @@ func newEtcdBackend(ctx context.Context, cfg Config) (*db, error) {
DialTimeout: etcdConnectionTimeout,
Username: cfg.User,
Password: cfg.Pass,
MaxCallSendMsgSize: 16384*1024 - 1,
MaxCallSendMsgSize: cfg.MaxMsgSize,
}
if !cfg.DisableTLS {

View File

@ -73,6 +73,10 @@ func DefaultDB() *DB {
AutoCompactMinAge: kvdb.DefaultBoltAutoCompactMinAge,
DBTimeout: kvdb.DefaultDBTimeout,
},
Etcd: &etcd.Config{
// Allow at most 32 MiB messages by default.
MaxMsgSize: 32768 * 1024,
},
Postgres: &postgres.Config{
MaxConnections: defaultPostgresMaxConnections,
},

View File

@ -1169,6 +1169,9 @@ litecoin.node=ltcd
; testing with embedded etcd.
; db.etcd.embedded_log_file=/path/etcd.log
; The maximum message size in bytes that we may send to etcd. Defaults to 32 MiB.
; db.etcd.max_msg_size=33554432
[postgres]
; Postgres connection string.
; db.postgres.dsn=postgres://lnd:lnd@localhost:45432/lnd?sslmode=disable