Skip to content

Bug: dropping a namespace should also drop its topics #310

@jamals86

Description

@jamals86

Bug

When a namespace is dropped, topics that belong to that namespace are currently not dropped as well.

Expected behavior

Dropping a namespace should also remove all topics owned by that namespace.

Example expectation:

CREATE NAMESPACE app;
CREATE TOPIC app.user_events;
DROP NAMESPACE app;

After DROP NAMESPACE app, app.user_events should no longer exist and should not be visible/listable/usable.

Current behavior

The namespace is dropped, but its topics remain behind.

Why this matters

Leaving namespace-owned topics behind can create orphaned metadata/state and confusing behavior later, for example:

  • listing topics may show topics for a namespace that no longer exists
  • recreating the namespace may collide with old topic names
  • consumers/sources may still point to deleted namespace-owned resources
  • storage/manifest cleanup may be incomplete

Suggested fix

When handling DROP NAMESPACE, cascade cleanup should include all namespace-scoped topics.

Implementation should likely cover:

  • metadata removal for topics under the namespace
  • topic storage cleanup if applicable
  • topic sources/consumers cleanup if they are namespace-scoped
  • tests verifying DROP NAMESPACE removes related topics

Test case to add

  1. Create a namespace.
  2. Create one or more topics under it.
  3. Drop the namespace.
  4. Assert the topics no longer exist.
  5. Assert recreating the namespace/topic does not hit stale metadata from the previous topic.

Note

This should behave similarly to dropping a schema/namespace with owned child objects: namespace-owned topics should not survive after their parent namespace is removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions