-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Ensure that jdbc temp tables can be dropped if the insertions fail #19368
Conversation
96fb94a
to
a9ab48a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have a test?
plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/BaseJdbcClient.java
Show resolved
Hide resolved
@kokosing Sorry i didn't figure out a good way to mock the jdbc insertion failure, it seems that we need to implement |
Thanks @hackeryang |
Description
We use Trino to query and insert mysql tables, and one day we found that our MySQL appeared many temp tables which were created long time ago as shown below:
After reading relevant source codes, we found that this place may cause a bug:
If the execution of the statement
pageSinkInsertSql
fails inconstructPageSinkIdsTable()
, thecloser.register(() -> dropTable(session, pageSinkTable, true))
infinishInsertTable()
won't be executed, and will directly jump to thefinally
code block to executecloser.close()
, which only hascloser.register(() -> dropTable(session, temporaryTable, true))
withoutpageSinkTable
.So we need to register the drop table closer before the execution of insertion statements.
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: