Skip to content

Test infrastructure fixes and revise InitialIOSize#1849

Merged
badrishc merged 7 commits into
mainfrom
tedhar/test-fixes
Jun 3, 2026
Merged

Test infrastructure fixes and revise InitialIOSize#1849
badrishc merged 7 commits into
mainfrom
tedhar/test-fixes

Conversation

@TedHartMS
Copy link
Copy Markdown
Contributor

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:

  • Changed the InitialIOSize in IStreamBuffer from 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.
  • Updated the logic in AsyncGetFromDiskCallback to accurately set available_bytes by subtracting valid_offset from the number of bytes read, and added assertions to ensure correct buffer handling and record validity.

Test infrastructure improvements:

  • Added new port assignments to the ClusterPortAssignment enum for ClusterReplicationRangeIndex and ClusterMultiLogDiskless to support additional test cluster configurations.
  • Introduced TestProjectSetup classes in Garnet.test.cluster.multilog.diskless and Garnet.test.cluster.replication.rangeindex to set appropriate ports for those test projects during setup. [1] [2]
  • Improved the TearDown method in ClusterTestContext to 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.

TedHartMS added 2 commits June 2, 2026 17:05
…on TBD) and setting of available_bytes in AsyncGFDCallback
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 refine available_bytes handling in AsyncGetFromDiskCallback.
  • 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.

Comment thread libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorBase.cs Outdated
Comment thread libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorBase.cs Outdated
Comment thread libs/storage/Tsavorite/cs/src/core/Allocator/ObjectSerialization/IStreamBuffer.cs Outdated
TedHartMS and others added 3 commits June 2, 2026 17:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@badrishc badrishc merged commit 7ba5cab into main Jun 3, 2026
382 of 383 checks passed
@badrishc badrishc deleted the tedhar/test-fixes branch June 3, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants