Hello.
Here is my test code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
/**
* concurrent merge into
* */
public class MergeInto {
private final static String mergeSql1 = "merge INTO
city2(id,name,name1)
VALUES(1,'1','1'),(2,'1','1'),(3,'1','1')";
private final static String mergeSql2 = "merge INTO
city2(id,name,name1)
VALUES(2,'1','1'),(1,'1','1')";
private static Connection conn;
private static Connection conn1;
public static void main(String[] args) throws Exception {
initialize(false);
testQuery();
while(true){
}
}
public static void close() throws Exception {
conn.close();
}
public static void initialize(boolean initData) 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);
conn1= DriverManager.getConnection(dbUrl, props);
if(initData){
initData();
}
}
private static void initData() throws SQLException{
long start=System.currentTimeMillis();
conn.prepareStatement("set streaming on").execute();
String sql="insert INTO city2(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);
}
public static void testQuery() throws Exception {
new Thread(new Runnable() {
@Override
public void run() {
while(true){
long
startTime=System.currentTimeMillis();
try (Statement stmt =
conn.createStatement()) {
stmt.executeUpdate(mergeSql1);
} catch (SQLException e1) {
e1.printStackTrace();
}
System.out.println("conn:"+(System.currentTimeMillis()-startTime));
}
}
}).start();
new Thread(new Runnable() {
@Override
public void run() {
while(true){
long
startTime=System.currentTimeMillis();
try (Statement stmt =
conn1.createStatement()) {
stmt.executeUpdate(mergeSql2);
} catch (SQLException e1) {
e1.printStackTrace();
}
System.out.println("conn1:"+(System.currentTimeMillis()-startTime));
}
}
}).start();
}
}
ilya.kasnacheev wrote
> Hello!
>
> Can you provide a reproducer project which would reliably show this
> behavior?
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> ср, 16 янв. 2019 г. в 15:37, yangjiajun <
> 1371549332@
>>:
>
>> Hello.
>>
>> Thanks for reply.I think these "Failed to process selector key" errors
>> cause
>> by the manual halt of my test application.I don't think network is a
>> problem.Since my test cases show that some operations cause trouble while
>> some others work fine.
>>
>>
>> ilya.kasnacheev wrote
>> > Hello!
>> >
>> > I can see multiple "Failed to process selector key" errors in your log.
>> > Are
>> > you sure that your nodes can communicate via network freely and without
>> > delay?
>> >
>> > Regards,
>> > --
>> > Ilya Kasnacheev
>> >
>> >
>> > ср, 16 янв. 2019 г. в 10:21, yangjiajun <
>>
>> > 1371549332@
>>
>> >>:
>> >
>> >> Hello.
>> >>
>> >> Please see the logs.
>> >>
>> >> ignite-8bdefd7a.zip
>> >> <
>> >>
>> http://apache-ignite-users.70518.x6.nabble.com/file/t2059/ignite-8bdefd7a.zip
>> >
>> >>
>> >>
>> >>
>> >> ilya.kasnacheev wrote
>> >> > Hello!
>> >> >
>> >> > Can you provide logs?
>> >> >
>> >> > Regards,
>> >> > --
>> >> > Ilya Kasnacheev
>> >> >
>> >> >
>> >> > вс, 13 янв. 2019 г. в 18:05, yangjiajun <
>> >>
>> >> > 1371549332@
>> >>
>> >> >>:
>> >> >
>> >> >> Hello.
>> >> >>
>> >> >> I have a ignite 2.7 node with persistence enabled.I test concurrent
>> >> merge
>> >> >> into operations on it and find below concurrent operations can
>> cause
>> >> >> critical system error:
>> >> >> 1.Thread 1 executes "merge INTO city2(id,name,name1)
>> >> >> VALUES(1,'1','1'),(2,'1','1'),(3,'1','1')".
>> >> >> 2.Thread 2 executes "merge INTO city2(id,name,name1)
>> >> >> VALUES(2,'1','1'),(1,'1','1')".
>> >> >>
>> >> >> But the following concurrent operations seem no problem:
>> >> >> 1.Thread 1 executes "merge INTO city2(id,name,name1)
>> >> >> VALUES(1,'1','1'),(2,'1','1'),(3,'1','1')".
>> >> >> 2.Thread 2 executes "merge INTO city2(id,name,name1)
>> >> >> VALUES(1,'1','1'),(2,'1','1')".
>> >> >>
>> >> >> Is this a bug?
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>> >> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>> >>
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/