You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "tejanshrana (via GitHub)" <gi...@apache.org> on 2025/11/04 16:03:10 UTC

[PR] [PROPOSAL] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

tejanshrana opened a new pull request, #4170:
URL: https://github.com/apache/flink-cdc/pull/4170

   Transaction BEGIN/END events (when provide.transaction.metadata is enabled) are currently treated as unknown and skipped, causing loss of transaction boundaries.
   
   Solution
   
   - Detect transaction metadata events via key schema name
   - Update binlog offset when processing these events
   - Emit events to downstream consumers
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [PROPOSAL] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "Amareswar (via GitHub)" <gi...@apache.org>.
Amareswar commented on code in PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170#discussion_r2557225436


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/reader/MySqlRecordEmitter.java:
##########
@@ -102,6 +102,9 @@ protected void processElement(
             emitElement(element, output);
         } else if (RecordUtils.isHeartbeatEvent(element)) {
             updateStartingOffsetForSplit(splitState, element);
+        } else if (RecordUtils.isTransactionMetadataEvent(element)) {

Review Comment:
   Shouldn't the emit of events be configurable for backward compatibility?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38691] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170#issuecomment-3806079172

   Thanks @tejanshrana's contribution, merged.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [PROPOSAL] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "tejanshrana (via GitHub)" <gi...@apache.org>.
tejanshrana commented on code in PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170#discussion_r2557231220


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/reader/MySqlRecordEmitter.java:
##########
@@ -102,6 +102,9 @@ protected void processElement(
             emitElement(element, output);
         } else if (RecordUtils.isHeartbeatEvent(element)) {
             updateStartingOffsetForSplit(splitState, element);
+        } else if (RecordUtils.isTransactionMetadataEvent(element)) {

Review Comment:
   That's correct. This is being discussed at the moment and I will introduce a new configuration (in addition to the existing debezium config for transaction metadata) to make this a non-breaking change. 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38691] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "tejanshrana (via GitHub)" <gi...@apache.org>.
tejanshrana commented on code in PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170#discussion_r2731982914


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceConfigFactory.java:
##########
@@ -366,6 +374,9 @@ public MySqlSourceConfig createConfig(int subtaskId, String serverName) {
         // Note: the includeSchemaChanges parameter is used to control emitting the schema record,
         // only DataStream API program need to emit the schema record, the Table API need not
         props.setProperty("include.schema.changes", String.valueOf(true));
+        // enable transaction metadata if includeTransactionMetadataEvents is true
+        props.setProperty(
+                "provide.transaction.metadata", String.valueOf(includeTransactionMetadataEvents));

Review Comment:
   Done. Could you please take another look and merge if all good? Could this feature also be included in v3.6?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38691] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170#discussion_r2731584758


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceConfigFactory.java:
##########
@@ -366,6 +374,9 @@ public MySqlSourceConfig createConfig(int subtaskId, String serverName) {
         // Note: the includeSchemaChanges parameter is used to control emitting the schema record,
         // only DataStream API program need to emit the schema record, the Table API need not
         props.setProperty("include.schema.changes", String.valueOf(true));
+        // enable transaction metadata if includeTransactionMetadataEvents is true
+        props.setProperty(
+                "provide.transaction.metadata", String.valueOf(includeTransactionMetadataEvents));

Review Comment:
   nit:
   Please reference the original variable name to facilitate tracking.
   ```
   props.setProperty(CommonConnectorConfig.PROVIDE_TRANSACTION_METADATA.name(), String.valueOf(includeTransactionMetadataEvents));
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38691] [cdc connector mysql] Support for MySQL Transaction Boundary Events in Flink CDC Connector [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan merged PR #4170:
URL: https://github.com/apache/flink-cdc/pull/4170


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org