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

Primary key changes cause UnsupportedOperationException

XMLWordPrintable

      We are using Debezium 0.8.3.Final and we are running into an UnsupportedOperationException.

      Our latest database migration changes the primary key of a table.

      Before
      COLUMN_A, COLUMN_B, COLUMN_C
      Primary key: (COLUMN_A, COLUMN_C)

      After
      COLUMN_A, COLUMN_B, COLUMN_D
      Primary key: (COLUMN_A, COLUMN_D)

      Exception

      2018-11-19 19:43:39,455 ERROR || WorkerSourceTask{id=amfori-connector-0} Task threw an uncaught and unrecoverable exception [org.apache.kafka.connect.runtime.WorkerTask]
      org.apache.kafka.connect.errors.ConnectException: An exception ocurred in the change event producer. This connector will be stopped.
      at io.debezium.connector.base.ChangeEventQueue.throwProducerFailureIfPresent(ChangeEventQueue.java:168)
      at io.debezium.connector.base.ChangeEventQueue.poll(ChangeEventQueue.java:149)
      at io.debezium.connector.postgresql.PostgresConnectorTask.poll(PostgresConnectorTask.java:146)
      at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:186)
      at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:170)
      at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:214)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      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.UnsupportedOperationException
      at java.util.Collections$UnmodifiableCollection$1.remove(Collections.java:1044)
      at io.debezium.relational.TableEditorImpl.updatePrimaryKeys(TableEditorImpl.java:103)
      at io.debezium.relational.TableEditorImpl.setColumns(TableEditorImpl.java:94)
      at io.debezium.connector.postgresql.RecordsStreamProducer.tableFromFromMessage(RecordsStreamProducer.java:528)
      at io.debezium.connector.postgresql.RecordsStreamProducer.columnValues(RecordsStreamProducer.java:425)
      at io.debezium.connector.postgresql.RecordsStreamProducer.process(RecordsStreamProducer.java:246)
      at io.debezium.connector.postgresql.RecordsStreamProducer.lambda$streamChanges$2(RecordsStreamProducer.java:128)
      at io.debezium.connector.postgresql.connection.wal2json.NonStreamingWal2JsonMessageDecoder.processMessage(NonStreamingWal2JsonMessageDecoder.java:62)
      at io.debezium.connector.postgresql.connection.PostgresReplicationConnection$1.deserializeMessages(PostgresReplicationConnection.java:218)
      at io.debezium.connector.postgresql.connection.PostgresReplicationConnection$1.read(PostgresReplicationConnection.java:203)
      at io.debezium.connector.postgresql.RecordsStreamProducer.streamChanges(RecordsStreamProducer.java:128)
      at io.debezium.connector.postgresql.RecordsStreamProducer.lambda$start$1(RecordsStreamProducer.java:114)
      ... 5 more
      

      Cause
      The TableEditorImpl::updatePrimaryKeys method seems to be calling List::remove on the unmodifiable list provided by TableEditorImpl::primaryKeyColumnNames

            jpechane Jiri Pechanec
            wouter.bancken.aca Wouter Bancken (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: