[Fix] MongoDB CDC: handle null fullDocument in transaction to prevent NullNode exception (#9332) - #9336
Open
zhang-arvin wants to merge 1 commit into
Open
Conversation
Contributor
|
When |
zhang-arvin
force-pushed
the
fix/mongodb-cdc-nullnode-9332
branch
from
August 24, 2026 04:07
0f0e9a1 to
9e722c7
Compare
Contributor
Author
|
Thanks for the review @JingsongLi! Fixed: when fullDocument is null, getExtractRow now returns null instead of an empty map. The operation layer (processRecord) returns null for null records, and handleOperation skips null INSERT records while still emitting the DELETE. This prevents writing records with null primary keys or all-NULL fields. PTAL. |
zhang-arvin
force-pushed
the
fix/mongodb-cdc-nullnode-9332
branch
from
August 24, 2026 05:11
9e722c7 to
6593f33
Compare
… NullNode exception (apache#9332) When MongoDB processes a transaction with simultaneous update and delete operations, the Debezium CDC event may contain a null fullDocument for the update operation. Previously, getExtractRow() would call jsonNode.asText() on a NullNode, which returns the string "null", causing JsonSerdeUtil.asSpecificNodeType() to throw IllegalArgumentException because "null" parses to NullNode, not ObjectNode. This fix adds a null check at the beginning of getExtractRow() to gracefully handle null or NullNode jsonNode by returning an empty map.
zhang-arvin
force-pushed
the
fix/mongodb-cdc-nullnode-9332
branch
from
August 24, 2026 05:21
6593f33 to
0d1b187
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.
What changes were proposed in this pull request?
Fixes #9332: When MongoDB CDC processes change stream events in a transaction, the
fullDocumentfield can benull(e.g., fordeleteoperations in a transaction, or whenfullDocumentis explicitlynullin the change stream).Prior to this fix,
getExtractRow()would callfullDocument.get(...)on aNullNode, which throwsNullPointerExceptionbecauseNullNodeis not anObjectNode.How was this patch tested?
fullDocumentDoes this pull request potentially affect one of the following parts?
Documentation