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: error in cluster_logical_timestamp when not SERIALIZABLE #107090
sql: error in cluster_logical_timestamp when not SERIALIZABLE #107090
Conversation
31c798a
to
218d71e
Compare
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.
very nice! just some minor comments
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @chrisseto)
pkg/sql/sem/eval/context.go
line 543 at r2 (raw file):
// a pgerror until we decide how this will officially behave. See #103245. if ec.TxnIsoLevel.ToleratesWriteSkew() { return nil, pgerror.Newf(pgcode.FeatureNotSupported, "unsupported in %s isolation", ec.TxnIsoLevel.String())
super nit: could you use kvTxnIsolationLevelToTree(ec.TxnIsoLevel).String()
. we have this bit of translation to keep the user-facing grammar separate from the internals of KV, and it has slightly more familiar string formatting.
pkg/sql/logictest/testdata/logic_test/txn
line 1536 at r2 (raw file):
statement error pq: cluster_logical_timestamp\(\): unsupported in ReadCommitted isolation BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED; SELECT cluster_logical_timestamp();
nit: this should have a
statement ok
ROLLBACK
after this
218d71e
to
738f426
Compare
f73f27b
to
b4f6ab9
Compare
@rafiss could you point me in the right direction WRT the failing logic test? Seems like the test might be flake depending on which node you're executing against? If there's a way to read back the actual isolation level, we could skip the test if it isn't running at READ COMMITTED or we could gate the functionality on a specific version?
|
Yes I can help for sure. The issue with this failure is:
To interpret that a bit, this is saying that the cockroach/pkg/sql/logictest/logictestbase/logictestbase.go Lines 471 to 478 in 4618dbf
The test configuration uses a current binary, but a "logical cluster version" from the previous release. This is so that it tests the mixed-version state of a CRDB cluster, which occurs during the process of an online upgrade. One of the things that we did for the READ COMMITTED project is we added a version gate so that READ COMMITTED can only be used if the cluster upgrade was finalized, and the cluster is no longer in a mixed version state. Otherwise, it falls back to the old behavior of automatically promoting READ COMMITTED to the SERIALIZABLE level. That gate is in this function: cockroach/pkg/sql/conn_executor.go Line 3389 in 4618dbf
To put this all together, the issue you are seeing where no error occurs is actually expected under the cockroach/pkg/sql/logictest/logic.go Lines 392 to 395 in 4618dbf
|
Previously, running `cluster_logical_timestamp` within an isolation level that tolerated write skew would result in an unhandled panic. This commit adds a gate at the SQL level that will instead return a FeatureNotSupported pgerror. This behavior may be permanent or may be removed once we determine how CommitTimestamp should function at these isolation levels. Epic: CRDB-26546 Part of: cockroachdb#103245 Release note (sql change): cluster_logical_timestamp now returns an error when called at isolation levels lower than SERIALIZABLE.
b4f6ab9
to
55ed31f
Compare
Thanks! This round of CI should pass now 🤞 |
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.
nice!
bors r+ |
Build succeeded: |
Previously, running
cluster_logical_timestamp
within an isolation level that tolerated write skew would result in an unhandled panic.This commit adds a gate at the SQL level that will instead return a FeatureNotSupported pgerror. This behavior may be permanent or may be removed once we determine how CommitTimestamp should function at these isolation levels.
Epic: CRDB-26546
Fixes: #103245
Release note (sql change): cluster_logical_timestamp now returns an error when called at isolation levels lower than SERIALIZABLE.