This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 05dd7ad1ced Support Mysql change replication with no server ids 
(#31110)
05dd7ad1ced is described below

commit 05dd7ad1ced98afe9557e627affaa55d48676577
Author: LotusMoon <[email protected]>
AuthorDate: Sun May 5 14:20:39 2024 +0800

    Support Mysql change replication with no server ids (#31110)
    
    * Support Mysql change replication with no server ids
    
    * Support Mysql change master with no server ids
---
 parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/RLStatement.g4 | 4 ++--
 .../org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4    | 3 ++-
 .../sql/parser/core/database/visitor/SQLVisitorRule.java              | 2 +-
 .../case/rl/{change-replication-source-to.xml => change.xml}          | 2 ++
 .../sql/supported/rl/{change-replication-source-to.xml => change.xml} | 2 ++
 5 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/RLStatement.g4 
b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/RLStatement.g4
index a3620e8e999..547e1bbf57b 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/RLStatement.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/RLStatement.g4
@@ -114,7 +114,7 @@ masterDef
     | MASTER_TLS_CIPHERSUITES EQ_ string_
     | MASTER_PUBLIC_KEY_PATH EQ_ string_
     | GET_MASTER_PUBLIC_KEY EQ_ NUMBER_
-    | IGNORE_SERVER_IDS EQ_ LP_ ignoreServerIds RP_
+    | IGNORE_SERVER_IDS EQ_ LP_ ignoreServerIds? RP_
     ;
 
 ignoreServerIds
@@ -187,7 +187,7 @@ changeReplicationSourceOption
     | SOURCE_PUBLIC_KEY_PATH EQ_ string_
     | GET_SOURCE_PUBLIC_KEY EQ_ NUMBER_
     | NETWORK_NAMESPACE EQ_ string_
-    | IGNORE_SERVER_IDS EQ_ ignoreServerIds
+    | IGNORE_SERVER_IDS EQ_ LP_ ignoreServerIds? RP_
     | GTID_ONLY EQ_ NUMBER_
     ;
 
diff --git 
a/parser/sql/dialect/mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
 
b/parser/sql/dialect/mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
index e1c293fc99e..8ce203986b3 100644
--- 
a/parser/sql/dialect/mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
+++ 
b/parser/sql/dialect/mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
@@ -104,7 +104,8 @@ execute
     | setVariable
     | setCharacter
     | call
-    | change
+    | changeMasterTo
+    | changeReplicationFilter
     | checkTable
     | checksumTable
     | clone
diff --git 
a/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
 
b/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index d4703548794..1ceb017337d 100644
--- 
a/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ 
b/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -475,7 +475,7 @@ public enum SQLVisitorRule {
     
     LOAD_STATEMENT("LoadStatement", SQLStatementType.DML),
     
-    CHANGE_MASTER("ChangeMaster", SQLStatementType.RL),
+    CHANGE_MASTER("ChangeMasterTo", SQLStatementType.RL),
     
     CHANGE_REPLICATION_SOURCE_TO("ChangeReplicationSourceTo", 
SQLStatementType.RL),
     
diff --git 
a/test/it/parser/src/main/resources/case/rl/change-replication-source-to.xml 
b/test/it/parser/src/main/resources/case/rl/change.xml
similarity index 85%
rename from 
test/it/parser/src/main/resources/case/rl/change-replication-source-to.xml
rename to test/it/parser/src/main/resources/case/rl/change.xml
index d6cb15a133f..01a066ea517 100644
--- a/test/it/parser/src/main/resources/case/rl/change-replication-source-to.xml
+++ b/test/it/parser/src/main/resources/case/rl/change.xml
@@ -18,4 +18,6 @@
 
 <sql-parser-test-cases>
     <change-replication-source-to sql-case-id="change_replication_source_to" />
+    <change-replication-source-to 
sql-case-id="change_replication_ignore_server_ids"/>
+    <change-replication-source-to 
sql-case-id="change_master_ignore_server_ids"/>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/rl/change-replication-source-to.xml
 b/test/it/parser/src/main/resources/sql/supported/rl/change.xml
similarity index 80%
rename from 
test/it/parser/src/main/resources/sql/supported/rl/change-replication-source-to.xml
rename to test/it/parser/src/main/resources/sql/supported/rl/change.xml
index a57bb19a9fb..b8fcabbebca 100644
--- 
a/test/it/parser/src/main/resources/sql/supported/rl/change-replication-source-to.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rl/change.xml
@@ -18,4 +18,6 @@
 
 <sql-cases>
     <sql-case id="change_replication_source_to" value="CHANGE REPLICATION 
SOURCE TO SOURCE_USER = 'plug_user', SOURCE_PASSWORD = 'plug_user', 
SOURCE_RETRY_COUNT = 0" db-types="MySQL" />
+    <sql-case id="change_replication_ignore_server_ids" value="CHANGE 
REPLICATION SOURCE TO IGNORE_SERVER_IDS = ()" db-types="MySQL"/>
+    <sql-case id="change_master_ignore_server_ids" value="CHANGE MASTER TO 
IGNORE_SERVER_IDS = ()" db-types="MySQL"/>
 </sql-cases>

Reply via email to