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

ExtractNewRecordState - add.source.fields should strip spaces from comma-separated list of fields

    XMLWordPrintable

Details

    Description

      A user may innocently specify the ExtractNewRecordState SMT config with spaces after the commas:

      'transforms.unwrap.add.source.fields'= 'name, db, table, file, pos',
      …
      

      This causes the SMT to barf with a slightly puzzling error, since the field "db" does exist - but obviously " db" doesn't (leading space).

      Caused by: org.apache.kafka.common.config.ConfigException: Source field specified in 'add.source.fields' does not exist:  db                         at io.debezium.transforms.ExtractNewRecordState.makeUpdatedSchema(ExtractNewRecordState.java:212)                                            at io.debezium.transforms.ExtractNewRecordState.lambda$addSourceFields$0(ExtractNewRecordState.java:182)
              at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324)                                                                at io.debezium.transforms.ExtractNewRecordState.addSourceFields(ExtractNewRecordState.java:182)                                              at io.debezium.transforms.ExtractNewRecordState.apply(ExtractNewRecordState.java:159)
              at org.apache.kafka.connect.runtime.TransformationChain.lambda$apply$0(TransformationChain.java:50)                                          at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:128)                      at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:162)
              ... 11 more
      

      Suggestion: SMT should strip any spaces from field name as part of parsing the comma-separated list.

      Attachments

        Issue Links

          Activity

            People

              gmorling@redhat.com Gunnar Morling
              rmoff Robin Moffatt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: