zhangshenghang commented on PR #11065:
URL: https://github.com/apache/seatunnel/pull/11065#issuecomment-4716860039

   I traced both record paths and the core fix looks correct. Heartbeat records 
really do reach `MongoDBConnectorDeserializationSchema.deserialize` (the 
emitter routes `isDataChangeRecord || isHeartbeatEvent` into `emitElement` -> 
deserialize), and on `dev` they hit `operationTypeFor` -> 
`value.getString("operationType")`, which is exactly the `DataException` from 
the issue. The early `isHeartbeatEvent(record)` return fixes that, and placing 
it after `super.deserialize` is safe since the base only handles schema-change 
events. I also checked the `rewriteOutputBuffer` change: heartbeats are already 
filtered out by `isChangeRecordInChunkRange` -> `isDataChangeRecord`, so the 
new throw there is purely defensive and won't be hit by heartbeats. The new 
tests pass locally for me as well.
   
   A couple of things worth addressing before merge:
   
   1. The two `docs/.../source/Http.md` changes (the ` ````hocon ` -> ` 
```hocon ` fence fix) are unrelated to the MongoDB CDC heartbeat fix. The 
project keeps one PR to one problem, so I'd suggest dropping them here and 
sending a separate docs PR (or at least call them out in the description if you 
want to keep them). It's a real typo, just not part of this change.
   
   2. The missing/null `operationType` guard is now duplicated almost verbatim 
in `MongoDBConnectorDeserializationSchema.operationTypeFor` and 
`MongodbFetchTaskContext.getOperationType`. Since both build the same error 
message, it would read better as a single helper in `MongodbRecordUtils` (e.g. 
`requireOperationType(SourceRecord, Struct)`) that both call. Not blocking, 
just to avoid the two copies drifting later.
   
   Otherwise the fix and the test coverage (skip-heartbeat plus 
readable-exception cases) look good to me.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to