goutamadwant opened a new pull request, #13723:
URL: https://github.com/apache/seatunnel/pull/13723

   ### Purpose of this pull request
   
   Closes #13722.
   
   `KafkaSourceConfig` built the `canal_json`, `ogg_json`, `maxwell_json` and 
`debezium_json` deserializers with `ignoreParseErrors = true`. A message that 
could not be parsed was swallowed there and never reached `KafkaRecordEmitter`, 
the only place that applies `format_error_handle_way`. So the default `fail` 
behaved as `skip`, and `skip` dropped messages without a log line. `json` and 
`text` already use `false` and work as documented.
   
   | Case | Before | After |
   |---|---|---|
   | Unparseable message, `format_error_handle_way` unset (`fail`) | dropped, 
no log line | job fails with `COMMON-02`, message in the error |
   | Same, `format_error_handle_way = skip` | dropped, no log line | dropped, 
WARN with topic, partition and offset |
   | Unparseable `maxwell_json` message | `IllegalArgumentException: Param 
[identifier] is not set` | `COMMON-02` like the other formats |
   | Events without a row (Canal DDL, Maxwell bootstrap/DDL, Ogg `T`, Debezium 
`t`/`m`) | no row | no row, in both modes |
   | `json`, `text`, `avro`, Kafka Connect, `protobuf` | option honoured | 
unchanged |
   
   The fix:
   
   - `KafkaSourceConfig` builds the four CDC deserializers (and the 
`debezium_record_table_filter` dispatcher) with `ignoreParseErrors = false`, so 
every parse error reaches `KafkaRecordEmitter`.
   - Events that carry no row are not parse errors: Canal `"isDdl": true` with 
no `data` (`TRUNCATE`, `ERASE`, `RENAME`, index DDL), Maxwell 
`bootstrap-start`, `bootstrap-complete` and the six DDL types, Ogg `T`, 
Debezium `t` and `m`. Maxwell `bootstrap-insert` is read as INSERT.
   - `MaxWellJsonDeserializationSchema` parses inside the same try/catch the 
other three formats use and reports errors through 
`CommonError.jsonOperationError`.
   - `KafkaSourceFactory.optionRule()` lists `format_error_handle_way`, which 
it had omitted.
   - Docs EN/ZH: the Kafka option row, the four format pages, 
`incompatible-changes.md`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. With the default `fail`, a Kafka source on one of the four CDC formats 
now fails on the first message it cannot parse instead of dropping it. With 
`skip`, the dropped message is logged at WARN with topic, partition and offset, 
and a message with one unconvertible field is dropped whole instead of being 
kept with that field `null`. Recorded in `incompatible-changes.md` (EN and ZH).
   
   ### How was this patch tested?
   
   - `KafkaSourceConfigTest`, four new cases: for each CDC format a malformed 
message and an unknown operation fail under default and explicit `fail` and 
keep the offset, are dropped and logged under `skip` and advance the offset, 
and the next valid row is read; the same through the 
`debezium_record_table_filter` dispatcher. All four fail on dev.
   - Format tests: Canal `"isDdl": true`, Ogg `T`, Debezium `t`/`m`, Maxwell 
bootstrap and DDL events produce no row and no error; Maxwell malformed JSON 
and unknown `type` raise `COMMON-02`. The Canal and Maxwell cases fail on dev.
   - `seatunnel-format-json` (83 tests) and `connector-kafka` (136 tests) pass 
on JDK 11 and 17. `spotless:check` clean.
   - E2E `KafkaIT`, two new `canal_json` cases on Zeta. The topic holds five 
valid rows, `{not a canal message` and a `TRUNCATE` event. With the default the 
job fails with `COMMON-02 Canal JSON convert/parse '{not a canal message'`. 
With `skip` the job finishes with five rows and a WARN naming topic, partition 
and offset 2.
   - `KafkaFormatIT` (canal, ogg, maxwell, debezium, compatible, multi-format): 
7/7 pass on Zeta. Flink and Spark are left to CI.
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
 (no new dependency)
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs 
(`docs/en|zh/connectors/source/Kafka.md`, 
`docs/en|zh/connectors/formats/{canal,ogg,maxwell,debezium}-json.md`)
   * [x] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR. (EN and ZH)
   * [ ] If you are contributing the connector code, please check that the 
following files are updated: (not a new connector)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to