[
https://issues.apache.org/jira/browse/PHOENIX-7095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17785888#comment-17785888
]
ASF GitHub Bot commented on PHOENIX-7095:
-----------------------------------------
richardantal commented on code in PR #1729:
URL: https://github.com/apache/phoenix/pull/1729#discussion_r1392575597
##########
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java:
##########
@@ -720,17 +717,17 @@ public void clearWarnings() throws SQLException {
}
private void closeStatements() throws SQLException {
- List<? extends PhoenixStatement> statements = this.statements;
- // create new list to prevent close of statements
- // from modifying this list.
- this.statements = Lists.newArrayList();
try {
mutationState.rollback();
} catch (SQLException e) {
// ignore any exceptions while rolling back
} finally {
try {
- SQLCloseables.closeAll(statements);
+ // create new list to prevent close of statements from
modifying this collection.
+ // TODO This could be optimized out by decoupling closing the
stmt and removing it
+ // from the connection.
+ List<? extends PhoenixStatement> statementsCopy = new
ArrayList<>(this.statements);
Review Comment:
Is there a reason why the statements got changed to HashSet?
This copy is a list and it is not consistent this way.
> Implement Statement.closeOnCompletion() and fix related close() bugs
> --------------------------------------------------------------------
>
> Key: PHOENIX-7095
> URL: https://issues.apache.org/jira/browse/PHOENIX-7095
> Project: Phoenix
> Issue Type: Bug
> Components: core
> Affects Versions: 5.2.0, 5.1.3
> Reporter: Istvan Toth
> Assignee: Istvan Toth
> Priority: Major
>
> Umbrella ticket, so that the three dependent tickets can be fixed in a single
> commit.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)