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

When_needed snapshot mode still uses the existing snapshot and offset

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 3.2-plan
    • None
    • debezium-core
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      3.0.0.Final

      What is the connector configuration?

      Omit the database-related and some transformers

       

      {
          "name": "inventory-connector",  
          "config": {
              "connector.class" : "io.debezium.connector.oracle.OracleConnector",  
              "database.hostname" : "xxx",  
              "database.port" : "xxx",  
              "database.user" : "xxx",  
              "database.password" : "xxx",   
              "database.dbname" : "xxx",  
              "topic.prefix" : "server1",  
              "snapshot.mode" : "custom",
              "snapshot.mode.custom.name" : "when_needed_no_data",
              "database.connection.adapter" : "logminer",
              "database.archive.log.only.mode" : "false",
              "tasks.max" : "1",  
              "log.mining.strategy" : "online_catalog",  
              "log.mining.continuous.mine" : "false",
              "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092", 
              "schema.history.internal.kafka.topic": "schema-changes.inventory"  
          }
      } 

       

      Here I have defined a custom snapshotter `WhenNeededNoDataSnapshotter` which extends `WhenNeededSnapshotter`. What I did is as follows:

      1. Create a separate project and define the class
      package com.aaa.bbb
      
      import io.debezium.snapshot.mode.WhenNeededSnapshotter
      
      public class WhenNeededNoDataSnapshotter extends WhenNeededSnapshotter {
          @Override
          public String name() {
              return "when_needed_no_data";
          }
      
          @Override
          public boolean shouldSnapshotData(boolean offsetExists, boolean snapshotInProgress) {
              return false;
          }
      
          @Override
          public boolean shouldSnapshotOnDataError() {
              return false;
          }
      } 
      1. Created the file META-INF/services/io.debezium.spi.snapshot.Snapshotter in project and added `com.aaa.bbb.WhenNeededNoDataSnapshotter` into the file.
      2. Build the jar and mount it to the path `/kafka/connect/debezium-connector-oracle/`

       

      What is the captured database version and mode of deployment?

      on-premises, Oracle 19c, non-CDB mode

      What behavior do you expect?

      With the `when_needed_no_data`, when the connector met the error like `Online REDO LOG files or archive log files do not contain the offset scn xxx`, it should be able to perform a new snapshot and ignore the previous offset. 

      What behavior do you see?

      A weird thing is that after setting the mode to custom and custom mode name to when_needed_no_data, the connector is still trying to use the existing offset and causing the unavailable offset SCN error. 

      INFO - A previous offset indicating a completed snapshot has been found.
      INFO - Snapshot ended with SnapshotResult [status=SKIPPED, offset=OracleOffsetContext [scn=xxx, commit_scn=[],...]
      ...
      ERROR - Mining session stopped due to error
      Online REDO LOG files or archive log files do not contain the offset scn xxx. Please perform a new snapshot.

      I also try to test the function of when_needed_no_data at a local environment. If I redeployed the whole debezium image and register the connector using this custom mode, I can see According to the connector configuration only schema will be snapshot. when performing snapshot. And the connector works well.

      When I deployed the new debezium image it on k8s, the first time when install connector I saw this error java.lang.InterruptedException: Interrupted while locking table xxx.xxx.xxx. Then I deleted the connector and re-install with the same config, I saw this message Online REDO LOG files or archive log files do not contain the offset scn xxx.

       

      Plus in my local testing, I try to delete the offset topic after connector start streaming. Then makes some changes in the database. I could see the change events are coming through to the kafka topics correctly. And seems like it is about to recover from offset issues?

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

      Haven't tried it on with the latest version

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

      Since it is not that convenient for me the put all the logs here, I've put the related logs with WARN or ERROR above in the behavior section.

      How to reproduce the issue using our tutorial deployment?

      1. Ideally, there should first be an error message like this - Online REDO LOG files or archive log files do not contain the offset scn xxx. Please perform a new snapshot

      But I am not sure how to reproduce it. Probably purge all the archive log manually.

      2. Follow previous section to configure the `when_needed_no_data` snapshot mode.

      3. Restart connector.

       

      Feature request or enhancement

      For feature requests or enhancements, provide this information, please:

      Which use case/requirement will be addressed by the proposed feature?

      <Your answer>

      Implementation ideas (optional)

      <Your answer>

              ccranfor@redhat.com Chris Cranford
              alanzyt311@gmail.com Alan Williams (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: