zhaojinchao95 opened a new issue, #23784:
URL: https://github.com/apache/shardingsphere/issues/23784

   
[master](https://github.com/apache/shardingsphere/commit/b796096c8a5d50b090ad162a6deae439250a6187)
   
   Now, ShardingSphere's BaseRALE2EIT and GeneralRDLE2EIT Need to wait memory 
refresh metadata when execute DistSQL with cluster mode. Because metadata 
refresh is dependent on governance events, the time is immeasurable.
   
   `GeneralRALE2EIT:`
   
   ```
   private void assertResultSet(final Statement statement) throws SQLException, 
ParseException {
           if (null == getAssertion().getAssertionSQL()) {
               assertResultSet(statement, getSQL());
           } else {
               statement.execute(getSQL());
               sleep();
               assertResultSet(statement, 
getAssertion().getAssertionSQL().getSql());
           }
       }
       
       private void assertResultSet(final Statement statement, final String 
sql) throws SQLException {
           try (ResultSet resultSet = statement.executeQuery(sql)) {
               assertResultSet(resultSet);
           }
       }
   ```
   
   ```
    private void sleep() {
           try {
               TimeUnit.SECONDS.sleep(2);
           } catch (final InterruptedException ignored) {
           }
       }
   ```
   
   `GeneralRDLE2EIT:`
   
   ```
    @Test
       public void assertExecute() throws SQLException, ParseException {
           assertNotNull("Assertion SQL is required", 
getAssertion().getAssertionSQL());
           try (Connection connection = getTargetDataSource().getConnection()) {
               try (Statement statement = connection.createStatement()) {
                   executeSQLCase(statement);
                   sleep();
                   assertResultSet(statement);
               }
           }
       }
       
       private void executeSQLCase(final Statement statement) throws 
SQLException, ParseException {
           statement.execute(getSQL());
       }
       
       private void assertResultSet(final Statement statement) throws 
SQLException {
           try (ResultSet resultSet = 
statement.executeQuery(getAssertion().getAssertionSQL().getSql())) {
               assertResultSet(resultSet);
           }
       }
   ```


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