Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet: Make BDB support optional #20202

Merged
merged 7 commits into from
Nov 23, 2020
Merged

Conversation

achow101
Copy link
Member

Adds a --without-bdb option to configure which disables the compilation of the BDB stuff. Legacy wallets will not be created when BDB is not compiled. A legacy-sqlite wallet can be loaded, but we will not create them.

Based on #20156 to resolve the situation where both --without-sqlite and --without-bdb are provided. In that case, the wallet is disabled and --disable-wallet is effectively set.

@hebasto
Copy link
Member

hebasto commented Oct 20, 2020

Concept ACK.

build-aux/m4/bitcoin_find_bdb48.m4 Outdated Show resolved Hide resolved
configure.ac Show resolved Hide resolved
src/wallet/init.cpp Outdated Show resolved Hide resolved
src/wallet/salvage.cpp Outdated Show resolved Hide resolved
return MakeUnique<BerkeleyDatabase>(std::make_shared<BerkeleyEnvironment>(), "");
#elif USE_SQLITE
Copy link
Member

Choose a reason for hiding this comment

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

For a followup PR...

Should we be testing with both mock dbs when bdb+sqlite are built?

@practicalswift
Copy link
Contributor

Concept ACK

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 21, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@Sjors Sjors 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. Tested bb93bf6 on macOS.

This breaks a whole bunch of functional tests. It would be better if those are skipped.

Having this configuration on one of the CI machines makes sense to me as well. As we work towards #20160 all tests should (also) use descriptor wallets. Perhaps merging #18788 first makes that easier.

configure.ac Outdated
@@ -1746,6 +1762,7 @@ echo " multiprocess = $build_multiprocess"
echo " with wallet = $enable_wallet"
if test "x$enable_wallet" != "xno"; then
echo " with sqlite = $use_sqlite"
echo " with bdb = $use_bdb"
Copy link
Member

Choose a reason for hiding this comment

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

bb93bf6: nit: move = to the right a bit:

  with wallet   = yes
    with sqlite = yes
    with bdb = no

@achow101
Copy link
Member Author

This breaks a whole bunch of functional tests. It would be better if those are skipped.

Having this configuration on one of the CI machines makes sense to me as well. As we work towards #20160 all tests should (also) use descriptor wallets. Perhaps merging #18788 first makes that easier.

It'd be a lot easier if tests used the MiniWallet. I think we can do those as a followup.

@luke-jr
Copy link
Member

luke-jr commented Oct 24, 2020

IMO PRs shouldn't be merged with tests broken...

@maflcko
Copy link
Member

maflcko commented Oct 25, 2020

C:\projects\bitcoin\src\wallet\walletdb.cpp(1087): error C4716: 'CreateMockWalletDatabase': must return a value [C:\projects\bitcoin\build_msvc\test_bitcoin-qt\test_bitcoin-qt.vcxproj]
LINK : fatal error LNK1257: code generation failed [C:\projects\bitcoin\build_msvc\test_bitcoin-qt\test_bitcoin-qt.vcxproj]
db_tests.obj : error LNK2001: unresolved external symbol "class std::shared_ptr<class BerkeleyEnvironment> __cdecl GetWalletEnv(class boost::filesystem::path const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?GetWalletEnv@@YA?AV?$shared_ptr@VBerkeleyEnvironment@@@std@@AEBVpath@filesystem@boost@@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]
C:\projects\bitcoin\build_msvc\x64\Release\test_bitcoin.exe : fatal error LNK1120: 1 unresolved externals [C:\projects\bitcoin\build_msvc\test_bitcoin\test_bitcoin.vcxproj]

@achow101
Copy link
Member Author

Instead of prompting users to specify descriptors=True, how would people feel about just defaulting to descriptors=True and making all newly created wallets descriptor-sqlite wallets when BDB is not compiled?

I think that this would be really helpful in our test framework to ensure that tests that shouldn't be restricted to one wallet type do pass with both. So we can stop making tests that are dependent on legacy wallet behavior.

@achow101 achow101 force-pushed the opt-sqlite-bdb branch 2 times, most recently from d23454f to 7f518a7 Compare October 26, 2020 21:10
@laanwj
Copy link
Member

laanwj commented Nov 23, 2020

Code review ACK d52f502

@laanwj laanwj merged commit 86bf3ae into bitcoin:master Nov 23, 2020
@Sjors
Copy link
Member

Sjors commented Nov 23, 2020

This is missing a line in config.ini.in (@USE_BDB_TRUE@USE_BDB=true) and an is_bdb_compiled helper for functional tests. Done in a followup #20458

maflcko pushed a commit that referenced this pull request Nov 23, 2020
b87caf1 test: add is_bdb_compiled helper (Sjors Provoost)

Pull request description:

  Followup for #20202, needed by #16546.

  Allow the functional test suite to skip tests that require BDB, as well as introduce specific logic to handle whether BDB support is enabled or not. It follows the same pattern as `skip_if_no_sqlite` and `is_sqlite_compiled`.

ACKs for top commit:
  laanwj:
    Code review ACK b87caf1

Tree-SHA512: e84fb22e017b28f0f75d17e5368fcba22a893484b31b12082cfe9354e6fbd566daf34b3b82f7deb7205b2061c9c61538e402df000e2f05428affae6dbea05c5e
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 23, 2020
Copy link

@RonSherfey RonSherfey left a comment

Choose a reason for hiding this comment

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

How can I be sure which wallet to add?

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.