[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-30 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=518066=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-518066
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 30/Nov/20 18:20
Start Date: 30/Nov/20 18:20
Worklog Time Spent: 10m 
  Work Description: belugabehr merged pull request #1704:
URL: https://github.com/apache/hive/pull/1704


   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 518066)
Time Spent: 1h 20m  (was: 1h 10m)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=517215=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517215
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 27/Nov/20 02:18
Start Date: 27/Nov/20 02:18
Worklog Time Spent: 10m 
  Work Description: belugabehr commented on pull request #1704:
URL: https://github.com/apache/hive/pull/1704#issuecomment-734539984


   Thanks @miklosgergely for the review.  Can you please take a look once more? 
I believe I've addressed your comments.



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 517215)
Time Spent: 1h 10m  (was: 1h)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=517214=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517214
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 27/Nov/20 02:17
Start Date: 27/Nov/20 02:17
Worklog Time Spent: 10m 
  Work Description: belugabehr commented on a change in pull request #1704:
URL: https://github.com/apache/hive/pull/1704#discussion_r531349263



##
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:
   Fixed.  Thanks!





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 517214)
Time Spent: 1h  (was: 50m)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=517001=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517001
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 26/Nov/20 11:09
Start Date: 26/Nov/20 11:09
Worklog Time Spent: 10m 
  Work Description: miklosgergely commented on a change in pull request 
#1704:
URL: https://github.com/apache/hive/pull/1704#discussion_r530952029



##
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\" = ?";
+final String upd_sql = "update \"SEQUENCE_TABLE\" set \"NEXT_VAL\" = ? 
where \"SEQUENCE_NAME\" = ?";
+
+final String sou_sql = sqlGenerator.addForUpdateClause(seq_sql);

Review comment:
   Please use camelCase for variables within a function.





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 517001)
Time Spent: 50m  (was: 40m)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=517000=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517000
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 26/Nov/20 11:08
Start Date: 26/Nov/20 11:08
Worklog Time Spent: 10m 
  Work Description: 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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 517000)
Time Spent: 40m  (was: 0.5h)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-25 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=516777=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-516777
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 25/Nov/20 17:01
Start Date: 25/Nov/20 17:01
Worklog Time Spent: 10m 
  Work Description: belugabehr opened a new pull request #1704:
URL: https://github.com/apache/hive/pull/1704


   
   
   ### What changes were proposed in this pull request?
   
   
   
   ### Why are the changes needed?
   
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   
   
   ### How was this patch tested?
   
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 516777)
Time Spent: 0.5h  (was: 20m)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-25 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=516776=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-516776
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 25/Nov/20 17:00
Start Date: 25/Nov/20 17:00
Worklog Time Spent: 10m 
  Work Description: belugabehr closed pull request #1704:
URL: https://github.com/apache/hive/pull/1704


   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 516776)
Time Spent: 20m  (was: 10m)

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24424) Use PreparedStatements in DbNotificationListener getNextNLId

2020-11-24 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24424?focusedWorklogId=516302=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-516302
 ]

ASF GitHub Bot logged work on HIVE-24424:
-

Author: ASF GitHub Bot
Created on: 24/Nov/20 18:42
Start Date: 24/Nov/20 18:42
Worklog Time Spent: 10m 
  Work Description: belugabehr opened a new pull request #1704:
URL: https://github.com/apache/hive/pull/1704


   
   
   ### What changes were proposed in this pull request?
   
   
   
   ### Why are the changes needed?
   
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   
   
   ### How was this patch tested?
   
   



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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 516302)
Remaining Estimate: 0h
Time Spent: 10m

> Use PreparedStatements in DbNotificationListener getNextNLId
> 
>
> Key: HIVE-24424
> URL: https://issues.apache.org/jira/browse/HIVE-24424
> Project: Hive
>  Issue Type: Improvement
>Reporter: David Mollitor
>Assignee: David Mollitor
>Priority: Minor
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Simplify the code, remove debug logging concatenation, and make it more 
> readable,



--
This message was sent by Atlassian Jira
(v8.3.4#803005)