From 983b4084975e0c9001e886a98a93b3b55a8f585a Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Thu, 5 Dec 2024 19:03:47 +0000 Subject: [PATCH] Remove resolved Windows workaround (#7872) --- .../Nethermind.Blockchain/BlockTree.cs | 32 +++---------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/src/Nethermind/Nethermind.Blockchain/BlockTree.cs b/src/Nethermind/Nethermind.Blockchain/BlockTree.cs index e9d685a5df3..a663b2d85e0 100644 --- a/src/Nethermind/Nethermind.Blockchain/BlockTree.cs +++ b/src/Nethermind/Nethermind.Blockchain/BlockTree.cs @@ -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) @@ -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)