miklosgergely commented on a change in pull request #1704:
URL: https://github.com/apache/hive/pull/1704#discussion_r530951752
##########
File path:
hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
##########
@@ -970,28 +971,44 @@ private static void close(ResultSet rs) {
}
}
- private long getNextNLId(Statement stmt, SQLGenerator sqlGenerator, String
sequence)
+ /**
+ * Get the next notification log ID.
+ *
+ * @return The next ID to use for a notification log message
+ * @throws SQLException if a database access error occurs or this method is
+ * called on a closed connection
+ * @throws MetaException if the sequence table is not properly initialized
+ */
+ private long getNextNLId(Connection con, SQLGenerator sqlGenerator, String
sequence)
throws SQLException, MetaException {
- String s = sqlGenerator.addForUpdateClause("select \"NEXT_VAL\" from " +
- "\"SEQUENCE_TABLE\" where \"SEQUENCE_NAME\" = " +
quoteString(sequence));
- LOG.debug("Going to execute query <" + s + ">");
- ResultSet rs = null;
- try {
- rs = stmt.executeQuery(s);
- if (!rs.next()) {
- throw new MetaException("Transaction database not properly configured,
can't find next NL id.");
+ final String seq_sql = "select \"NEXT_VAL\" from \"SEQUENCE_TABLE\" where
\"SEQUENCE_NAME\" = ?";
Review comment:
These two are constants, please extract them.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]