-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Context
When a document is deleted on a MongoDB Collection 2 messages will appear:
- First being a delete operation as in the oplog
SourceRecord{sourcePartition={rs=rs0, server_id=mongo}, sourceOffset={sec=1542546121, ord=3, h=8008529886791156268}} ConnectRecord{topic='mongo.transform.source', kafkaPartition=null, key=Struct{id=1}, value=Struct{source=Struct{version=0.9.0-SNAPSHOT,connector=mongodb,name=mongo,rs=rs0,ns=transform.source,sec=1542546121,ord=3,h=8008529886791156268},op=d,ts_ms=1542546121897}, timestamp=null, headers=ConnectHeaders(headers=)}
- Second a Tombstone message which value is null
SourceRecord{sourcePartition={rs=rs0, server_id=mongo}, sourceOffset={sec=1542546121, ord=3, h=8008529886791156268}} ConnectRecord{topic='mongo.transform.source', kafkaPartition=null, key=Struct{id=1}, value=null, timestamp=null, headers=ConnectHeaders(headers=)}
How to reproduce
In a connector with UnwrapFromMongoDbEnvelope enabled, delete a document within the collection.
The result is as follows:
java.lang.NullPointerException at io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelope.apply(UnwrapFromMongoDbEnvelope.java:125) at io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelopeTestIT.shouldTransformEvents(UnwrapFromMongoDbEnvelopeTestIT.java:148)
Reason
It happens because the Tombstone message has no value nor valueSchema, this part of the transformer UnwrapFromMongoDbEnvelopeTestIT.java:148 depends on the valueSchema to exist which isn't true for the tombstone
- is related to
-
DBZ-563 Add option for dropping deletes and tombstone events to MongoDB struct recreation SMT
- Closed