Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864854
D17745.id52912.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Subscribers
None
D17745.id52912.diff
View Options
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -525,8 +525,9 @@
: Started from `main()` in `bitcoind.cpp`. Responsible for starting up and
shutting down the application.
-- [ThreadImport (`b-loadblk`)](https://www.bitcoinabc.org/doc/dev/init_8cpp.html#ae9e290a0e829ec0198518de2eda579d1)
- : Loads blocks from `blk*.dat` files or `-loadblock=<file>` on startup.
+- [Init load (`b-initload`)](https://www.bitcoinabc.org/doc/dev/init_8cpp.html#ae9e290a0e829ec0198518de2eda579d1)
+ : Performs various loading tasks that are part of init but shouldn't block the node from being started: external block import,
+ reindex, reindex-chainstate, main chain activation, spawn indexes background sync threads and mempool load.
- [ThreadScriptCheck (`b-scriptch.x`)](https://www.bitcoinabc.org/doc/dev/validation_8cpp.html#a925a33e7952a157922b0bbb8dab29a20)
: Parallel script validation threads for transactions in blocks.
diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp
--- a/src/bitcoin-chainstate.cpp
+++ b/src/bitcoin-chainstate.cpp
@@ -317,8 +317,8 @@
// Without this precise shutdown sequence, there will be a lot of nullptr
// dereferencing and UB.
scheduler.stop();
- if (chainman.m_load_block.joinable()) {
- chainman.m_load_block.join();
+ if (chainman.m_thread_load.joinable()) {
+ chainman.m_thread_load.join();
}
StopScriptCheckWorkerThreads();
diff --git a/src/init.cpp b/src/init.cpp
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -125,12 +125,12 @@
using node::DEFAULT_PERSIST_MEMPOOL;
using node::fReindex;
using node::g_indexes_ready_to_sync;
+using node::ImportBlocks;
using node::KernelNotifications;
using node::LoadChainstate;
using node::MempoolPath;
using node::NodeContext;
using node::ShouldPersistMempool;
-using node::ThreadImport;
using node::VerifyLoadedChainstate;
static const bool DEFAULT_PROXYRANDOMIZE = true;
@@ -276,8 +276,8 @@
if (node.scheduler) {
node.scheduler->stop();
}
- if (node.chainman && node.chainman->m_load_block.joinable()) {
- node.chainman->m_load_block.join();
+ if (node.chainman && node.chainman->m_thread_load.joinable()) {
+ node.chainman->m_thread_load.join();
}
StopScriptCheckWorkerThreads();
@@ -2635,7 +2635,7 @@
// Step 8: load indexers
// If reindex-chainstate was specified, delay syncing indexes until
- // ThreadImport has reindexed the chain
+ // ImportBlocks has reindexed the chain
if (!fReindexChainState) {
g_indexes_ready_to_sync = true;
}
@@ -2757,10 +2757,10 @@
}
avalanche::Processor *const avalanche = node.avalanche.get();
- chainman.m_load_block =
- std::thread(&util::TraceThread, "loadblk", [=, &chainman, &args] {
+ chainman.m_thread_load =
+ std::thread(&util::TraceThread, "initload", [=, &chainman, &args] {
// Import blocks
- ThreadImport(chainman, avalanche, vImportFiles);
+ ImportBlocks(chainman, avalanche, vImportFiles);
// Load mempool from disk
chainman.ActiveChainstate().LoadMempool(
ShouldPersistMempool(args) ? MempoolPath(args) : fs::path{});
@@ -2770,7 +2770,7 @@
{
WAIT_LOCK(g_genesis_wait_mutex, lock);
// We previously could hang here if StartShutdown() is called prior to
- // ThreadImport getting started, so instead we just wait on a timer to
+ // ImportBlocks getting started, so instead we just wait on a timer to
// check ShutdownRequested() regularly.
while (!fHaveGenesis && !ShutdownRequested()) {
g_genesis_wait_cv.wait_for(lock, std::chrono::milliseconds(500));
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -309,7 +309,7 @@
void CleanupBlockRevFiles() const;
};
-void ThreadImport(ChainstateManager &chainman,
+void ImportBlocks(ChainstateManager &chainman,
avalanche::Processor *const avalanche,
std::vector<fs::path> vImportFiles);
} // namespace node
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -916,7 +916,7 @@
}
};
-void ThreadImport(ChainstateManager &chainman,
+void ImportBlocks(ChainstateManager &chainman,
avalanche::Processor *const avalanche,
std::vector<fs::path> vImportFiles) {
ScheduleBatchPriority();
diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp
--- a/src/node/chainstate.cpp
+++ b/src/node/chainstate.cpp
@@ -86,7 +86,7 @@
// At this point blocktree args are consistent with what's on disk.
// If we're not mid-reindex (based on disk + args), add a genesis
// block on disk (otherwise we use the one already on disk). This is
- // called again in ThreadImport after the reindex completes.
+ // called again in ImportBlocks after the reindex completes.
if (!fReindex && !chainman.ActiveChainstate().LoadGenesisBlock()) {
return {ChainstateLoadStatus::FAILURE,
_("Error initializing block database")};
diff --git a/src/validation.h b/src/validation.h
--- a/src/validation.h
+++ b/src/validation.h
@@ -1267,7 +1267,7 @@
}
const Options m_options;
- std::thread m_load_block;
+ std::thread m_thread_load;
//! A single BlockManager instance is shared across each constructed
//! chainstate to avoid duplicating block metadata.
node::BlockManager m_blockman;
diff --git a/test/functional/feature_init.py b/test/functional/feature_init.py
--- a/test/functional/feature_init.py
+++ b/test/functional/feature_init.py
@@ -60,7 +60,7 @@
b"init message: Starting network threads",
b"net thread start",
b"addcon thread start",
- b"loadblk thread start",
+ b"initload thread start",
b"txindex thread start",
b"block filter index thread start",
b"coinstatsindex thread start",
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -390,7 +390,7 @@
# Wait for the node to finish reindex, block import, and
# loading the mempool. Usually importing happens fast or
# even "immediate" when the node is started. However, there
- # is no guarantee and sometimes ThreadImport might finish
+ # is no guarantee and sometimes ImportBlocks might finish
# later. This is going to cause intermittent test failures,
# because generally the tests assume the node is fully
# ready after being started.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:52 (4 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866097
Default Alt Text
D17745.id52912.diff (6 KB)
Attached To
D17745: rename 'loadblk' thread name to 'initload'
Event Timeline
Log In to Comment