-
Notifications
You must be signed in to change notification settings - Fork 2.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
Improved Compatibility Around LAST_INSERT_ID #17408
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
… modified Signed-off-by: Harshit Gangal <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Harshit Gangal <[email protected]>
…nish early when limiting row count Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Signed-off-by: Andres Taylor <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17408 +/- ##
========================================
Coverage 67.63% 67.64%
========================================
Files 1581 1581
Lines 253860 254002 +142
========================================
+ Hits 171708 171809 +101
- Misses 82152 82193 +41 ☔ View full report in Codecov by Sentry. |
if opts != nil { | ||
opts.FetchLastInsertId = fetchLastInsertID | ||
} else if fetchLastInsertID { | ||
opts = &querypb.ExecuteOptions{FetchLastInsertId: fetchLastInsertID} | ||
} | ||
|
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.
if opts != nil { | |
opts.FetchLastInsertId = fetchLastInsertID | |
} else if fetchLastInsertID { | |
opts = &querypb.ExecuteOptions{FetchLastInsertId: fetchLastInsertID} | |
} | |
if opts == nil && fetchLastInsertID { | |
opts = &querypb.ExecuteOptions{FetchLastInsertId: fetchLastInsertID} | |
} | |
ctx := utils.LeakCheckContext(t) | ||
|
||
createSandbox(ks) | ||
hc := discovery.NewFakeHealthCheck(nil) | ||
sc := newTestScatterConn(ctx, hc, newSandboxForCells(ctx, []string{"aa"}), "aa") | ||
sbc0 := hc.AddTestTablet("aa", "0", 1, ks, "0", topodatapb.TabletType_PRIMARY, true, 1, nil) | ||
sbc1 := hc.AddTestTablet("aa", "1", 1, ks, "1", topodatapb.TabletType_PRIMARY, true, 1, nil) | ||
|
||
rss := []*srvtopo.ResolvedShard{{ | ||
Target: &querypb.Target{ | ||
Keyspace: ks, | ||
Shard: "0", | ||
TabletType: topodatapb.TabletType_PRIMARY, | ||
}, | ||
Gateway: sbc0, | ||
}, { | ||
Target: &querypb.Target{ | ||
Keyspace: ks, | ||
Shard: "1", | ||
TabletType: topodatapb.TabletType_PRIMARY, | ||
}, | ||
Gateway: sbc1, | ||
}} | ||
queries := []*querypb.BoundQuery{{ | ||
Sql: "query1", | ||
BindVariables: map[string]*querypb.BindVariable{ | ||
"bv0": sqltypes.Int64BindVariable(0), | ||
}, | ||
}, { | ||
Sql: "query2", | ||
BindVariables: map[string]*querypb.BindVariable{ | ||
"bv1": sqltypes.Int64BindVariable(1), | ||
}, | ||
}} |
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.
nit: could be outside the test block run method
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.
looks good, left few comments
Description
This PR improves
last_insert_id(x)
behavior to align more closely with MySQL in various scenarios.Key changes
fetch_last_insert_id
FieldIntroduced a boolean field, fetch_last_insert_id, in the ExecuteOptions proto.
SELECT last_insert_id()
query immediately after executing a query containing alast_insert_id(x)
expression.sqltypes.Result
UpdatesInsertIDChanged
.0
LIMIT
Behavior:LIMIT
to ensure all input rows are received when expectinglast_insert_id
values.More changes around this are coming.
Related Issue(s)
Fixes #17298
Checklist