Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1822#discussion_r178098492
--- Diff:
artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java
---
@@ -189,17 +187,27 @@ private static void createTableIfNotExists(Connection
connection,
if (sqlWarning != null) {
logger.warn(JDBCUtils.appendSQLExceptionDetails(new
StringBuilder(), sqlWarning));
}
- try (Statement statement = connection.createStatement()) {
- for (String sql : sqls) {
- statement.executeUpdate(sql);
- final SQLWarning statementSqlWarning =
statement.getWarnings();
- if (statementSqlWarning != null) {
-
logger.warn(JDBCUtils.appendSQLExceptionDetails(new StringBuilder(),
statementSqlWarning, sql));
- }
+ } else {
+ try (Statement statement = connection.createStatement();
+ ResultSet cntRs =
statement.executeQuery(sqlProvider.getCountJournalRecordsSQL())) {
+ if (rs.next() && rs.getInt(1) > 0) {
--- End diff --
@nlippke @clebertsuconic has fixed the failed test by changing it but there
are now new ERROR logs on each test, like:
```
[main] 17:39:46,342 ERROR
[org.apache.activemq.artemis.jdbc.store.drivers.AbstractJDBCDriver]
SQL STATEMENTS:
INSERT INTO NODE_MANAGER_STORE (ID) VALUES (3)
INSERT INTO NODE_MANAGER_STORE (ID) VALUES (0)
INSERT INTO NODE_MANAGER_STORE (ID) VALUES (1)
INSERT INTO NODE_MANAGER_STORE (ID) VALUES (2)
SQL EXCEPTIONS:
SQLState: 23505 ErrorCode: 20000 Message: The statement was aborted because
it would have caused a duplicate key value in a unique or primary key
constraint or unique index identified by 'SQL180329173946240' defined on
'NODE_MANAGER_STORE'.
```
I will be able to return on it from 3 April, but feel free to give it a
look, because it seems related to this PR.
---