Igor created IGNITE-19275:
-----------------------------

             Summary: Creation of big amount of tables throws exception
                 Key: IGNITE-19275
                 URL: https://issues.apache.org/jira/browse/IGNITE-19275
             Project: Ignite
          Issue Type: Bug
          Components: general
    Affects Versions: 3.0
            Reporter: Igor
         Attachments: image-2023-04-11-16-11-09-934.png, node_0.log.zip, 
node_1.log.zip

h1. *Steps:*
 # Sart 2 nodes
 # Init cluster
 # Connect to cluster via jdbc
 # Create table with 5 columns.
 # Wait 30 ms.
 # Repeat points 4-5 1000 times.

h1. *Expected behavior:*
 # Creation time is constant.
 # Tables are created.

h1. *Actual behavior:*
 # Creation time is increasing
 # The exception is thrown| after 200+ tables are created

h2. *Details:*
h3. Creation time graph:

!image-2023-04-11-16-11-09-934.png|width=522,height=323!
h3. Exceptions:
 # From client:

 
{code:java}
Exception in thread "main" java.sql.SQLException: Exception while executing 
query [query=CREATE TABLE table_239(id INT PRIMARY KEY, column_1 VARCHAR, 
column_2 VARCHAR, column_3 VARCHAR, column_4 VARCHAR)]. Error 
message:IGN-CMN-65535 TraceId:7299edda-2a88-4448-ba6d-366fca88cfd4
        at 
org.apache.ignite.internal.jdbc.proto.IgniteQueryErrorCode.createJdbcSqlException(IgniteQueryErrorCode.java:57)
        at 
org.apache.ignite.internal.jdbc.JdbcStatement.execute0(JdbcStatement.java:148)
        at 
org.apache.ignite.internal.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:177)
        at lunigorn.ignite3test.Test.main(Test.java:18) {code}
    2. From server logs:

 

 
{code:java}
2023-04-11 15:13:49:890 +0200 
[WARNING][%node_1%Raft-Group-Client-5][DistributedConfigurationStorage] Meta 
storage listener issue
org.apache.ignite.lang.IgniteInternalException: IGN-SQL-32 
TraceId:d3484efb-2ca6-4098-8c17-30a878c0801e Couldn't evaluate sql schemas for 
causality token: 722
    at 
org.apache.ignite.internal.sql.engine.schema.SqlSchemaManagerImpl.lambda$new$1(SqlSchemaManagerImpl.java:131)
    at 
org.apache.ignite.internal.causality.BaseVersionedValue.lambda$notifyCompletionListeners$7(BaseVersionedValue.java:331)
 {code}
*The nodes logs are in attachment.*

 
h3. The code to reproduce (or use [gradle 
project|https://github.com/Lunigorn/ignite3test/tree/tables-capacity-test]):
{code:java}
package lunigorn.ignite3test;

import java.sql.*;

public class Test {
    private static final String DB_URL = "jdbc:ignite:thin://127.0.1.1:10800";
    private static final int COLUMNS_COUNT = 5;
    private static final int TABLES_COUNT = 1000;
    private static final int SLEEP = 30;

    public static void main(String[] args) throws SQLException {
        System.out.println("Test started");
        try (Connection connection = DriverManager.getConnection(DB_URL); 
Statement statement = connection.createStatement()){
            System.out.println("Connection created");
            for (int i = 0; i < TABLES_COUNT; i++) {
                String createTableQuery = createTableQuery("table_" + i, 
COLUMNS_COUNT);
                long timestampBefore = System.currentTimeMillis();
                statement.executeUpdate(createTableQuery);
                long timestampAfter = System.currentTimeMillis();
                System.out.println("Create table " + i + " took " + 
(timestampAfter - timestampBefore) + " ms");
                if (i % 50 == 0){
                    int tablesCount = findTablesCount(connection);
                    if (tablesCount != i+1){
                        throw new IllegalStateException("Expected " + (i+1) + " 
tables in cluster, but was " + tablesCount);
                    }
                    System.out.println("Tables count in cluster: " + 
tablesCount);
                }
                sleep();
            }
        }
    }


    public static String createTableQuery(String tableName, int columnsAmount){
        StringBuilder sb = new StringBuilder();
        sb.append("CREATE TABLE ").append(tableName).append("(");
        for (int i = 0; i < columnsAmount; i++) {
            if (i == 0){
                sb.append("id INT PRIMARY KEY");
            } else {
                sb.append("column_").append(i).append(" VARCHAR");
            }

            if (i != columnsAmount - 1){
                sb.append(", ");
            }
        }
        sb.append(")");
        return sb.toString();
    }

    public static int findTablesCount(Connection connection) throws 
SQLException {
        DatabaseMetaData md = connection.getMetaData();
        String catalog = connection.getCatalog();
        ResultSet table_rs = md.getTables(catalog, null, null, new 
String[]{"TABLE"});
        int count = 0;
        while (table_rs.next()){
            count++;
        }
        return count;
    }

    public static void sleep(){
        try {
            Thread.sleep(SLEEP);
        } catch (InterruptedException ignored) {
        }
    }

}{code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to