From dev-return-64903-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Tue Apr 3 14:30:48 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3274818064D for ; Tue, 3 Apr 2018 14:30:48 +0200 (CEST) Received: (qmail 18828 invoked by uid 500); 3 Apr 2018 12:30:47 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 18800 invoked by uid 99); 3 Apr 2018 12:30:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Apr 2018 12:30:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 65B6DE0627; Tue, 3 Apr 2018 12:30:46 +0000 (UTC) From: clebertsuconic To: dev@activemq.apache.org Reply-To: dev@activemq.apache.org References: In-Reply-To: Subject: [GitHub] activemq-artemis pull request #1986: ARTEMIS-1653 Allow database tables to b... Content-Type: text/plain Message-Id: <20180403123046.65B6DE0627@git1-us-west.apache.org> Date: Tue, 3 Apr 2018 12:30:46 +0000 (UTC) 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? ---