Test infrastructure fixes and revise InitialIOSize#1849
Merged
Conversation
… TearDown() calls clusterUtils.Dispose()
…on TBD) and setting of available_bytes in AsyncGFDCallback
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tunes Tsavorite’s pending disk-read path for small records (by reducing the initial speculative read size and refining buffer bookkeeping) and strengthens cluster test infrastructure to reduce port conflicts and teardown-related cascade failures.
Changes:
- Adjust Tsavorite speculative pending-read sizing (
InitialIOSize) and refineavailable_byteshandling inAsyncGetFromDiskCallback. - Expand cluster test port assignments and add per-test-project
[SetUpFixture]initialization to select the correct base port. - Make cluster test teardown more robust by isolating disposal steps so failures don’t prevent node cleanup.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/cluster/Garnet.test.cluster/ClusterTestContext.cs | Adds new port assignments and hardens TearDown() disposal sequencing to avoid leaked nodes/ports. |
| test/cluster/Garnet.test.cluster.replication.rangeindex/TestProjectSetup.cs | Adds project-level setup to set a unique base port for the range-index replication test project. |
| test/cluster/Garnet.test.cluster.multilog.diskless/TestProjectSetup.cs | Adds project-level setup to set a unique base port for the multilog diskless test project. |
| libs/storage/Tsavorite/cs/src/core/Allocator/ObjectSerialization/IStreamBuffer.cs | Changes InitialIOSize to a fixed 128B and documents the rationale. |
| libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorBase.cs | Updates AsyncGetFromDiskCallback to compute available_bytes relative to valid_offset and adds buffer validity assertions. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
badrishc
approved these changes
Jun 3, 2026
badrishc
approved these changes
Jun 3, 2026
vazois
approved these changes
Jun 3, 2026
badrishc
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improvements to disk IO efficiency for small records in the Tsavorite storage engine and enhances the robustness and flexibility of the test cluster infrastructure. The most significant changes include optimizing the initial IO read size to reduce device latency, improving buffer handling logic, and expanding the test cluster setup with new port assignments and project-specific initialization.
Disk IO optimization and buffer handling:
InitialIOSizeinIStreamBufferfrom using the OS system page size to a fixed 128 bytes, with detailed commentary explaining that this reduces device latency for small records by aligning reads to sector boundaries and avoiding unnecessary NAND page crossings.AsyncGetFromDiskCallbackto accurately setavailable_bytesby subtractingvalid_offsetfrom the number of bytes read, and added assertions to ensure correct buffer handling and record validity.Test infrastructure improvements:
ClusterPortAssignmentenum forClusterReplicationRangeIndexandClusterMultiLogDisklessto support additional test cluster configurations.TestProjectSetupclasses inGarnet.test.cluster.multilog.disklessandGarnet.test.cluster.replication.rangeindexto set appropriate ports for those test projects during setup. [1] [2]TearDownmethod inClusterTestContextto individually dispose of resources (cancellation token, waiter, cluster utilities), ensuring that exceptions during disposal do not prevent cluster nodes from being cleaned up, thus avoiding resource leaks and test cascade failures.