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
sql: enable 1PC optimization for UPSERT #13500
sql: enable 1PC optimization for UPSERT #13500
Conversation
Do we have any tests for the auto-commit code path for INSERT? A quick scan didn't reveal anything, but perhaps I just missed it. |
Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion, some commit checks pending. pkg/sql/tablewriter.go, line 466 at r1 (raw file):
Noticed we had this in Comments from Reviewable |
No we don't have separate tests for the INSERT auto-commit apparently. Reviewed 2 of 2 files at r1. pkg/sql/tablewriter.go, line 466 at r1 (raw file): Previously, petermattis (Peter Mattis) wrote…
yeah as long as we don't allow upsert/update to update the PKs this check here is not strictly necessary. Comments from Reviewable |
my upsert test is going in as soon as teamcity finishes if you want to piggy back on that test. seems like that would work Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/sql/tablewriter.go, line 466 at r1 (raw file): Previously, knz (kena) wrote…
correct. the fast path doesn't use cput and can't change a pk Comments from Reviewable |
d3793d2
to
e8c0c38
Compare
Enhanced PTAL Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion. pkg/sql/tablewriter.go, line 466 at r1 (raw file): Previously, danhhz (Daniel Harrison) wrote…
Ok, the call to Comments from Reviewable |
Review status: 1 of 3 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. pkg/sql/tablewriter.go, line 335 at r2 (raw file):
I think this one is not safe. In theory, flush is called once per N rows processed by upsert (though it seems actually doing this got left as a TODO). This would commit the txn and then try to keep using it, which IIUC is not okay pkg/sql/upsert_test.go, line 105 at r2 (raw file):
we should probably add one that does expect a begin-txn Comments from Reviewable |
e8c0c38
to
c87eda1
Compare
When an UPSERT is being run as part of an auto-commit transaction, commit the transaction when running the batch.
c87eda1
to
9dbce65
Compare
Review status: 1 of 3 files reviewed at latest revision, 3 unresolved discussions. pkg/sql/tablewriter.go, line 335 at r2 (raw file): Previously, danhhz (Daniel Harrison) wrote…
I've added a pkg/sql/upsert_test.go, line 105 at r2 (raw file): Previously, danhhz (Daniel Harrison) wrote…
Done. Comments from Reviewable |
Review status: 1 of 3 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. Comments from Reviewable |
When an UPSERT is being run as part of an auto-commit transaction,
commit the transaction when running the batch.
This change is