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

For AutoIncrement lock modes other than "interleaved", hold the lock for the duration of the insert iter. #2439

Merged
merged 4 commits into from Apr 10, 2024

Conversation

nicktobey
Copy link
Contributor

This is the GMS side of dolthub/dolt#7634

This PR changes the engine to make it acquire a lock (provided by the storage layer) when innodb_autoinc_lock_mode is set to the "consecutive" or "traditional" values. More specifically, it calls a new function in the AutoIncrementSetter interface which optionally acquires a lock and returns a callback for releasing the lock.

The in-memory DB doesn't have multithreading support, so when just using GMS, this is a no-op. A followup PR in Dolt will update its implementation of AutoIncrementSetter to handle the locking.

… into a table with an unspecified auto-increment column, acquire a lock when the iterator is created, and release the lock when the iterator is closed.

For the in-memory db, this is a no-op because it doesn't have a lock on generating AutoIncrement values. But Dolt has its own AutoIncrement Tracker, which will supply the lock.
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple minor comments.

sql/variables/system_variables.go Outdated Show resolved Hide resolved
sql/rowexec/dml.go Outdated Show resolved Hide resolved
sql/rowexec/dml.go Outdated Show resolved Hide resolved
@nicktobey nicktobey merged commit b53360b into main Apr 10, 2024
7 checks passed
@nicktobey nicktobey deleted the nicktobey/autoinc branch April 10, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants