Skip to content

adapter,storage: fix replacement collection_metadata leak#36172

Merged
teskje merged 1 commit intoMaterializeInc:mainfrom
teskje:fix-collection_metadata-leak
Apr 21, 2026
Merged

adapter,storage: fix replacement collection_metadata leak#36172
teskje merged 1 commit intoMaterializeInc:mainfrom
teskje:fix-collection_metadata-leak

Conversation

@teskje
Copy link
Copy Markdown
Contributor

@teskje teskje commented Apr 21, 2026

This commit fixes a leak of storage collection_metadata entries when dropping replacement MVs without applying them. The previous code intentionally avoided adding the IDs of dropped replacements to storage_collections_to_drop, to avoid finalizing the shard, but causing the leak in doing so. The solution implemented here is to make prepare_state smarter and only finalize the shard if the dropped collection is a primary.

Motivation

Fixes https://github.com/MaterializeInc/database-issues/issues/11322

This commit fixes a leak of storage `collection_metadata` entries when
dropping replacement MVs without applying them. The previous code
intentionally avoided adding the IDs of dropped replacements to
`storage_collections_to_drop`, to avoid finalizing the shard, but
causing the leak in doing so. The solution implemented here is to make
`prepare_state` smarter and only finalize the shard if the dropped
collection is a primary.
@teskje teskje marked this pull request as ready for review April 21, 2026 10:22
@teskje teskje requested review from a team as code owners April 21, 2026 10:22
@teskje teskje requested a review from mtabebe April 21, 2026 10:22
Comment thread test/cluster/mzcompose.py
assert not upper_empty


def workflow_github_11322(c: Composition) -> None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the repro

@teskje teskje merged commit 2bbb5eb into MaterializeInc:main Apr 21, 2026
340 checks passed
@teskje
Copy link
Copy Markdown
Contributor Author

teskje commented Apr 21, 2026

TFTR!

@teskje teskje deleted the fix-collection_metadata-leak branch April 21, 2026 16:07
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.

2 participants