Keep information about all block files in memory #4988

pull sipa wants to merge 2 commits into bitcoin:master from sipa:allinfo changing 1 files +40 −38
  1. sipa commented at 4:33 AM on September 27, 2014: member

    As preparation for a version of #4701 that keeps track of the size of data on disk.

  2. in src/main.cpp:None in cafda0c28f outdated
    2866 | @@ -2876,9 +2867,19 @@ bool static LoadBlockIndexDB()
    2867 |  
    2868 |      // Load block file info
    2869 |      pblocktree->ReadLastBlockFile(nLastBlockFile);
    2870 | +    vinfoBlockFile.resize(nLastBlockFile + 1);
    2871 |      LogPrintf("LoadBlockIndexDB(): last block file = %i\n", nLastBlockFile);
    2872 | -    if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
    2873 | -        LogPrintf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString());
    


    Diapolo commented at 12:05 PM on September 27, 2014:

    We now have a log message removed, was that intended?


    sipa commented at 3:49 AM on September 29, 2014:

    Nice catch! Fixed.

  3. sipa force-pushed on Sep 29, 2014
  4. BitcoinPullTester commented at 7:31 PM on September 29, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4988_31290b760f18203a12a72dcc69bc573ce40516d7/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  5. Keep information about all block files in memory ed6d1a2c7b
  6. sipa force-pushed on Oct 6, 2014
  7. gmaxwell commented at 12:28 AM on October 9, 2014: contributor

    This seems pretty useful. Looks okay, I'll give it some testing.

  8. laanwj commented at 7:58 AM on October 9, 2014: member

    I've been testing this as well.

  9. rdponticelli commented at 9:54 AM on October 9, 2014: contributor

    I've been reviewing and testing as well, building on top #4701 and #4468. So far, so good. So for me it would be an ACK.

  10. rdponticelli referenced this in commit 3eaf3d4cfc on Oct 9, 2014
  11. jgarzik commented at 3:02 PM on October 13, 2014: contributor

    ut ACK

  12. in src/main.cpp:None in ed6d1a2c7b outdated
    2117 | -    } else {
    2118 | -        while (infoLastBlockFile.nSize + nAddSize >= MAX_BLOCKFILE_SIZE) {
    2119 | -            LogPrintf("Leaving block file %i: %s\n", nLastBlockFile, infoLastBlockFile.ToString());
    2120 | +    unsigned int nFile = fKnown ? pos.nFile : nLastBlockFile;
    2121 | +    if (vinfoBlockFile.size() <= nFile) {
    2122 | +        vinfoBlockFile.resize(nFile + 1);
    


    laanwj commented at 9:09 AM on October 16, 2014:

    I wonder; do we need this (conditional) resize in three places, or could we replace it with an assert in some of the places because encountering a new block file would be unexpected?


    rdponticelli commented at 8:27 PM on October 20, 2014:

    Yeah, I've been thinking about those repetitions as well. But I think there are other improvements to make into how block files are managed, so some of those improvements might well be left for latter pulls.

  13. laanwj commented at 10:28 AM on October 21, 2014: member

    Tested ACK (has run succesfully on some of my test nodes for a while; survived a succesful reindex)

  14. Replace some function names with __func__ 7b2bb96271
  15. in src/main.cpp:None in ed6d1a2c7b outdated
    2822 | -    if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
    2823 | -        LogPrintf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString());
    2824 | +    for (int nFile = 0; nFile <= nLastBlockFile; nFile++) {
    2825 | +        pblocktree->ReadBlockFileInfo(nFile, vinfoBlockFile[nFile]);
    2826 | +    }
    2827 | +    LogPrintf("LoadBlockIndexDB(): last block file info: %s\n", vinfoBlockFile[nLastBlockFile].ToString());
    


    Diapolo commented at 11:08 AM on October 21, 2014:

    Suggestion: You could also switch over to use func instead of the function name :).


    sipa commented at 11:18 PM on October 21, 2014:

    Done.

  16. laanwj merged this on Oct 22, 2014
  17. laanwj closed this on Oct 22, 2014

  18. laanwj referenced this in commit 13bddef870 on Oct 22, 2014
  19. MarcoFalke locked this on Sep 8, 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: 2026-04-15 15:15 UTC

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