Suppress TABLE_DELETE event when deleting a non-existent table#692
Open
ursetta-netflix wants to merge 1 commit intomasterfrom
Open
Suppress TABLE_DELETE event when deleting a non-existent table#692ursetta-netflix wants to merge 1 commit intomasterfrom
ursetta-netflix wants to merge 1 commit intomasterfrom
Conversation
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>
582ad5b to
0ac6f9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
deleteAndReturn()is called on a table that does not exist in the connector, Metacat was emitting aTABLE_DELETEevent with only the table name and no UUID or metadata. This caused issues for downstream consumers (e.g. DSI'sdpprojectservice) that rely on UUID from events.get()callMetacatDeleteTablePostEventemission when the table does not existget()throws a non-NotFoundException(e.g.InvalidMetadataException), assume the table exists so the event is still emittedNotes
MetacatDeleteTablePreEventis 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.get()throws a non-NotFoundException, the event is emitted with a skeletonTableDto(name only, no UUID/metadata) sinceget()failed before returning a result. This matches the previous behavior.Test plan
testDeleteAndReturn_nonExistentTable— verifies that deleting a non-existent table does not emitMetacatDeleteTablePostEventbut still runs metadata cleanuptestDeleteAndReturncases continue to pass (tag validation, metadata delete, soft delete, etc.)