Skip to content

Suppress TABLE_DELETE event when deleting a non-existent table#692

Open
ursetta-netflix wants to merge 1 commit intomasterfrom
suppress-delete-event-nonexistent-table
Open

Suppress TABLE_DELETE event when deleting a non-existent table#692
ursetta-netflix wants to merge 1 commit intomasterfrom
suppress-delete-event-nonexistent-table

Conversation

@ursetta-netflix
Copy link
Copy Markdown
Collaborator

@ursetta-netflix ursetta-netflix commented Mar 26, 2026

Summary

When deleteAndReturn() is called on a table that does not exist in the connector, Metacat was emitting a TABLE_DELETE event with only the table name and no UUID or metadata. This caused issues for downstream consumers (e.g. DSI's dpprojectservice) that rely on UUID from events.

  • Track whether the table was found via the existing get() call
  • Skip only the MetacatDeleteTablePostEvent emission when the table does not exist
  • All other logic (tag/parent-child validation, metadata cleanup, connector delete) remains unconditional to prevent orphaned metacat metadata
  • If get() throws a non-NotFoundException (e.g. InvalidMetadataException), assume the table exists so the event is still emitted

Notes

  • The MetacatDeleteTablePreEvent is still emitted unconditionally before we know whether the table exists. Downstream consumers that correlate pre/post event pairs may see orphaned pre-events. This could be addressed in a follow-up.
  • In the catch path where get() throws a non-NotFoundException, the event is emitted with a skeleton TableDto (name only, no UUID/metadata) since get() failed before returning a result. This matches the previous behavior.

Test plan

  • Added testDeleteAndReturn_nonExistentTable — verifies that deleting a non-existent table does not emit MetacatDeleteTablePostEvent but still runs metadata cleanup
  • Existing testDeleteAndReturn cases continue to pass (tag validation, metadata delete, soft delete, etc.)

When a delete is called on a table that does not exist, Metacat was
emitting a TABLE_DELETE event with only the table name and no UUID or
metadata. This caused issues for downstream consumers (e.g. DSI's
dpprojectservice) that rely on UUID from events.

Now, deleteAndReturn() tracks whether the table was found via the
existing get() call and skips post-delete event emission when the table
does not exist. All other logic (tag/parent-child validation, metadata
cleanup, connector delete) remains unconditional to prevent orphaned
metacat metadata. If get() throws a non-NotFoundException (e.g.
InvalidMetadataException), we assume the table exists so the event is
still emitted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ursetta-netflix ursetta-netflix force-pushed the suppress-delete-event-nonexistent-table branch from 582ad5b to 0ac6f9a Compare April 7, 2026 16:08
@ursetta-netflix ursetta-netflix marked this pull request as ready for review April 7, 2026 16:33
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