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

Infinite loop when using OR condition in additional-condition

XMLWordPrintable

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      debezium/debezium-connector-sqlserver:2.2.1

      What is the connector configuration?

       

      { 
        "connector.class": "io.debezium.connector.sqlserver.SqlServerConnector",
        "tasks.max": "1",
        "database.hostname": "sqlserver",
        "database.port": "1433",
        "database.user": "sa",
        "database.password": "Password!",
        "database.names" : "testDB",
        "snapshot.mode":"schema_only",
        
        "signal.data.collection": "testDB.dbo.debezium_signal",
        "table.include.list" : "dbo.debezium_signal,dbo.customers""database.encrypt": "false",
        "topic.prefix": "server1",
        "schema.history.internal.kafka.bootstrap.servers": "broker:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory"
      }

       

      What is the captured database version and mode of deployment?

      Docker mcr.microsoft.com/mssql/server:2019-latest

      What behaviour do you see?

      Using a signal with or condition like this:

       

      INSERT INTO dbo.debezium_signal (id, type, data) VALUES('ad-hoc-customers_1', 'execute-snapshot', '{"data-collections": ["testDB.dbo.customers"],"type":"incremental", "additional-condition":"(date >= ''2022-01-01'' and date < ''2022-12-31'') or (otherdate >= ''2022-01-01'' and otherdate < ''2022-12-31'')"}'); 

       

       

      The adhoc snapshot  goes into an infinite loop where data is produce infinitely:

       

      10:01:38 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      7
      10:01:49 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      25
      10:01:59 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      37
      10:02:09 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      49
      10:02:20 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      61
      10:02:30 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      73
      10:02:40 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      85
      10:02:51 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      97
      10:03:01 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      ... 

       

       

      Doing the select manually gives:

      {{}}

      select id from testDB.dbo.customers where (date >= '2022-01-01' and date < '2022-12-31') or (otherdate >= '2022-01-01' and otherdate < '2022-12-31');
      select id from testDB.dbo.customers where (date >= '2022-01-01' and date < '2022-12-31');
      select id from testDB.dbo.customers where (otherdate >= '2022-01-01' and otherdate < '2022-12-31'); 
       
       id 
      -----------
      1017
      1020
      1028
      1033
      1034
      1035
      
      (6 rows affected)
      id 
      -----------
      1017
      1020
      1028
      1033
      1034
      1035
      
      (6 rows affected)
      id 
      -----------
      1017
      1020
      1028
      1033
      1034
      1035
      
      (6 rows affected)
      

      {{}}

      If I remove the OR condition

       

      "additional-condition": "otherdate >= ''2022-01-01'' and otherdate < ''2022-12-31'')" 

      Then I get only get a fixed amount of records:

       

       

      10:09:47 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:09:57 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:10:07 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:10:18 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:10:28 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:10:39 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:10:49 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13
      10:11:00 ℹ️ 💯 Get number of records in topic server1.testDB.dbo.customers
      13 

       

       

      What behaviour do you expect?

      Not seeing an infinite loop when using OR condition in additional-condition

      Do you see the same behaviour using the latest relesead Debezium version?

      I'm using latest available on the Confluent Hub, which is 2.2.1. If you think it is fixed n later version, I can give it a try.

      Do you have the connector logs, ideally from start till finish?

      (You might be asked later to provide DEBUG/TRACE level log)

      Yes, see attached. This is 100% reproducible on my side.

              jpechane Jiri Pechanec
              vdesabou Vincent Vincent (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: