Commit Graph
100 Commits
Author SHA1 Message Date
András Bánki-Horváth 254d9be6ff Merge pull request #5513 from bhandras/commit_queue_fix
etcd: fix dereferencing issue in commit queue causing contention and change design to be more scalable
2021-08-06 09:26:40 +02:00
Andras Banki-Horvath e243be1ba2 docs: update 0.14.0 release notes 2021-08-06 07:53:14 +02:00
Andras Banki-Horvath b29ae94e10 etcd: redesign commit queue to make it more robust and scalable
This commit builds on the ideas of @cfromknecht in lnd/5153. The
addition is that the design is now simpler and more robust by queueing
up everything, but allowing maximal parallelism where txns don't block.
Furthermore the commit makes CommitQueue.Done() private essentially
removing the need to understand the queue externally.
2021-08-06 07:53:13 +02:00
Andras Banki-Horvath 02aa77261d etcd: fix dereferncing issue in etcd.CommitQueue causing contention
This commit fixes an issue where subsequent transaction retries may have
changed the read/write sets inside the STM which in turn left junk
references to these keys in the CommitQueue. The left keys potentially
conflicted with subsequent transactions, queueing them up causing
througput degradation.
2021-08-06 07:53:10 +02:00
Andras Banki-Horvath 7da0b80674 docs: update 0.14 release notes 2021-07-27 13:57:09 +02:00
Andras Banki-Horvath f54c127021 itest: fix async payment benchmark timeout flakes 2021-07-27 13:57:09 +02:00
András Bánki-Horváth 5de6af798d Merge pull request #5515 from bhandras/mc_store_optimization
routing: store missioncontrol state in blocks and eliminate cursor use
2021-07-26 23:36:51 +02:00
Andras Banki-Horvath cfa3f708f1 docs: update release notes 2021-07-26 17:02:14 +02:00
Andras Banki-Horvath f13a348c97 config: update sample-lnd.conf with routerrpc.mcflushinterval 2021-07-26 17:02:14 +02:00
Andras Banki-Horvath 6d80ddfe91 routing: store missioncontrol state in blocks and eliminate cursor use
This commit changes missioncontrol's store update from per payment to
every second. Updating the missioncontrol store on every payment caused
gradual slowdown when using etcd.
We also completely eliminate the use of the cursor, further reducing
the performance bottleneck.
2021-07-26 17:02:11 +02:00
András Bánki-Horváth 275eca1640 Merge pull request #5514 from bhandras/payment_seq_blocks
payments: allocate payment sequences in blocks
2021-07-22 19:21:44 +02:00
Andras Banki-Horvath bc3886c85b docs: update release notes 2021-07-22 15:15:38 +02:00
Andras Banki-Horvath 798bf05838 build: add itest-race build target to catch data races with itests
This commit adds itest-race build target that can be used with
individual itests to detect and catch uncovered data races.
2021-07-22 15:15:35 +02:00
Andras Banki-Horvath 9ce5585eff docs: update release notes 2021-07-21 16:36:13 +02:00
Andras Banki-Horvath f33b5a4057 payments: allocate payment sequences in blocks
The bucket sequence we use as payment sequence makes the DB update in
InitPayment conflict and therefore queue up when many concurrent
payments happen. This change allocates payment sequences in blocks
of 1000 to avoid these conflicts.
2021-07-21 16:36:10 +02:00
Andras Banki-Horvath dd05e29225 docs: update release notes 2021-07-20 21:02:16 +02:00
Andras Banki-Horvath bc4ffb489d etcd: optionally reduce concurrency to single writer for legacy code 2021-07-20 21:02:11 +02:00
Andras Banki-Horvath 96caa6f242 etcd: remove assertion when creating bucket and value with the same key
This commit removes an assertion which is not needed because with etcd
we can safely create keys and values with the same key since they are
stored under different keys in the DB. This saves us one unnecessary Get
on every Put.
2021-07-16 16:06:32 +02:00
Andras Banki-Horvath 11a44a94b1 etcd: remove unnecessary iterator step from cursor Delete
The etcd cursor Delete stepped to the next item in the range before
Delete to not invalidate the iteation. This is unnecessary and not
compatible with bbolt, resulting in an extra fetch too.
2021-07-16 15:21:14 +02:00
Andras Banki-Horvath 6dc64f7d2f etcd: disable excessive logging when using embedded etcd 2021-07-15 15:35:38 +02:00
Andras Banki-Horvath 7ce3223919 harness: remove killed nodes from active nodes 2021-07-15 11:26:27 +02:00
Andras Banki-Horvath f41771ce54 docs: leader election docs 2021-07-06 16:21:26 +02:00
Andras Banki-Horvath fc139d9bb8 kvdb: add ForEachBucket implementation 2021-05-13 10:35:35 +02:00
Andras Banki-Horvath 3c6f036bee kvdb: make lnd/kvdb a submodule 2021-05-07 14:18:57 +02:00
Andras Banki-Horvath 14c851c8fc kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Andras Banki-Horvath ad586c6bf1 healthcheck: separate lnd/healthcheck into submodule 2021-05-05 15:33:19 +02:00
Andras Banki-Horvath cee832b749 healthcheck: disable default healthcheck logger
Disable logging by default in the healthcheck submodule to cut
dependency on lnd/build as we are hooking the logger separately
during lnd init.
2021-05-05 15:33:14 +02:00
Andras Banki-Horvath dd14947154 lint: silence depreciation warnings 2021-05-04 17:33:14 +02:00
Andras Banki-Horvath 80bc46e614 lint: fix proto message no-copy linter warnings 2021-05-04 17:33:14 +02:00
Andras Banki-Horvath 9aacc35989 lnrpc: add GetState to stateservice (v1/state)
This commit adds a new GetState call to the state service in order to
make leader election integrate simply with k8s using a readinessProbe.
2021-05-04 17:33:13 +02:00
Andras Banki-Horvath 7caf26ce94 itest: add itest for failover after forcefull shutdown 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath 5d8488871c itest: basic failover itest when using leader election on etcd 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath 5e215a7a66 lnrpc: add "waiting to start" state to state service
This commit adds a new "waiting to start" state which may be used to
query if we're still waiting to become the cluster leader. Once leader
we advance the state to "wallet not exist" or "wallet locked" given
wallet availablity.
2021-05-04 17:33:11 +02:00
Andras Banki-Horvath b6a620e6b2 misc: add ability to store the wallet in the remote DB 2021-05-04 17:33:11 +02:00
Andras Banki-Horvath 08be03367a walletunlocker: extract method to create the Loader 2021-05-04 17:33:10 +02:00
Andras Banki-Horvath c190c3d582 etcd: update etcd to 3.4.14 2021-05-04 17:33:09 +02:00
Andras Banki-Horvath e5f249ad51 mod: integrate latest btcwallet and bump protobuf and grpc 2021-05-04 17:33:09 +02:00
Andras Banki-Horvath d161b34ee5 lnd: integrate leader elector to lnd main
This commit also changes the order of DB init to be run after the RPC
server is up. This will allow us to later add an RPC endpoint to be used
to query leadership status.
2021-05-04 17:33:08 +02:00
Andras Banki-Horvath 41532ce634 cluster: add etcd based leader elector and factory 2021-05-04 17:33:07 +02:00
Andras Banki-Horvath e62dbca11a cluster: add cluster package skeleton and LeaderElector interface 2021-05-04 17:33:07 +02:00
Andras Banki-Horvath 282618441d etcd: do not try authenticate when using embedded 2021-05-04 17:33:06 +02:00
Andras Banki-Horvath 5441c1bb6d etcd: fix embbeded etcd connection cfg 2021-05-04 17:33:06 +02:00
Andras Banki-Horvath 9992e5c0b5 etcd: decouple embedded etcd instance startup
This refactor changes how we instantiate the etcd based Backend to allow
separate initialization and startup for the embedded instance.
2021-05-04 17:33:05 +02:00
Andras Banki-Horvath 6757e14998 etcd: refactors to simplify etcd configuration
This refactor removes a redundancy where we had etcd configuration under
kvdb and kvdb/etcd packages.
2021-05-04 17:33:04 +02:00
Andras Banki-Horvath 44e312ace9 etcd: remove (unused) etcd root bucket prefix
This commit removes the unused prefix from the etcd backend config as
etcd key space separation in LND is implemented by using namespaces
instead.
2021-05-04 17:32:59 +02:00
Andras Banki-Horvath ec50f2ccce invoices: more verbose logging for startup invoice GC 2021-04-22 15:37:53 +02:00
Andras Banki-Horvath adbcc3f7a3 invoices: do not fail DeleteInvoice if payment addr isn't indexed
This commit relaxes DeleteInvoice failure cases by removing the
requirement that the invoice needs to be indexed by the payment address.
Since payment address index was introduced with an empty migration it
is possible that users have old invoices which were never added to
this index causing invoice garbage collection to get stuck.
2021-04-19 17:56:09 +02:00
Andras Banki-Horvath dde5750160 invoices+rpc: add missing channel graph to the AddInvoiceConfig
The Graph which is referenced later in the AddInvoice call graph is
unset when adding a hodl invoice. This resulted in a crash.
2021-02-03 11:33:27 +01:00
Andras Banki-Horvath 22711ade3a cnct: dispatch contract breach after channel close summary is serialized
This commit moves the contract breach event dispatch after the channel
close summary has been added to the database. This is important
otherwise it may occur that we attempt to mark the channel fully closed
while the channel close summary is not yet serialized.
2021-01-11 22:48:41 +01:00
Andras Banki-Horvath d3cd412137 ci: add etcd itests to our CI (bitcoind only) 2021-01-08 15:39:12 +01:00
Andras Banki-Horvath b2ab5e8af1 itests: run etcd itests with generated ports 2021-01-08 15:39:12 +01:00
Andras Banki-Horvath f1831f0581 etcd: add support for user specified ports for testing 2021-01-08 15:39:11 +01:00
Andras Banki-Horvath ce4ca86ca6 kvdb: fix kvdb.Batch to use state reset when using etcd backend 2021-01-08 15:39:11 +01:00
Andras Banki-Horvath a9ba5af9fd etcd: fix config in docs and extend with new options 2021-01-05 16:50:57 +01:00
Andras Banki-Horvath cb2b5efc6e etcd: add (dev only) disabletls option for etcd 2021-01-05 16:50:53 +01:00
Andras Banki-Horvath 5ee0d77414 build: extend sample-lnd.conf with the new etcd namespace 2020-12-16 18:34:41 +01:00
Andras Banki-Horvath 4a6af67241 etcd: add support for namespaces
This commit adds support for etcd namespaces. This is useful when
using a shared etcd database where separate users have access to
separate namespaces.
2020-12-16 18:25:38 +01:00
András Bánki-Horváth 669663bfc2 Merge pull request #4822 from bhandras/add_globalfeatures
routing: add missing features to NetworkNodeUpdate (and also depreacte GlobalFeatures)
2020-12-08 10:16:50 +01:00
Andras Banki-Horvath 98c61be342 routing: add missing GlobalFeatures to NetworkNodeUpdate 2020-12-07 15:47:09 +01:00
Andras Banki-Horvath 5e19c41cb8 build: extend sample-lnd-conf with db.etcd.embedded 2020-11-18 15:34:46 +01:00
Andras Banki-Horvath 5f3b800630 lint: fix error reported by the linter 2020-11-18 15:34:46 +01:00
Andras Banki-Horvath efedb5547c itest: timeouts for itets with etcd 2020-11-18 15:34:45 +01:00
Andras Banki-Horvath 369ae5e372 itest: move all test db files when using both etcd and bbolt
In some tests we moved channeld.db to a temp location in order to
"time travel". This commit extends the existing semantics by moving all
files, including embedded etcd db too besides the channeld.db file.
2020-11-18 15:34:45 +01:00
Andras Banki-Horvath 9138efc2c3 build: extend itest with etcd=1 param which will run itests on etcd 2020-11-18 15:34:44 +01:00
Andras Banki-Horvath 98342433ab itest: add etcd flag to control if new lnd nodes should run on etcd 2020-11-18 15:34:44 +01:00
Andras Banki-Horvath 511e817624 lncfg+channeldb: add config to be able to run lnd on embedded etcd 2020-11-18 15:34:43 +01:00
Andras Banki-Horvath 38e8184926 itest: update error log whitelist 2020-11-12 09:17:53 +01:00
Andras Banki-Horvath 9eac0dd3c9 itest: fix crash in parallel macaroon tests 2020-11-12 09:17:52 +01:00
Andras Banki-Horvath 979c8497b2 itest: add icase to node log filename + restart nodes before each icase
This commit adds the icase name to the log filename, to make it simpler
to find problematic tests. Additionally after this commit we'll restart
Alice and Bob (the base harness nodes) before each icase to start with a
clean state.
2020-11-12 09:17:52 +01:00
Andras Banki-Horvath d6c2ee1bbf itest: use require.NoError in TestLightningNetworkDaemon 2020-11-12 09:17:47 +01:00
András Bánki-Horváth 0c3c6e6155 Merge pull request #4705 from bhandras/kvdb_view_reset
multi: add reset closure to `kvdb.View/Update` to be able to clean up external state before retries
2020-11-06 12:47:35 +01:00
Andras Banki-Horvath adfd99ec08 etcd: allow readwrite bucket Delete with nil key (bbolt compatibility) 2020-11-05 17:57:13 +01:00
Andras Banki-Horvath e8f47cf882 invoices: channel graph reference was wrongly retrieved from remote db
This commit fixes a bug where we tried to use the graph from the remote
db instance whereas it lives in the local db instance.
2020-11-05 17:57:13 +01:00
Andras Banki-Horvath d89f51d1d0 multi: add reset closure to kvdb.Update
Similarly as with kvdb.View this commits adds a reset closure to the
kvdb.Update call in order to be able to reset external state if the
underlying db backend needs to retry the transaction.
2020-11-05 17:57:12 +01:00
Andras Banki-Horvath 2a358327f4 multi: add reset closure to kvdb.View
This commit adds a reset() closure to the kvdb.View function which will
be called before each retry (including the first) of the view
transaction. The reset() closure can be used to reset external state
(eg slices or maps) where the view closure puts intermediate results.
2020-11-05 17:57:12 +01:00
Andras Banki-Horvath ffb27284df channeldb: change walletdb dependency to kvdb 2020-11-05 17:57:08 +01:00
András Bánki-Horváth 9c9ce15ca6 Merge pull request #4708 from bhandras/expiry_watcher_opt
invoices: reduce heap usage when starting the expiry watcher
2020-10-29 10:15:35 +01:00
Andras Banki-Horvath 478cf704be invoices: reduce heap usage when starting the expiry watcher 2020-10-28 16:26:47 +01:00
András Bánki-Horváth dc16869d72 Merge pull request #4725 from halseth/chaneventstore-race
chanfitness/chaneventstore:  stop ticker after goroutine
2020-10-28 11:26:30 +01:00
András Bánki-Horváth 111db801e7 Merge pull request #4457 from bhandras/etcd_tx_queue
etcd: STM transaction queue to effectively reduce retries for conflicting transactions
2020-09-17 17:35:59 +02:00
Andras Banki-Horvath 26effca761 build: unit test on github with kvdb_etcd tag 2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 357cd7d7a7 make: allow optional extra tags when running unit tests 2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 9c47392dfa etcd: integrate the commitQueue to the STM commit loop
This commit integrates an externally passed commitQueue instance with
the STM to reduce retries for conflicting transactions.
2020-09-17 14:50:19 +02:00
Andras Banki-Horvath 6f3a45b75f etcd: make embedded etcd context cancelable 2020-09-17 14:50:18 +02:00
Andras Banki-Horvath 281c0b9d92 etcd: add commit queue to effectively reduce transaction retries
This commit adds commitQueue which is a lightweight contention manager
for STM transactions. The queue attempts to queue up transactions that
conflict for sequential execution, while leaving all "unblocked"
transactons to run freely in parallel.
2020-09-17 14:50:18 +02:00
Andras Banki-Horvath b4b5a9d7de etcd: increase message and transaction limits for embedded etcd 2020-09-17 14:50:14 +02:00
András Bánki-Horváth dea6d91431 Merge pull request #4603 from bhandras/fix_help
config: prevent displaying usage twice if --help was requested
2020-09-14 18:58:21 +02:00
Andras Banki-Horvath b778b25866 config: prevent displaying usage twice if --help was requested 2020-09-14 15:18:41 +02:00
András Bánki-Horváth d62b93e012 Merge pull request #4607 from bhandras/routing_experiments
lncli: add outgoing_chanid to queryroutes
2020-09-14 13:26:56 +02:00
Andras Banki-Horvath 4ffe744364 lncli: add outgoing_chanid to queryroutes 2020-09-14 11:36:06 +02:00
András Bánki-Horváth c3821e5ad1 Merge pull request #4493 from bhandras/invoice_gc
invoices: garbage collect settled/canceled invoices
2020-08-24 08:34:58 +02:00
Andras Banki-Horvath 2aa680ede2 invoices: optionally garbage collect invoices on the fly
This commit extends invoice garbage collection to also remove invoices
which are canceled when LND is already up and running. When the option
GcCanceledInvoicesOnTheFly is false (default) then invoices are kept and
the behavior is unchanged.
2020-08-05 12:24:17 +02:00
Andras Banki-Horvath a0d7877d9a multi: make canceled invoice garbage collection configurable
This commit extends the application config with a flag to control canceled
invoice garbage collection upon startup.
2020-08-05 12:24:16 +02:00
Andras Banki-Horvath 0ea763d83c invoices: attempt to delete old invoices upon start 2020-08-05 12:24:15 +02:00
Andras Banki-Horvath a5778c4673 channeldb: add DeleteInvoices call
This commit extends channeldb with the DeleteInvoices call which is when
passed a slice of delete references will attempt to delete the invoices
pointed to by the references and also clean up all our invoice indexes.
2020-08-05 12:24:15 +02:00
Andras Banki-Horvath 92f3b0a30c channeldb+invoices: add ScanInvoices and integrate with InvoiceRegistry
This commit adds channeldb.ScanInvoices to scan through all invoices in
the database. The new call will also replace the already existing
channeldb.FetchAllInvoicesWithPaymentHash call in preparation to collect
invoices we'd like to delete and watch for expiry in one scan in later
commits.
2020-08-05 12:24:14 +02:00
Andras Banki-Horvath ba3c65bfd6 invoices: re-format overreaching code lines 2020-08-05 12:24:13 +02:00
Andras Banki-Horvath 5346ed8a5c kvdb+etcd: assert on bucket/value key when putting value/bucket
This commit extends compatibility with the bbolt kvdb implementation,
which returns ErrIncompatibleValue in case of a bucket/value key
collision. Furthermore the commit also adds an extra precondition to the
transaction when a key doesn't exist. This is needed as we fix reads to
a snapshot revision and other writers may commit the key otherwise.
2020-08-01 00:29:01 +02:00
Andras Banki-Horvath b17ed28dea build: add all subservers to dev build 2020-07-29 14:33:25 +02:00
Andras Banki-Horvath 12a341ba59 etcd: remove the lock set concept
This commit removes the lock set which was used to only add bucket keys
to the tx predicate while also bumping their mod version.
This was useful to reduce the size of the compare set but wasn't useful
to reduce contention as top level buckets were always in the lock set.
2020-07-28 17:57:30 +02:00