Skip to content

Commit

Permalink
Remove resolved Windows workaround (#7872)
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored Dec 5, 2024
1 parent 8f2d509 commit 983b408
Showing 1 changed file with 5 additions and 27 deletions.
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

0 comments on commit 983b408

Please sign in to comment.