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

refactor: move load block thread into ChainstateManager #21030

Closed

Conversation

fanquake
Copy link
Member

This is a diff of Marcos from #19197, which probably should have just
been used at the time. After this change, and #21016, we'll have no more
global thread(Group)s hanging out in init.

Co-authored-by: MarcoFalke falke.marco@gmail.com

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 29, 2021

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

Conflicts

No conflicts as of last run.

This is a diff of Marcos from bitcoin#19197, which probably should have just
been used at the time. After this change, and bitcoin#21016, we'll have no more
global thread(Group)s hanging out in init.

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
@fanquake fanquake force-pushed the revive_marco_val_loadblock_thread branch from be70656 to e3341df Compare February 2, 2021 01:22
@laanwj
Copy link
Member

laanwj commented Feb 2, 2021

Concept ACK.

@dongcarl Does moving block loading into the chainstate manager align with your goals ?

Edit: I personally think it should be factored out, but not necessarily to validation.cpp/h, we might want a separate "block storage handling" component where ThreadImport and such can move.

@maflcko
Copy link
Member

maflcko commented Feb 2, 2021

review ACK e3341df

This is removing a "validation/blockimport" global from init.cpp. Happy to re-ACK if this is moved to a separate module as suggested by @laanwj

@dongcarl
Copy link
Contributor

@dongcarl Does moving block loading into the chainstate manager align with your goals ?

I believe so. After a cursory look at this PR, I think the std::thread m_load_block would probably eventually be moved into the ChainContext struct I plan to introduce after g_chainman is deglobalized, however, putting it in ChainstateManager is the appropriate move for now!

@fanquake fanquake closed this Mar 31, 2021
@maflcko
Copy link
Member

maflcko commented Apr 2, 2021

Done in #21575

fanquake added a commit that referenced this pull request Apr 13, 2021
fadcd3f doc: Remove irrelevant link to GitHub (MarcoFalke)
fa121b6 blockstorage: [refactor] Use chainman reference where possible (MarcoFalke)
fa0c7d9 move-only: Move *Disk functions to blockstorage (MarcoFalke)
fa91b2b move-only: Move AbortNode to shutdown (MarcoFalke)
fa413f0 move-only: Move ThreadImport to blockstorage (MarcoFalke)
faf843c refactor: Move load block thread into ChainstateManager (MarcoFalke)

Pull request description:

  This picks up the closed pull request #21030 and is the first step toward fixing #21220.

  The basic idea is to move all disk access into a separate module with benefits:
  * Breaking down the massive files init.cpp and validation.cpp into logical units
  * Creating a standalone-module to reduce the mental complexity
  * Pave the way to fix validation related circular dependencies
  * Pave the way to mock disk access for testing, especially where it is performance critical (like fuzzing)

ACKs for top commit:
  promag:
    Code review ACK fadcd3f, checked (almost) moved only changes. This is a nice tidy up change and doesn't change behavior. Easily reviewed commit by commit.
  jamesob:
    ACK fadcd3f ([`jamesob/ackr/21575.1.MarcoFalke.refactor_create_blocksto`](https://github.com/jamesob/bitcoin/tree/ackr/21575.1.MarcoFalke.refactor_create_blocksto))
  ryanofsky:
    Code review ACK fadcd3f. New organization makes sense, moves extraneous things outside of validation.cpp. PR is also easy to review with helpfully split up moveonly commits.

Tree-SHA512: 917996592b6d8f9998289d8cb2b1b78b23d1fdb3b07216c9caec1380df33baa09dc2c1e706da669d440b497e79c9c62a01ca20dc202df5ad974a75f3ef7a143b
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
@fanquake fanquake deleted the revive_marco_val_loadblock_thread branch November 9, 2022 16:31
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.

5 participants