As preparation for a version of #4701 that keeps track of the size of data on disk.
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-
sipa commented at 4:33 AM on September 27, 2014: member
-
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.
sipa force-pushed on Sep 29, 2014BitcoinPullTester commented at 7:31 PM on September 29, 2014: noneAutomatic 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.
sipa cross-referenced this on Sep 30, 2014 from issue Autoprune by rdponticelliKeep information about all block files in memory ed6d1a2c7bsipa force-pushed on Oct 6, 2014gmaxwell commented at 12:28 AM on October 9, 2014: contributorThis seems pretty useful. Looks okay, I'll give it some testing.
laanwj commented at 7:58 AM on October 9, 2014: memberI've been testing this as well.
rdponticelli commented at 9:54 AM on October 9, 2014: contributorrdponticelli referenced this in commit 3eaf3d4cfc on Oct 9, 2014jgarzik commented at 3:02 PM on October 13, 2014: contributorut ACK
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.
laanwj commented at 10:28 AM on October 21, 2014: memberTested ACK (has run succesfully on some of my test nodes for a while; survived a succesful reindex)
Replace some function names with __func__ 7b2bb96271in 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.
laanwj merged this on Oct 22, 2014laanwj closed this on Oct 22, 2014laanwj referenced this in commit 13bddef870 on Oct 22, 2014bitcoin locked this on Sep 8, 2021
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-05-20 06:55 UTC