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: Remove SNAPSHOT isolation #27040
Conversation
Probably @andreimatei can review the changed test. Reviewed 13 of 13 files at r1. Comments from Reviewable |
LGTM Reviewed 1 of 13 files at r1. pkg/sql/lease_test.go, line 865 at r1 (raw file):
wasn't this comment relevant? Does the test test what it's supposed to test now? Like, does the error the txn receives on the first pkg/sql/lease_test.go, line 870 at r1 (raw file):
this can go away since you're here. Timestamps are now assigned when the txn is created. pkg/sql/sem/tree/txn.go, line 40 at r1 (raw file):
consider getting rid of this map, or at least turning it into a set Comments from Reviewable |
Review status: complete! 1 of 0 LGTMs obtained pkg/sql/lease_test.go, line 865 at r1 (raw file): Previously, andreimatei (Andrei Matei) wrote…
You're right, this test isn't testing what it used to. I was having a hard time figuring out how to generate the deadline-exceeded error in a serializable transaction, but fortunately @vivekmenezes already did in #23681 (which never got reviewed/merged). I'm going to cherry-pick that change into this branch. Comments from Reviewable |
ea06958
to
5354e8e
Compare
OK, I've replaced the Review status: complete! 0 of 0 LGTMs obtained (and 1 stale) Comments from Reviewable |
Review status: complete! 0 of 0 LGTMs obtained (and 2 stale) pkg/sql/lease_test.go, line 888 at r2 (raw file):
make this take pkg/sql/lease_test.go, line 931 at r2 (raw file):
long line pkg/sql/lease_test.go, line 948 at r2 (raw file):
nit: pkg/sql/lease_test.go, line 959 at r2 (raw file):
pls say something about this pkg/sql/lease_test.go, line 970 at r2 (raw file):
I don't get what's the difference between this txn that gets the deadline error (so span refresh succeeds) and Comments from Reviewable |
removes the use of SNAPSHOT ISOLATION in the test. Tests read-only, write-only, and read-write transaction scenarios. Release note: None
The SNAPSHOT isolation level is no longer accessible from SQL. Requests for SNAPSHOT will be remapped to SERIALIZABLE (in the same way that the other ANSI levels already are). KV-level support will remain through the next release cycle to support transactions that began during a rolling upgrade. Fixes cockroachdb#26475 Release note (sql change): The SNAPSHOT isolation level has been removed. Transactions that request to use it are now mapped to SERIALIZABLE.
5354e8e
to
07f583e
Compare
Review status: complete! 0 of 0 LGTMs obtained (and 2 stale) pkg/sql/lease_test.go, line 888 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/lease_test.go, line 931 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Done. pkg/sql/lease_test.go, line 959 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
I think this pkg/sql/lease_test.go, line 970 at r2 (raw file): Previously, andreimatei (Andrei Matei) wrote…
I think the difference is in the schema changes: the backfill process/state machine for index changes is different from the one for adding a column. If I change This test needs some more documentation and should probably be refactored so all the different schema changes are handled through one loop with different expectations. But I'm not confident I understand what's going on here well enough to do that, so I'd like to go ahead and merge this and leave the cleanup to @vivekmenezes. Comments from Reviewable |
merge at will Review status: complete! 0 of 0 LGTMs obtained (and 2 stale) Comments from Reviewable |
bors r+ |
Timed out (retrying...) |
Build failed (retrying...) |
27034: sql: turn on the optimizer for PREPARE statements r=benesch a=BramGruneir The optimizer, when enabled, was not used for prepare statements. This patch fixes that. It should be noted that PREPARE has a limited subset of statements it can be run with. Postgres only allows SELECT, INSERT, UPDATE, DELETE and VALUES statements to be prepared. See: https://www.postgresql.org/docs/current/static/sql-prepare.html However, we allow a large number of additional statements. As of right now, the optimizer only works on SELECT statements and will fallback for all others, so this change should be safe for the foreseeable future. Closes #26958. Release note (sql change): When the cost based optimizer is enabled, it will also affect prepared queries. 27040: sql: Remove SNAPSHOT isolation r=bdarnell a=bdarnell The SNAPSHOT isolation level is no longer accessible from SQL. Requests for SNAPSHOT will be remapped to SERIALIZABLE (in the same way that the other ANSI levels already are). KV-level support will remain through the next release cycle to support transactions that began during a rolling upgrade. Fixes #26475 Release note (sql change): The SNAPSHOT isolation level has been removed. Transactions that request to use it are now mapped to SERIALIZABLE. The change in `lease_test.go` is the most complicated part here - I tried to adapt the test to a serializable transaction, but it's possible I misunderstood the intent of the test. I left tests that used `BEGIN TRANSACTION SNAPSHOT` in place to ensure this syntax still works, and just changed the tests to reflect the new behavior of `SHOW transaction_isolation`. While making this change I found that the previous change to map all the ANSI isolation levels to SERIALIZABLE was incomplete. There were some paths (such as `SET default_transaction_isolation`) that still used the old mapping of `READ COMMITTED` to `SNAPSHOT`. Also fixes a bug in `SET transaction_isolation='serializable'`, which was previously setting `snapshot` instead. Co-authored-by: Bram Gruneir <bram@cockroachlabs.com> Co-authored-by: Vivek Menezes <vivek@cockroachlabs.com> Co-authored-by: Ben Darnell <ben@cockroachlabs.com>
Build succeeded |
The SNAPSHOT isolation level is no longer accessible from SQL.
Requests for SNAPSHOT will be remapped to SERIALIZABLE (in the same
way that the other ANSI levels already are).
KV-level support will remain through the next release cycle to support
transactions that began during a rolling upgrade.
Fixes #26475
Release note (sql change): The SNAPSHOT isolation level has been
removed. Transactions that request to use it are now mapped to
SERIALIZABLE.
The change in
lease_test.go
is the most complicated part here - I tried to adapt the test to a serializable transaction, but it's possible I misunderstood the intent of the test.I left tests that used
BEGIN TRANSACTION SNAPSHOT
in place to ensure this syntax still works, and just changed the tests to reflect the new behavior ofSHOW transaction_isolation
.While making this change I found that the previous change to map all the ANSI isolation levels to SERIALIZABLE was incomplete. There were some paths (such as
SET default_transaction_isolation
) that still used the old mapping ofREAD COMMITTED
toSNAPSHOT
.Also fixes a bug in
SET transaction_isolation='serializable'
, which was previously settingsnapshot
instead.