You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/27 12:30:51 UTC

[shardingsphere] branch master updated: Try fix sporadic exception in cluster mode (#19582)

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

zhangliang 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 4a79c7c9fc3 Try fix sporadic exception in cluster mode (#19582)
4a79c7c9fc3 is described below

commit 4a79c7c9fc38fc0a56ebdb74a668e07ef3095973
Author: gin <ja...@163.com>
AuthorDate: Wed Jul 27 20:30:33 2022 +0800

    Try fix sporadic exception in cluster mode (#19582)
    
    * Try fix sporadic exception in cluster mode
    
    * Optimize method name and parameter
---
 .../shardingsphere/test/integration/engine/ddl/BaseDDLIT.java | 11 +++++++++++
 .../test/integration/engine/ddl/GeneralDDLIT.java             |  8 --------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
index 1b5f8ca7774..f85c982098c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/BaseDDLIT.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.test.integration.engine.ddl;
 
 import com.google.common.base.Splitter;
+import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.datanode.DataNode;
 import org.apache.shardingsphere.sharding.route.engine.exception.NoSuchTableException;
 import org.apache.shardingsphere.infra.expr.InlineExpressionParser;
@@ -39,6 +40,7 @@ import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -59,6 +61,14 @@ public abstract class BaseDDLIT extends SingleITCase {
         try (Connection connection = getTargetDataSource().getConnection()) {
             executeInitSQLs(connection);
         }
+        sleepIntervalTime();
+    }
+    
+    @SneakyThrows(InterruptedException.class)
+    private void sleepIntervalTime() {
+        if ("Cluster".equalsIgnoreCase(getMode())) {
+            TimeUnit.MILLISECONDS.sleep(200L);
+        }
     }
     
     @After
@@ -70,6 +80,7 @@ public abstract class BaseDDLIT extends SingleITCase {
             }
         } catch (final SQLException | NoSuchTableException ignored) {
         }
+        sleepIntervalTime();
     }
     
     private void executeInitSQLs(final Connection connection) throws SQLException {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
index d7fa8fcbdc3..f8bb5f03c50 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/ddl/GeneralDDLIT.java
@@ -49,10 +49,6 @@ public final class GeneralDDLIT extends BaseDDLIT {
     
     @Test
     public void assertExecuteUpdate() throws SQLException, ParseException {
-        // FIXME DDL sporadic exception in cluster mode fixed
-        if ("Cluster".equalsIgnoreCase(getMode())) {
-            return;
-        }
         try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLExecuteType.Literal == getSqlExecuteType()) {
                 executeUpdateForStatement(connection);
@@ -77,10 +73,6 @@ public final class GeneralDDLIT extends BaseDDLIT {
     
     @Test
     public void assertExecute() throws SQLException, ParseException {
-        // FIXME DDL sporadic exception in cluster mode fixed
-        if ("Cluster".equalsIgnoreCase(getMode())) {
-            return;
-        }
         try (Connection connection = getTargetDataSource().getConnection()) {
             if (SQLExecuteType.Literal == getSqlExecuteType()) {
                 executeForStatement(connection);