e-mhui opened a new pull request, #7750:
URL: https://github.com/apache/inlong/pull/7750

   ### Prepare a Pull Request
   
   [INLONG-7554][Sort] MySQL CDC supports parsing gh-ost records
   
   - Fixes #7554 
   
   ### Motivation
   
   [gh-ost](https://github.com/github/gh-ost) is a triggerless online schema 
migration solution for MySQL.
   
   When we use the `gh-ost` tool, it generates multiple DDL statements. For 
example, when adding a column `c` to table `tb1` using the `gh-ost` tool, these 
DDL statements demonstrate how gh-ost works. 
   
   ```sql
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_gho`
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_del`
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_ghc`
   create /* gh-ost */ table `menghuiyu`.`_tb1_ghc` (\n\t\t\tid bigint 
auto_increment,\n\t\t\tlast_update timestamp not null DEFAULT CURRENT_TIMESTAMP 
ON UPDATE CURRENT_TIMESTAMP,\n\t\t\thint varchar(64) charset ascii not 
null,\n\t\t\tvalue varchar(4096) charset ascii not null,\n\t\t\tprimary 
key(id),\n\t\t\tunique key hint_uidx(hint)\n\t\t) auto_increment=256
   create /* gh-ost */ table `menghuiyu`.`_tb1_gho` like `menghuiyu`.`tb1`
   alter /* gh-ost */ table `menghuiyu`.`_tb1_gho` add column c varchar(255)
   create /* gh-ost */ table `menghuiyu`.`_tb1_del` (\n\t\t\tid int 
auto_increment primary key\n\t\t) engine=InnoDB comment='ghost-cut-over-sentry'
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_del`
   rename /* gh-ost */ table `menghuiyu`.`tb1` to `menghuiyu`.`_tb1_del`
   rename /* gh-ost */ table `menghuiyu`.`_tb1_gho` to `menghuiyu`.`tb1`
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_ghc`
   DROP TABLE IF EXISTS `menghuiyu`.`_tb1_del`
   ```
   
   When MySQL CDC captures these DDL statements and synchronizes them to the 
sink, the sink cannot recognize the gh-ost tables (`_tb1_gho`, `_tb1_ghc`, 
`_tb1_del`) in these DDL statements. Therefore, we need to restore the gh-ost 
tables to the original table `tb1`.
   
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   Run `AllMigrateTest.java`
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes )
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs 
/ not documented)
     - docs
   


-- 
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