Hello.

I do  test on a ignite 2.6 node with persistence enabled and get an
exception:

 Exception in thread "main" java.sql.BatchUpdateException: class
org.apache.ignite.IgniteCheckedException: Data streamer has been closed.
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinConnection$StreamState.readResponses(JdbcThinConnection.java:1017)
        at java.lang.Thread.run(Unknown Source)

Here is my test code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Properties;

/**
 * test insert data in streaming mode
 * */
public class InsertStreamingMode {

        private static Connection conn;

        public static void main(String[] args) throws Exception {

                initialize();
                
                close();
        }

        public static void close() throws Exception {
                conn.close();
        }

        public static void initialize() throws Exception {
                Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
                final String dbUrl =
"jdbc:ignite:thin://ip:port;lazy=true;skipReducerOnUpdate=true;replicatedOnly=true";
                final Properties props = new Properties();
                conn = DriverManager.getConnection(dbUrl, props);
                initData();
                overwriteData();
        }

        private static void initData() throws SQLException{

                long start=System.currentTimeMillis();
                conn.prepareStatement("SET STREAMING ON ALLOW_OVERWRITE 
ON").execute();

                String sql="insert INTO  city1(id,name,name1) VALUES(?,?,?)";
                PreparedStatement ps=conn.prepareStatement(sql);
                for(int i=0;i<1600000;i++){
                        String s1=String.valueOf(Math.random());
                        String s2=String.valueOf(Math.random());
                        ps.setInt(1, i);
                        ps.setString(2, s1);
                        ps.setString(3, s2);
                        ps.execute();
                }
                conn.prepareStatement("set streaming off").execute();
                long end=System.currentTimeMillis();
                System.out.println(end-start);
        }
        
        private static void overwriteData() throws SQLException{

                long start=System.currentTimeMillis();
                conn.prepareStatement("SET STREAMING ON ALLOW_OVERWRITE 
ON").execute();

                String sql="insert INTO  city1(id,name,name1) VALUES(?,?,?)";
                PreparedStatement ps=conn.prepareStatement(sql);
                for(int i=0;i<1600000;i++){
                        String s1="test";
                        String s2="test";
                        ps.setInt(1, i);
                        ps.setString(2, s1);
                        ps.setString(3, s2);
                        ps.execute();
                }
                conn.prepareStatement("set streaming off").execute();
                long end=System.currentTimeMillis();
                System.out.println(end-start);
        }
}

Here is the table:
CREATE TABLE city1(id LONG PRIMARY KEY, name VARCHAR,name1 VARCHAR) WITH
"template=replicated"

The exception occurs on overwriteData method.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to