issue-1751: [Filestore] WriteBackCache: Replace ReadWriteRangeLock with pinning mechanism, move remaining code to TUtils#5297
issue-1751: [Filestore] WriteBackCache: Replace ReadWriteRangeLock with pinning mechanism, move remaining code to TUtils#5297
Conversation
|
Note This is an automated comment that will be appended during run. 🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 224s): all tests PASSED for commit eab0cbf.
🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 241s): all tests PASSED for commit eab0cbf.
🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1538s): all tests PASSED for commit eab0cbf.
🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4740s): all tests PASSED for commit eab0cbf.
|
…th pinning mechanism, move remaining code to TUtils
eab0cbf to
9647acd
Compare
|
|
||
| // Prevent from concurrent read and write requests with overlapping ranges | ||
| TReadWriteRangeLock RangeLock; | ||
| // Prevents flushed requests from being evicted from Cache |
There was a problem hiding this comment.
Let’s emphasize why this logic is needed
There was a problem hiding this comment.
Added more info about why this is needed
| IFileStorePtr session, | ||
| ISchedulerPtr scheduler, | ||
| ITimerPtr timer, | ||
| IWriteBackCacheStatsPtr stats, | ||
| TLog log, | ||
| const TString& fileSystemId, | ||
| const TString& clientId, | ||
| const TString& filePath, | ||
| ui64 capacityBytes, | ||
| TDuration automaticFlushPeriod, | ||
| TDuration flushRetryPeriod, | ||
| ui32 maxWriteRequestSize, | ||
| ui32 maxWriteRequestsCount, | ||
| ui32 maxSumWriteRequestsSize, | ||
| bool zeroCopyWriteEnabled) |
There was a problem hiding this comment.
Reverted (I will replace it with DTO in the future)
| auto& nodeState = Nodes.GetOrCreateNodeState(nodeId); | ||
|
|
||
| auto it = nodeState.CachedDataPins.find(pinId); | ||
| Y_ENSURE( |
There was a problem hiding this comment.
Let's use Y_ABORT_UNLESS
|
|
||
| // Prevent unflushed requests from being evicted after flush | ||
| const ui64 sequenceId = | ||
| nodeState.Cache.GetMinPendingOrUnflushedSequenceId(0); |
There was a problem hiding this comment.
Removed the default value and changed logic a bit.
Now all Get...SequenceId methods act the same.
| UNIT_ASSERT_VALUES_EQUAL("", b.VisitUnflushedCachedRequests(1)); | ||
| } | ||
|
|
||
| Y_UNIT_TEST(PinCachedData) |
There was a problem hiding this comment.
let's add a test with multiple pins per 1 sequence id
There was a problem hiding this comment.
This scenario is already covered by the test
Added more comments inside
| { | ||
| auto guard = Guard(QueuedOperations); | ||
|
|
||
| auto& nodeState = Nodes.GetOrCreateNodeState(nodeId); |
There was a problem hiding this comment.
GetNodeState? and check that exist?
Part of #5064
Replace TReadWriteRangeLock with pinning mechanism. Instead of blocking at overlapping read and write operations, the reader now sets a pin that prevents cached data from being evicted from cache. This makes possible to:
Additionally, some helper functions were moved to
TUtils.