activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuconic <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1986: ARTEMIS-1653 Allow database tables to b...
Date Tue, 03 Apr 2018 12:30:46 GMT
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1986#discussion_r178806417
  
    --- Diff: artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/drivers/AbstractJDBCDriver.java
---
    @@ -191,9 +191,18 @@ private void createTableIfNotExists(String tableName, String... sqls)
throws SQL
                 } else {
                    try (Statement statement = connection.createStatement();
                          ResultSet cntRs = statement.executeQuery(sqlProvider.getCountJournalRecordsSQL()))
{
    -                  if (rs.next() && rs.getInt(1) > 0) {
    +                  int rows;
    +                  if (cntRs.next() && (rows = cntRs.getInt(1)) > 0) {
                          logger.tracef("Table %s did exist but is not empty. Skipping initialization.",
tableName);
    +                     if (logger.isDebugEnabled()) {
    +                        final long expectedRows = Stream.of(sqls).map(String::toUpperCase).filter(sql
-> sql.contains("INSERT INTO")).count();
    --- End diff --
    
    Are you sure you meant this INSERT to only happen if debug?


---

Mime
View raw message