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

Ignore any IDs generated by the DB #2576

Merged
merged 1 commit into from
Feb 24, 2017

Conversation

tirsen
Copy link
Collaborator

@tirsen tirsen commented Feb 21, 2017

No description provided.

@tirsen
Copy link
Collaborator Author

tirsen commented Feb 21, 2017

This is causing us issues as we need to use MySQL directly and from Vitess for a transition period.

This could possibly be a command line flag but I think it's fine to just ignore the MySQL generated ID. That's after all what MySQL does, if you provide an ID when inserting it just ignored the autoinc column.

@@ -447,9 +447,6 @@ func (route *Route) execInsertUnsharded(vcursor VCursor, queryConstruct *queryin
return nil, fmt.Errorf("execInsertUnsharded: %v", err)
}
if insertid != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@@ -722,6 +722,10 @@ func TestInsertFail(t *testing.T) {
if err == nil || !strings.HasPrefix(err.Error(), want) {
t.Errorf("routerExec: %v, want prefix %v", err, want)
}
}

func TestIgnoresAutoincGeneratedByMySQL(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also delete this test. It's essentially obsolete now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@tirsen
Copy link
Collaborator Author

tirsen commented Feb 23, 2017

Alright, comments addressed please have another look.

@sougou
Copy link
Contributor

sougou commented Feb 24, 2017

LGTM

Approved with PullApprove

@sougou sougou merged commit ae37ea0 into vitessio:master Feb 24, 2017
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.

3 participants