Skip to content

Commit

Permalink
Merge pull request #6049 from bhandras/etcd_msg_size
Browse files Browse the repository at this point in the history
etcd: make max message size configurable
  • Loading branch information
Roasbeef authored Dec 2, 2021
2 parents ed3e597 + 24d5146 commit ad78ff1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/release-notes/release-notes-0.14.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
* [Clean up Makefile by using go
install](https://github.com/lightningnetwork/lnd/pull/6035).

* [Make etcd max message size
configurable]((https://github.com/lightningnetwork/lnd/pull/6049).

# Contributors (Alphabetical Order)

* Andras Banki-Horvath
* Naveen Srinivasan
* Oliver Gugger
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions kvdb/etcd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion kvdb/etcd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions lncfg/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
3 changes: 3 additions & 0 deletions sample-lnd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad78ff1

Please sign in to comment.