Skip to content

Add unit test that Subspace::range() owns its key memory - #14336

Merged
akshay-v-kaushik merged 1 commit into
apple:mainfrom
akshay-v-kaushik:SubspaceRangeArenaTest
Oct 22, 2026
Merged

akshay-v-kaushik merged 1 commit into
apple:mainfrom
akshay-v-kaushik:SubspaceRangeArenaTest

Conversation

@akshay-v-kaushik

Copy link
Copy Markdown
Contributor

Problem: Subspace::range() in fdbclient/Subspace.cpp had a FIXME: "test that this uses the keyRange arena and doesn't create another one". The returned KeyRange points at its begin/end bytes. Those bytes must live in the range's own arena. If they lived in another arena, freed when range() returns, the range would dangle.

Fix: The code already allocates from keyRange.arena(), so no behavior change. The fix is to add a test that locks this in, and remove the FIXME.

Problem: Subspace::range() in fdbclient/Subspace.cpp had a FIXME: "test that this uses the keyRange arena and doesn't create another one". The returned KeyRange points at its begin/end bytes. Those bytes must live in the range's own arena. If they lived in another arena, freed when range() returns, the range would dangle.

Fix: The code already allocates from keyRange.arena(), so no behavior change. The fix is to add a test that locks this in, and remove the FIXME.

The testing

New test: /fdbclient/Subspace/rangeOwnsMemory. It calls range(), destroys the Subspace, then checks that begin and end have the right bytes and that the range's arena holds them.
image

Failure scenario tested: I temporarily made range() allocate from a local Arena instead of keyRange.arena(). The test failed, so it catches the bug. The mutation was then reverted.

image

Resolves the FIXME in Subspace::range(): verify the returned KeyRange
remains valid after the Subspace that produced it is destroyed.
@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@saintstack saintstack closed this Oct 21, 2026
@saintstack saintstack reopened this Oct 21, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux RHEL 9

  • Commit ID: 9559ecf
  • Duration 0:21:36
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: 9559ecf
  • Duration 0:34:46
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 9559ecf
  • Duration 0:44:04
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: 9559ecf
  • Duration 0:49:36
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 9559ecf
  • Duration 0:56:58
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: 9559ecf
  • Duration 0:57:27
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 9559ecf
  • Duration 1:41:24
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@akshay-v-kaushik
akshay-v-kaushik merged commit 58e47db into apple:main Oct 22, 2026
13 checks passed
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