Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-987

UnwrapFromMongoDbEnvelope fails when encountering full updates

    XMLWordPrintable

    Details

      Description

      Issuing a statement such as the following causes the MongoDB unwrap SMT to fail:

      db.customers.update(
          { _id : NumberLong("1004") },
          { { field: "any value" } } 
      );
      

      This feature is better described here https://docs.mongodb.com/manual/reference/method/db.collection.update/#replace-a-document-entirely

      Currently we only support as in "Update Specific Fields" https://docs.mongodb.com/manual/reference/method/db.collection.update/#update-specific-fields
      Since it generates a $set key within the oplog message

      Output of the operation:

      2018-11-16 13:17:14,900 ERROR  MongoDB|mongo|conn  Unexpected error shutting down the MongoDB clients   [io.debezium.connector.mongodb.ConnectionContext]
      com.mongodb.MongoInterruptedException: Interrupted acquiring a permit to retrieve an item from the pool 
      	at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:203)
      	at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:140)
      	at com.mongodb.internal.connection.DefaultConnectionPool.getPooledConnection(DefaultConnectionPool.java:262)
      	at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:103)
      	at com.mongodb.internal.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:92)
      	at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:85)
      	at com.mongodb.internal.session.ServerSessionPool.endClosedSessions(ServerSessionPool.java:141)
      	at com.mongodb.internal.session.ServerSessionPool.close(ServerSessionPool.java:97)
      	at com.mongodb.client.internal.MongoClientDelegate.close(MongoClientDelegate.java:123)
      	at com.mongodb.Mongo.close(Mongo.java:543)
      	at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
      	at io.debezium.connector.mongodb.MongoClients.clear(MongoClients.java:92)
      	at io.debezium.connector.mongodb.ConnectionContext.shutdown(ConnectionContext.java:87)
      	at io.debezium.connector.mongodb.MongoDbConnector.stop(MongoDbConnector.java:180)
      	at io.debezium.embedded.EmbeddedEngine.run(EmbeddedEngine.java:792)
      	at io.debezium.embedded.AbstractConnectorTest.lambda$start$3(AbstractConnectorTest.java:297)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.lang.InterruptedException
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)
      	at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
      	at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:197)
      	... 18 more
      2018-11-16 13:17:14,902 INFO   MongoDB|mongo|conn  Stopped MongoDB connector   [io.debezium.connector.mongodb.MongoDbConnector]
      2018-11-16 13:17:14,903 INFO   UnwrapFromMongoDbEnvelopeTestIT||engine  Connector 'io.debezium.connector.mongodb.MongoDbConnector' completed normally.   [io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelopeTestIT]
      2018-11-16 13:17:14,905 INFO   UnwrapFromMongoDbEnvelopeTestIT||test  Closing all connections to rs0/localhost:27017   [io.debezium.connector.mongodb.ConnectionContext]
      2018-11-16 13:17:14,907 INFO   UnwrapFromMongoDbEnvelopeTestIT||test  Closed connection [connectionId{localValue:2, serverValue:12}] to localhost:27017 because the pool has been closed.   [org.mongodb.driver.connection]
      2018-11-16 13:17:14,908 INFO   UnwrapFromMongoDbEnvelopeTestIT||test  Stopping the connector   [io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelopeTestIT]
       
      org.bson.BsonInvalidOperationException: Document does not contain key $set
       
      	at org.bson.BsonDocument.throwIfKeyAbsent(BsonDocument.java:870)
      	at org.bson.BsonDocument.getDocument(BsonDocument.java:135)
      	at io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelope.apply(UnwrapFromMongoDbEnvelope.java:143)
      	at io.debezium.connector.mongodb.transforms.UnwrapFromMongoDbEnvelopeTestIT.shouldTransformEvents(UnwrapFromMongoDbEnvelopeTestIT.java:155)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                renatomefi Renato Mefi
                Reporter:
                renatomefi Renato Mefi
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: