-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
implement implicit commits and fix import behavior #8767
Conversation
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.
LGTM
line := 1 | ||
// If there were create table statements, they are automatically committed, so we need to start a new transaction | ||
if s.importOption == CreateOp { | ||
_, _, _, err = s.se.Query(s.sqlCtx, "START TRANSACTION") |
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.
Always drain the row iter for these things, we often don't throw any error until iteration or even Close()
// quitting import that created table, should drop table | ||
if s.importOption == CreateOp { | ||
var err error | ||
_, _, _, err = s.se.Query(s.sqlCtx, fmt.Sprintf("DROP TABLE IF EXISTS `%s`", s.tableName)) |
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.
Same comment
@coffeegoddd DOLT
|
This PR implements the implicit commit logic introduced in this PR dolthub/go-mysql-server#2818
On error,
dolt table import -c
does not create the table, and we did that by simply rolling back the existing transaction.Since DDL statements now implcitly
COMMIT
, we need to start a new transaction, and possibly drop any tables created.fixes #7485
maybe fixes: #8716