Я использую crateDB
драйвер Java (crate-jdbc-2.2.0.jar
) для выполнения пакетной вставки в crate DB
.Вставки идут гладко.Но в некоторых случаях некоторые записи не вставляются в crate DB
.Я использую batchinsert.При печати batchInsert.executeBatch()
все возвращаются 1, что означает, что все записи вставлены успешно.Но некоторые записи отсутствуют.
Как получить соединение с crateDB:
StringBuilder primaryCrateconnBlder = new StringBuilder();
primaryCrateconnBlder.append("crate://");
primaryCrateconnBlder.append("xxx.xxxx.xxx.xx1:1111");
StringBuilder secondaryCrateconnBlder = new StringBuilder();
secondaryCrateconnBlder.append("crate://");
secondaryCrateconnBlder.append("xxx.xxxx.xxx.xx2:1111");
// Here given the comma separater cluster node but so many transactions are failed. If given single node working fine
primaryCrateconnBlder.append("/");
secondaryCrateconnBlder.append("/");
GenericObjectPool primaryConnectionPool = new GenericObjectPool();
primaryConnectionPool.setMinIdle(3);
primaryConnectionPool.setMaxIdle(5);
primaryConnectionPool.setMaxActive(this.crateConnections);
primaryConnectionPool.setMaxWait(this.cratemaxWait);
primaryConnectionPool.setTestOnBorrow(true);
ConnectionFactory primaryCrateConnectionFactory = new DriverManagerConnectionFactory(primaryCrateconnBlder.toString(), this.CrateDBUser, this.CrateDBPassword);
KeyedObjectPoolFactory primaryStmtPool = new GenericKeyedObjectPoolFactory(null);
PoolableConnectionFactory primaryPoolableConnectionFactory = new PoolableConnectionFactory(primaryCrateConnectionFactory, primaryConnectionPool, primaryStmtPool, null, false, true);
this.PrimaryCrateDBconnection = new PoolingDataSource(primaryConnectionPool);
this.PrimaryCrateDBconnection.setAccessToUnderlyingConnectionAllowed(true);
GenericObjectPool SecondaryConnectionPool = new
GenericObjectPool();
SecondaryConnectionPool.setMinIdle(3);
SecondaryConnectionPool.setMaxIdle(5);
SecondaryConnectionPool.setMaxActive(this.crateConnections);
SecondaryConnectionPool.setMaxWait(this.cratemaxWait);
SecondaryConnectionPool.setTestOnBorrow(true);
ConnectionFactory secondaryCrateConnectionFactory = new DriverManagerConnectionFactory(secondaryCrateconnBlder.toString(), this.CrateDBUser, this.CrateDBPassword);
KeyedObjectPoolFactory secondaryStmtPool = new GenericKeyedObjectPoolFactory(null);
PoolableConnectionFactory secondaryPoolableConnectionFactory = new PoolableConnectionFactory(secondaryCrateConnectionFactory, SecondaryConnectionPool, secondaryStmtPool, null, false, true);
this.SecondaryCrateDBconnection = new PoolingDataSource(SecondaryConnectionPool);
this.SecondaryCrateDBconnection.setAccessToUnderlyingConnectionAllowed(true);
Может ли кто-нибудь помочь решить проблему с отсутствующей записью?
Note:If I try to connecte crate db with comma seperator cluster node so many records are missing, so that I am going this way