You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/09/26 13:16:12 UTC

[GitHub] [shardingsphere] taojintianxia commented on a change in pull request #12749: avoid parallel create table throw already exists except to continue s…

taojintianxia commented on a change in pull request #12749:
URL: https://github.com/apache/shardingsphere/pull/12749#discussion_r716203109



##########
File path: shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/AbstractDataSourcePreparer.java
##########
@@ -113,9 +113,13 @@ protected void executeTargetTableSQL(final Connection targetConnection, final St
         try (Statement statement = targetConnection.createStatement()) {
             statement.execute(sql);
         } catch (final SQLException ex) {
-            if (!ex.getMessage().contains("multiple primary keys for table")) {
-                throw ex;
+            String[] ignoreMessages = {"multiple primary keys for table", "already exists"};

Review comment:
       why not extract the ignoreMessages as a static constant 




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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