[ https://issues.apache.org/jira/browse/PHOENIX-5982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17149679#comment-17149679 ]
Chinmay Kulkarni commented on PHOENIX-5982: ------------------------------------------- [~shahrs87] this is because we update these metrics inside PhoenixResultSet.close() [here|https://github.com/apache/phoenix/blob/dcc88af8acc2ba8df10d2e9d498ab3646fdf0a78/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java#L214-L215] already, so this would not be an issue for point lookups. If however, we were calling getOverAllRequestReadMetrics() and updating that only inside next() when currentRow==null rather than inside close(), that would have been an issue. I observed this happening at $dayJob and hence opened this Jira without checking if this is done in OSS. Turns out it is not done so this is not an issue > Overall query metrics not updated if rs.next is called just once > ---------------------------------------------------------------- > > Key: PHOENIX-5982 > URL: https://issues.apache.org/jira/browse/PHOENIX-5982 > Project: Phoenix > Issue Type: Improvement > Affects Versions: 4.15.0 > Reporter: Chinmay Kulkarni > Priority: Major > Labels: phoenix-hardening, quality-improvement > Fix For: 4.16.0 > > > The generic method to issue queries is a variation of the following: > {code:java} > try (Connection conn = DriverManager.getConnection(url); > Statement stmt = conn.createStatement()) { > ResultSet rs = stmt.executeQuery("select * from t"); > while(rs.next()) { > // do something > } > } > {code} > However, a client that issues a point lookup may just call rs.next() without > the while loop. In that case, overallQueryMetrics will not be updated due to > the current logic (see > [this|https://github.com/apache/phoenix/blob/dcc88af8acc2ba8df10d2e9d498ab3646fdf0a78/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java#L878-L881]). > In this case, it may be better to move this logic to PhoenixResultSet.close() > which is a more obvious restriction we can impose on end-client behavior as > opposed to a seemingly unnecessary while loop. -- This message was sent by Atlassian Jira (v8.3.4#803005)