You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "e-mhui (via GitHub)" <gi...@apache.org> on 2023/04/03 02:55:52 UTC

[GitHub] [inlong] e-mhui commented on a diff in pull request #7750: [INLONG-7554][Sort] MySQL CDC supports parsing gh-ost records

e-mhui commented on code in PR #7750:
URL: https://github.com/apache/inlong/pull/7750#discussion_r1155442137


##########
inlong-sort/sort-connectors/cdc-base/src/main/java/org/apache/inlong/sort/cdc/base/debezium/table/RowDataDebeziumDeserializeSchema.java:
##########
@@ -767,6 +786,33 @@ private GenericRowData extractBeforeRow(Struct value, Schema valueSchema) throws
         return (GenericRowData) physicalConverter.convert(before, beforeSchema);
     }
 
+    /**
+     * Extract ghost ddl record
+     *
+     * @param data
+     * @return
+     * @throws Exception
+     */
+    private GenericRowData extractGhostRecord(GenericRowData data) throws Exception {
+        String ddl = ((Map<String, String>)data.getField(0)).get(DDL_FIELD_NAME);
+        if (this.ghostTableRegex.startsWith(CARET) && this.ghostTableRegex.endsWith(DOLLAR)) {
+            this.ghostTableRegex = this.ghostTableRegex.substring(1, this.ghostTableRegex.length() - 1);

Review Comment:
   1. We need to extract tables from SQL, but usually tables are in the middle of SQL, `^_(.*)_(gho|ghc|del|new|old)$` can only match `_tb1_gho`, but cannot match `alter menghuiyu_tb1_gho add column c varchar(255)`. Therefore, we need to remove `^,$`.
   2. Generally, the default regular expression is suitable for most cases.
   3. Do you have any good suggestions for getting tables with gh-ost?



-- 
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: commits-unsubscribe@inlong.apache.org

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