Skip to content

Oracle turns off auto commit to drop temporary table#17756

Merged
losipiuk merged 1 commit intotrinodb:masterfrom
mwd410:mdeady-oracle-drop-autocommit
Jun 6, 2023
Merged

Oracle turns off auto commit to drop temporary table#17756
losipiuk merged 1 commit intotrinodb:masterfrom
mwd410:mdeady-oracle-drop-autocommit

Conversation

@mwd410
Copy link
Copy Markdown
Contributor

@mwd410 mwd410 commented Jun 5, 2023

Description

This is hopefully the final battle with Oracle to drop our temporary tables correctly, related to #16277

In my last PR, I forgot about the whole concept of auto commit. The result was the lock we acquired before the drop table was immediately released and had no effect.

Additional context and related issues

Release notes

(X) This is not user-visible or 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:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jun 5, 2023
@mwd410 mwd410 requested a review from losipiuk June 5, 2023 14:11
@mwd410 mwd410 force-pushed the mdeady-oracle-drop-autocommit branch from 425202f to be38003 Compare June 5, 2023 14:12
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is the last operation on connection - why switch back?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is answered by my most recent response in the other thread

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what is the motivation behind the change? Should we commit explicitly then? Or was switching auto-commit back to true just before connection is closed for that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see:

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add a comment below - or just call commit() - will be more readable I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The motivation is that, because autoCommit is true when we get the Connection, the lock is immediately released because that LOCK TABLE statement is auto-committed, so the Connection has to re-acquire the lock for the DROP TABLE, so we have the same situation as we did before. Turning off auto commit holds onto that lock until after the drop table. Oracle's docs say DDL always auto-commits, but I reset autoCommit to true after the drop just in case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, weird - when i typed out my reply, i only had your first comment in this thread visible to me.

I think i want to keep it as setAutoCommit(true) as it properly handles both cases:
image

@mwd410 mwd410 requested a review from losipiuk June 5, 2023 16:03
@mwd410 mwd410 force-pushed the mdeady-oracle-drop-autocommit branch from be38003 to 397c9f5 Compare June 5, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants