Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-7316 Need close more Statements #1894

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chaijunjie0101
Copy link
Contributor

No description provided.

PreparedStatement delegateStmt = QueryUtil.getTablesStmt(stmt.getConnection(), null,
getTargetSchema(), getDbPattern(), null);
return ((PhoenixPreparedStatement) delegateStmt).compileQuery();
try (PreparedStatement delegateStmt =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is suspicious.
We keep using the query plan returned from the closed statement.

@@ -304,6 +306,14 @@ public void putMetrics(MetricsRecord record) {
} catch (SQLException e) {
LOGGER.error("Could not write metric: \n" + record + " to prepared statement:\n" + stmt,
e);
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not a simple try-with-resources ?

@@ -238,6 +239,14 @@ private void addToBatch(Span span) {
} catch (SQLException e) {
LOGGER.error("Could not write metric: \n" + span + " to prepared statement:\n" + stmt,
e);
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not simple try-with-resources?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants