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

Logging enhancement for non-incremental snapshot in postgres connector


    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 2.0.0.CR1
    • None
    • postgresql-connector
    • None
    • False
    • 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?


      What is the connector configuration?

      <Your answer>

      What is the captured database version and mode of depoyment?

      (E.g. on-premises, with a specific cloud provider, etc.)

      AWS Aurora RDS Postgres 12.x

      What behaviour do you expect?

      When normal snapshot fails, instead of `Snapshot: Final Stage` in final statement, something like `Snapshot Incomplete`.

      What behaviour do you see?

      When normal snapshot succeeds or fails, it logs `Snapshot: Final Stage` in final statement and gives impression that the connector failed after the snapshot was completed.The Final Stage feels like it completed snapshot and then when resuming the streaming from replication slot, it failed to keep the connection alive

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

      (Ideally, also verify with latest Alpha/Beta/CR version)

      <Your answer>

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

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

      2022-09-21 15:59:21,326] INFO    Exported 56299520 records for table 'public.sales_order_item' after 06:15:33.089 (io.debezium.relational.RelationalSnapshotChangeEventSource:370)
      [2022-09-21 15:59:23,211] INFO Snapshot - Final stage (io.debezium.pipeline.source.AbstractSnapshotChangeEventSource:88)
      [2022-09-21 15:59:23,211] ERROR Producer failure (io.debezium.pipeline.ErrorHandler:31)
      io.debezium.DebeziumException: java.lang.RuntimeException: org.postgresql.util.PSQLException: This connection has been closed.
          at io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.execute(AbstractSnapshotChangeEventSource.java:85)
          at io.debezium.pipeline.ChangeEventSourceCoordinator.doSnapshot(ChangeEventSourceCoordinator.java:153)
          at io.debezium.pipeline.ChangeEventSourceCoordinator.executeChangeEventSources(ChangeEventSourceCoordinator.java:135)
          at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:108)
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
          at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
          at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: java.lang.RuntimeException: org.postgresql.util.PSQLException: This connection has been closed.
          at io.debezium.relational.RelationalSnapshotChangeEventSource.rollbackTransaction(RelationalSnapshotChangeEventSource.java:520)
          at io.debezium.relational.RelationalSnapshotChangeEventSource.doExecute(RelationalSnapshotChangeEventSource.java:143)
          at io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.execute(AbstractSnapshotChangeEventSource.java:76)
          ... 8 more
      Caused by: org.postgresql.util.PSQLException: This connection has been closed.
          at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:883)
          at org.postgresql.jdbc.PgConnection.rollback(PgConnection.java:890)
          at io.debezium.relational.RelationalSnapshotChangeEventSource.rollbackTransaction(RelationalSnapshotChangeEventSource.java:517)
          ... 10 more 

      How to reproduce the issue using our tutorial deployment?

      If you terminal a connection during snapshot or any error during non-incremental snapshot, the logging is misleading in the sense that it does not say if snapshot was completed and assumes that user knows the count.

      Feature request or enhancement

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

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

      Logging enhancement for snapshot

      Implementation ideas (optional)

      In the final stage before logging " INFO Snapshot - Final stage ", check if snapshot is completed, if yes, log "Final" otherwise report "Snapshot Incomplete due to following error"

            Unassigned Unassigned
            tkarmarkar Tanay Karmarkar (Inactive)
            0 Vote for this issue
            4 Start watching this issue