Skip to content

sql-150: Create test suite for durable temporary objects - #38159

Open
SangJunBak wants to merge 3 commits into
jun/move-temp-to-catalog-split-2from
jun/move-temp-to-catalog-split-3
Open

sql-150: Create test suite for durable temporary objects#38159
SangJunBak wants to merge 3 commits into
jun/move-temp-to-catalog-split-2from
jun/move-temp-to-catalog-split-3

Conversation

@SangJunBak

Copy link
Copy Markdown
Contributor

Creates a more in-depth test suite for implementation, included unit tests at the persist level and e2e tests at the mzcompose level to replicate killing a process

Motivation

sql-150

Description

catalog: test ephemeral item reclamation in the durable layer

Temporary items are durable items tagged with the UUID of the session that created them. Neither of the two mechanisms holding that together had any coverage.

  • read-write: name uniqueness is scoped by the owning session, so two sessions can each hold a tt in the sentinel temporary schema while one session cannot hold it twice. remove_ephemeral_items then reclaims all of them and leaves normal items alone, which matters because an over-broad filter there would silently delete real user items.
  • open: a writable open reclaims a temporary item left behind by a process that died without closing its session, which is the only thing between a kill -9 and a permanently leaked catalog item. A read-only open must not, since a zero-downtime follower reads the leader's catalog while the leader's sessions are still live and still own theirs. The read-only case is checked before the writable one, so the ordering makes both directions observable.

test: cover temporary item cleanup on session close and kill -9

Temporary tables and views are durable catalog items tagged with their owning session, so they need cleanup on both paths out of a session, and neither path had a test. The only existing temp-teardown coverage is DISCARD TEMP / DISCARD ALL, which is a different code path.

test: cover 0dt preflight behavior for temporary items

Ensure creating temporary items during a 0dt upgrade doesn't cause a halt. This is already the case because even though these temporary objects are public to all envds, we clear them from the snapshot whenever we open the catalog not in readonly mode.

Temporary items are durable items tagged with the UUID of the session
that created them. Neither of the two mechanisms holding that together
had any coverage.

read-write: name uniqueness is scoped by the owning session, so two
sessions can each hold a 'tt' in the sentinel temporary schema while one
session cannot hold it twice. remove_ephemeral_items then reclaims all of
them and leaves normal items alone, which matters because an over-broad
filter there would silently delete real user items.

open: a writable open reclaims a temporary item left behind by a process
that died without closing its session, which is the only thing between a
kill -9 and a permanently leaked catalog item. A read-only open must not,
since a zero-downtime follower reads the leader's catalog while the
leader's sessions are still live and still own theirs. The read-only case
is checked before the writable one, so the ordering makes both directions
observable.
Temporary tables and views are durable catalog items tagged with their
owning session, so they need cleanup on both paths out of a session, and
neither path had a test. The only existing temp-teardown coverage is
DISCARD TEMP / DISCARD ALL, which is a different code path.
Ensure creating temporary items during a 0dt upgrade doesn't cause a halt. This is already the case because even though these temporary objects are public to all envds, we clear them from the snapshot whenever we open the catalog not in readonly mode.
@SangJunBak
SangJunBak requested a review from a team as a code owner August 11, 2026 14:19
@SangJunBak SangJunBak changed the title catalog: test ephemeral item reclamation in the durable layer sql-150: Create test suite for durable temporary objects Aug 11, 2026
@SangJunBak
SangJunBak requested a review from mtabebe August 11, 2026 14:20
@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

SQL-150

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.

1 participant