Hello.
Thanks for reply.Unfortunately,I still get the exception after running my
test on 2.7 for several times.
ilya.kasnacheev wrote
> Hello!
>
> I can reproduce this problem, but then again, it does not seem to
> reproduce
> on 2.7. Have you considered upgrading?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> ср, 16 янв. 2019 г. в 14:14, yangjiajun <
> 1371549332@
>>:
>
>> 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/
>>
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/