flink-cdc icon indicating copy to clipboard operation
flink-cdc copied to clipboard

[Bug] oracle clob

Open liquidmavis opened this issue 3 years ago • 4 comments

Search before asking

  • [X] I searched in the issues and found nothing similar.

Flink version

1.12

Flink CDC version

2.1.0

Database and its version

oracle11

Minimal reproduce step

In Oracle with Flink CDC, one of the fields is a CLOB. When modifying a data record, as long as the CLOB field remains unchanged, Flink CDC, during the incremental phase, will not include the CLOB field data in the received Oracle data updates. All other fields will be included. Only when modifying the CLOB field data will Flink CDC transmit it. Is this a bug? Why isn’t the CLOB field transmitted?

What did you expect to see?

flinkcdc will transfer clob field even oralce not update this field

What did you see instead?

1

Anything else?

No response

Are you willing to submit a PR?

  • [X] I'm willing to submit a PR!

liquidmavis avatar Oct 23 '23 02:10 liquidmavis

By default, Oracle will not synchronize data in clob format. You can try adding this advanced parameter debezium.lob.enabled=true. Refer: https://debezium.io/documentation/reference/1.9/connectors/oracle.html#oracle-connector-properties image

e-mhui avatar Oct 30 '23 07:10 e-mhui

i meet this problem too, when update some columns (not clob),will get null value in clob columns . maybe this is oracle official act, information from :https://access.redhat.com/documentation/zh-cn/red_hat_integration/2022.q4/html/debezium_user_guide/debezium-connector-for-oracle

Note
Oracle only supplies column values for CLOB, NCLOB, and BLOB data types if they’re explicitly set or changed in a SQL statement. As a result, change events never contain the value of an unchanged CLOB, NCLOB, or BLOB column. Instead, they contain placeholders as defined by the connector property, unavailable.value.placeholder.

If the value of a CLOB, NCLOB, or BLOB column is updated, the new value is placed in the after element of the corresponding update change event. The before element contains the unavailable value placeholder.

fangchuanming avatar Nov 01 '23 01:11 fangchuanming

Hi, Debezium's Oracle maintainer here.

Oracle, PostgreSQL, and SQL Server have specific use cases with certain column types that will not be written to the transaction logs unless those fields are explicitly modified. For the Oracle database, this includes data types such as CLOB, BLOB, and XMLTYPE.

What you should be observing (assuming that lob.enabled is set to true), is that you will see the Debezium unavailable placeholder injected as the value for CLOB/XMLTYPE columns and the unavailable value placeholder injected as the value for BLOB columns, except the latter is converted to a byte array to satisfy the schema type.

For consumers, when you see the unavailable value placeholder sentinel value for these columns, your consumer should ignore that column in this case, so when using something like a JDBC sink; you simply don't add that column to your INSERT or UPDATE operation.

As @fangchuanming points out, this is not a Debezium limitation, but how the database works. And as I mentioned above, PostgreSQL and SQL Server also have specific data types that work in an identical way.

Naros avatar Nov 15 '23 16:11 Naros

Closing this issue as it has been migrated to Apache Jira.

PatrickRen avatar Apr 09 '24 06:04 PatrickRen