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

Destination Snowflake: Use safe executeMetadataQuery call #37857

Merged
merged 2 commits into from
May 6, 2024

Conversation

gisripa
Copy link
Contributor

@gisripa gisripa commented May 6, 2024

What

database.getMetadata() recycles the underlying connection object back into the pool (in hikari land) after the method call returns. DbMetadata holds an instance copy of that connection object and any subsequent calls which yield a ResultSet could potentially deadlock other calls using the same connection. This was already fixed in JdbcDestinationHandler but this call was missed out.

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

@gisripa gisripa requested a review from a team as a code owner May 6, 2024 20:55
Copy link

vercel bot commented May 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 9:48pm

Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

ffs

@edgao
Copy link
Contributor

edgao commented May 6, 2024

doublechecking: resultSet.getMetadata() is safe? b/c presumably we're already inside a database.query() block

(we have a few rs.getmetadata calls in various places)

@gisripa
Copy link
Contributor Author

gisripa commented May 6, 2024

doublechecking: resultSet.getMetadata() is safe? b/c presumably we're already inside a database.query() block

(we have a few rs.getmetadata calls in various places)

Yeah, as long as the rs is in try-with or .use{} we are good. db.getMetadata should be wiped but sources use it for static information like getQuoteLiteral etc

Comment on lines +136 to +138
LOGGER.info("Retrieving table from Db metadata: {} {}",
id.getRawNamespace(),
id.getRawName());
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for logging (for now)

@octavia-squidington-iii octavia-squidington-iii added the area/documentation Improvements or additions to documentation label May 6, 2024
@gisripa gisripa merged commit 3cca1c0 into master May 6, 2024
31 checks passed
@gisripa gisripa deleted the gireesh/snowflake-minor-fix branch May 6, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/destination/snowflake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants