Correct units for “-dbcache” and “-prune” #15163

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190114-correct-info-units changing 8 files +24 −19
  1. hebasto commented at 12:23 pm on January 14, 2019: member

    Actually, all dbcache-related values in the code are measured in MiB (not in megabytes, MB) or in bytes (e.g., nTotalCache).

    See: https://github.com/bitcoin/bitcoin/blob/master/src/txdb.h

    https://github.com/bitcoin/bitcoin/blob/ba8c8b22272ad40fe2de465d7e745532bab48d3b/src/init.cpp#L1405-L1424

    Also, “-prune” is fixed:

    1. The GUI values in GB are translated to the node values in MiB correctly.
    2. The maximum of the “prune” QSpinBox is not limited by default value of 99 (GB).

    Fix: #15106

  2. fanquake added the label GUI on Jan 14, 2019
  3. DrahtBot commented at 1:47 pm on January 14, 2019: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #13676 (Explain that mempool memory is added to -dbcache by Sjors)

    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.

  4. laanwj commented at 2:41 pm on January 14, 2019: member
    Concept ACK it is good to be consistent with units.
  5. MarcoFalke commented at 4:12 pm on January 14, 2019: member
  6. hebasto renamed this:
    Correct unit for "-dbcache"
    Correct units for "-dbcache" and "-prune"
    on Jan 14, 2019
  7. hebasto commented at 11:08 pm on January 14, 2019: member
    @MarcoFalke Thank you for your review. Your comment has been addressed.
  8. in src/qt/intro.h:13 in 205035716d outdated
     9@@ -10,6 +10,7 @@
    10 #include <QThread>
    11 
    12 static const bool DEFAULT_CHOOSE_DATADIR = false;
    13+static constexpr uint64_t GB_BYTES = 1000000000LL;
    


    laanwj commented at 2:09 pm on January 15, 2019:
    I’d propose put this in guiconstants.h instead, there is no reason optionsdialog.cpp should depend on intro.h
  9. hebasto force-pushed on Jan 15, 2019
  10. hebasto commented at 5:06 pm on January 15, 2019: member
    @laanwj Thank you for your review. Your comment has been addressed.
  11. laanwj commented at 4:43 pm on January 21, 2019: member
    utACK 2c7575892292e1c5832b411c5ca02bc96ca23d29
  12. in src/qt/guiconstants.h:56 in 2c75758922 outdated
    51@@ -52,4 +52,7 @@ static const int MAX_URI_LENGTH = 255;
    52 #define QAPP_APP_NAME_TESTNET "Bitcoin-Qt-testnet"
    53 #define QAPP_APP_NAME_REGTEST "Bitcoin-Qt-regtest"
    54 
    55+/* One gigabyte (GB) in bytes */
    56+static constexpr uint64_t GB_BYTES{1000000000};
    


    laanwj commented at 3:49 pm on January 24, 2019:
    Why is the LL suffix no longer needed here? Due to the new initialization style?

    sipa commented at 4:23 pm on January 24, 2019:

    @laanwj I was wondering about the same thing, and this is what I conclude.

    Since C++11, L, LL, UL, ULL should never be needed anymore, as the type of the constant is automatically chosen to be sufficiently large for the provided value, but signed. Before C++11, long long would not be automatically chosen.

    It may be necessary to use a U suffix to indicate an unsigned constant, as a 64-bit value (which is larger or equal to 2^63) will by default be of type signed long (long), which would overflow.


    hebasto commented at 4:41 pm on January 24, 2019:

    Due to the new initialization style?

    Yes. list initialization (since C++11):

    Narrowing conversions

    list-initialization limits the allowed implicit conversions by prohibiting … conversion from integer … to integer type that cannot represent all values of the original, except where source is a constant expression whose value can be stored exactly in the target type


    laanwj commented at 6:55 pm on January 24, 2019:
    Thanks @sipa and @hebasto
  13. jonasschnelli commented at 8:30 pm on January 29, 2019: contributor
    Needs a commit squash… otherwise utACK
  14. Correct units for "-dbcache" and "-prune"
    All dbcache-related values in the code are measured in MiB (not in
    megabytes, MB) or in bytes.
    The GUI "-prune" values in GB are translated to the node values in MiB
    correctly. The maximum of the "-prune" QSpinBox is not limited by the
    default value of 99 (GB).
    Also, this improves log readability.
    6f6514a080
  15. hebasto force-pushed on Jan 30, 2019
  16. hebasto commented at 5:27 am on January 30, 2019: member
    Squashed.
  17. laanwj merged this on Jan 30, 2019
  18. laanwj closed this on Jan 30, 2019

  19. laanwj referenced this in commit 77339e5c24 on Jan 30, 2019
  20. hebasto deleted the branch on Jan 30, 2019
  21. jasonbcox referenced this in commit b94d486493 on Oct 12, 2020
  22. Munkybooty referenced this in commit b7c1e4955f on Aug 21, 2021
  23. Munkybooty referenced this in commit 0ffeae4709 on Aug 23, 2021
  24. Munkybooty referenced this in commit d1474f9716 on Aug 24, 2021
  25. Munkybooty referenced this in commit cbb2129c7d on Aug 24, 2021
  26. Munkybooty referenced this in commit 4f13c4a88a on Aug 24, 2021
  27. UdjinM6 referenced this in commit fcc767a832 on Aug 24, 2021
  28. Munkybooty referenced this in commit 980b0a9469 on Aug 24, 2021
  29. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me