fix: Handle CDC race condition when vertex deleted before event processed - #17
Merged
pallakartheekreddy merged 1 commit intoMay 26, 2026
Conversation
…ssed For UPDATE events, read derived fields (objectType, nodeUniqueId, channel, etc.) from transaction log (propertiesMap) first, falling back to vertex state. Prevents garbage "vertex" events when image node is deleted by publish job before CDC processes the updateProcessingNode transaction. Also filters events with objectType="vertex" (no IL_FUNC_OBJECT_TYPE set) to prevent downstream transaction processor crashes on missing schema.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pallakartheekreddy
approved these changes
May 25, 2026
pallakartheekreddy
approved these changes
May 25, 2026
pallakartheekreddy
approved these changes
May 26, 2026
pallakartheekreddy
merged commit May 26, 2026
67a923f
into
Sunbird-Knowlg:develop
1 of 2 checks passed
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
Fixes a CDC race condition during the second publish cycle where
updateProcessingNodetransaction events are processed after the image node (.img) has been deleted by a subsequentdeleteNodetransaction.Problem
During publish, two transactions execute in quick succession on the image node:
updateProcessingNode— writes statusReview → Processing(full property rewrite)deleteNode— removes the.imgvertex entirelyCDC processes transaction log entries asynchronously. When it processes the
updateProcessingNodeevent after the vertex is already deleted:vertex.properties()returns defaults (vertex gone)vertex.label()returns"vertex"(TinkerPop default)vertex.id().toString()returns internal graph ID (e.g."1024004192") instead ofdo_xxx.imgThis produces garbage events with
objectType: "vertex"and numericnodeUniqueId, causing the downstream transaction-event-processor to crash with:Fix
For UPDATE events, derived fields (
objectType,nodeUniqueId,channel,nodeType,label,userId) are now read frompropertiesMap(transaction log data) first, falling back to vertex state only if not present in the transaction.propertiesMapis built fromChangeState(immutable transaction log) — always accurate regardless of current vertex stategetFromPropertiesOrVertex()helper and refactoredgetLabelFromPropertiesOrVertex()/getUserIdFromPropertiesOrVertex()to reuse itLABEL_KEYSandUSER_ID_KEYSas static constantsSafety net: Events with
objectType="vertex"(noIL_FUNC_OBJECT_TYPEset) are filtered out and returnnull— CDC skips them entirely.Event flow (before vs after fix)
Type of change
How Has This Been Tested?
objectTypeandnodeUniqueIdfor image node transactionsvertexschema errorChecklist: