Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

Opening wallets (the first time) after #14021 took on my end around 30 seconds due to the keymetadata migration (tested on regtest).

Using a single wallet batch reduces the required time for the migration down to <1s on my system for a default 2k keypool wallet.

@jonasschnelli jonasschnelli force-pushed the 2019/02/wallet_key_upgrade_batch branch from 204ad5c to 0bedcba Compare February 18, 2019 05:33
@meshcollider meshcollider added this to the 0.18.0 milestone Feb 18, 2019
@meshcollider
Copy link
Contributor

Tagged for 0.18 because I'd consider this a bugfix

@Sjors
Copy link
Member

Sjors commented Feb 18, 2019

Concept ACK.

We should also consider doing that for importmulti (at least per descriptor).

@laanwj
Copy link
Member

laanwj commented Feb 18, 2019

utACK and concept ACK 0bedcba

@meshcollider
Copy link
Contributor

utACK 0bedcba

@achow101 want to take a look?

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.

On line 387, before throwing, shouldn't it commit the batch?

@maflcko
Copy link
Member

maflcko commented Feb 18, 2019

@promag Wouldn't it doe that, as the unique ptr gets destroyed (and flush on exit was set to true by default)?

@promag
Copy link
Contributor

promag commented Feb 18, 2019

@MarcoFalke yap, it wasn't clear. Maybe worth a comment.

@jonasschnelli is there a rationale for 1000?

@achow101
Copy link
Member

utACK 0bedcba

@jonasschnelli
Copy link
Contributor Author

On line 387, before throwing, shouldn't it commit the batch?

As @MarcoFalke said, if the unique pointer gets out of the scope, it "commits" (flushes) to the database.

@jonasschnelli is there a rationale for 1000?

Not really. I thought 1000 is a good compromise between cache memory requirements and performance. A new constant looked after an overkill. Initially I wanted to tie it to the keypool size constant but somehow I thought then that this has nothing to do with memory consumption.

@meshcollider meshcollider merged commit 0bedcba into bitcoin:master Feb 18, 2019
@maflcko
Copy link
Member

maflcko commented Feb 18, 2019

1000 seems like a good upper bound, since the speedup flattens out after this:

(time in us)

upgradekeymetadata time

deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 5, 2020
Summary: This is a backport of [[bitcoin/bitcoin#15433 | PR15433]]

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D6383
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants