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

Debezium postgres connector cannot handle making a new column required after updating it with a value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 0.9.2.Final
    • postgresql-connector
    • None

    Description

      We have a liquibase changeset as follows

      <changeSet id="add-optional-column">
      		<addColumn tableName="a_table">
      			<column name="a_column" type="BOOLEAN"/>
      		</addColumn>
      </changeSet>
      
      <changeSet id="update-column">
      		<sql>
      			UPDATE a_table SET a_column = false
      		</sql>
      </changeSet>
      
      <changeSet id="make-required" author="Dave S - Hendrik J">
      		<addNotNullConstraint tableName="a_table" columnName="a_column" />
      </changeSet>
      

      Which adds an optional column, then updates it with a value, and then makes it required.

      The 'a_table' also contains a row of data before the changesets execute.

      When debezium is listening to postgresql while this executes we get into a situation where debezium complains that he receives a null value for a column which is required. See attached debezium log!

      Probably a race condition where debezium gets change events for a situation before the value is set and debezium updates its metadata cache when the required constraint is already added.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mail@tomdewolf.be Tom De Wolf (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: