You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "czy006 (via GitHub)" <gi...@apache.org> on 2025/08/04 08:38:38 UTC
Re: [PR] [FLINK-38139] Fix consecutive online schema change causes job failure. [flink-cdc]
czy006 commented on code in PR #4064:
URL: https://github.com/apache/flink-cdc/pull/4064#discussion_r2250699624
##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/reader/BinlogSplitReader.java:
##########
@@ -171,8 +173,33 @@ public Iterator<SourceRecords> pollSplitRecords() throws InterruptedException {
Optional<SourceRecord> oscRecord =
parseOnLineSchemaChangeEvent(event.getRecord());
if (oscRecord.isPresent()) {
- sourceRecords.add(oscRecord.get());
- continue;
+ TableId tableId = RecordUtils.getTableId(oscRecord.get());
+ if (tableId != null) {
+ LOG.info(
+ "Received the start event of online schema change: {}. Save it for later.",
+ oscRecord.get());
+ pendingSchemaChangeEvents.put(tableId.toString(), oscRecord.get());
+ continue;
+ }
+ }
+
+ Optional<String> finishedTables =
+ RecordUtils.parseOnLineSchemaRenameEvent(event.getRecord());
+ if (finishedTables.isPresent()) {
+ TableId tableId = RecordUtils.getTableId(event.getRecord());
Review Comment:
When execute gh-ost `/gh-ost --user="root" --password="XXXX" --host="localhost" --database="dinky" --table="dinky_user" --alter="ADD COLUMN czy04 DATETIME NULL AFTER update_time" --allow-on-master --ok-to-drop-table --initially-drop-ghost-table --initially-drop-old-table --execute`,Have this error schema can't remove on **BinlogSplitReader. pendingSchemaChangeEvents**
If have del table,RecordUtils.getTableId have ',' with del and finishedTable.That will error record to ddl remove
<img width="1558" height="212" alt="image" src="https://github.com/user-attachments/assets/6e2f3be5-cc02-44ed-a370-c1a9e9b7ac7a" />
--
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