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

Remove resolved Windows workaround #7872

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions src/Nethermind/Nethermind.Blockchain/BlockTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,6 @@ private bool ShouldCache(long number)
public Hash256? FinalizedHash { get; private set; }
public Hash256? SafeHash { get; private set; }

private readonly McsLock _allocatorLock = new();

public Block? FindBlock(Hash256? blockHash, BlockTreeLookupOptions options, long? blockNumber = null)
{
if (blockHash is null || blockHash == Keccak.Zero)
Expand All @@ -1239,31 +1237,11 @@ private bool ShouldCache(long number)
blockNumber ??= _headerStore.GetBlockNumber(blockHash);
if (blockNumber is not null)
{
if (OperatingSystem.IsWindows())
{
// Although thread-safe, because the blocks are so large it
// causes a lot of contention on the allocator used inside RocksDb
// on Windows; which then impacts block processing heavily. We
// take the lock here instead to reduce contention on the allocator
// in the db; so the contention is in this method rather than
// across the whole database.
// A better solution would be to change the allocator https://github.com/NethermindEth/nethermind/issues/6107
using var handle = _allocatorLock.Acquire();

block = _blockStore.Get(
blockNumber.Value,
blockHash,
(options & BlockTreeLookupOptions.ExcludeTxHashes) != 0 ? RlpBehaviors.ExcludeHashes : RlpBehaviors.None,
shouldCache: false);
}
else
{
block = _blockStore.Get(
blockNumber.Value,
blockHash,
(options & BlockTreeLookupOptions.ExcludeTxHashes) != 0 ? RlpBehaviors.ExcludeHashes : RlpBehaviors.None,
shouldCache: false);
}
block = _blockStore.Get(
blockNumber.Value,
blockHash,
(options & BlockTreeLookupOptions.ExcludeTxHashes) != 0 ? RlpBehaviors.ExcludeHashes : RlpBehaviors.None,
shouldCache: false);
}

if (block is null)
Expand Down
Loading