Page MenuHomePhabricator

rest: reduce LOCK(cs_main) scope in rest_block
ClosedPublic

Authored by PiRK on Jan 24 2023, 16:32.

Details

Reviewers
sdulfari
Group Reviewers
Restricted Project
Commits
rABCae8564750efc: rest: reduce LOCK(cs_main) scope in rest_block
Summary

After commit ccd8ef6 (D2979) it is no longer required to hold cs_main when calling ReadBlockFromDisk.

The first commit moves ReadBlockFromDisk outside the lock scope in rest_block, where we can see a huge performance improvement when fetching blocks with multiple threads.

This is a partial backport of core#26308
https://github.com/bitcoin/bitcoin/pull/26308/commits/c75e3d2772b00acc3850f72a8cb733a0345aa773

Test Plan

With Clang and DEBUG:
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jan 24 2023, 16:32
sdulfari added a subscriber: sdulfari.

reference to prerequisite backport that reduced the cs_main locking: https://reviews.bitcoinabc.org/D2979#change-8J68DPC7df8b

This revision is now accepted and ready to land.Jan 24 2023, 18:15