Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upsql: run show cluster setting in a restartable txn #30721
Conversation
jordanlewis
requested a review
from
tschottdorf
Sep 27, 2018
jordanlewis
requested review from
cockroachdb/sql-execution-prs
as
code owners
Sep 27, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordanlewis
Sep 27, 2018
Member
This is extremely science dog, but in principle I don't see any reason why it's not ok to make a new transaction here. The analogous SET CLUSTER SETTING code does it, for example.
|
This is extremely science dog, but in principle I don't see any reason why it's not ok to make a new transaction here. The analogous SET CLUSTER SETTING code does it, for example. |
tschottdorf
approved these changes
Sep 27, 2018
LGTM, but equally
Reviewed 1 of 1 files at r1, 1 of 1 files at r2.
Reviewable status:complete! 0 of 0 LGTMs obtained
jordanlewis
requested a review
from
andreimatei
Sep 27, 2018
andreimatei
reviewed
Sep 27, 2018
well so this patch introduces non-repeatable reads for transactions that call this showStateMachineSetting(). I'm not sure if it's a good idea (but I haven't checked how this function is used).
Why would we do this , exactly? Skimming through #30225, I understand that the problem is with a set statement. Can't we have that guy create new transactions for every iteration of its polling? (and also probably make that particular set statement illegal inside transactions?)
Reviewable status:
complete! 0 of 0 LGTMs obtained
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Andrei, I think the problem is only in SHOW, not in SET. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Then can you describe the problem, please? :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordanlewis
Sep 27, 2018
Member
Gossip can win against KV. If the two disagree, you need to restart your txn and check KV again. I think. Honestly, I'm not sure how these components interact exactly.
|
Gossip can win against KV. If the two disagree, you need to restart your txn and check KV again. I think. Honestly, I'm not sure how these components interact exactly. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
andreimatei
Sep 27, 2018
Member
OK, so this is about show cluster setting version. I think you want to make this statement non-transactional (i.e. make it error out if it's ran inside an explicit txn). In fact, I think we should make all show cluster setting statements non-transactional. Then this change looks fine to me (modulo the fact that I think it's missing the retries).
|
OK, so this is about |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
What do you mean you think it's missing the retries? |
andreimatei
requested changes
Sep 27, 2018
See my comment below
we used to retry on this, now we don't. Shouldn't we?
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/sql/show_cluster_setting.go, line 86 at r2 (raw file):
} if !bytes.Equal(gossipRawVal, kvRawVal) { return errors.Errorf("value differs between gossip (%v) and KV (%v); try again later (%v after %s)", gossipObj, kvObj, retryCtx.Err(), timeutil.Since(tBegin))
we used to retry on this, now we don't. Shouldn't we?
jordanlewis
reviewed
Oct 3, 2018
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/sql/show_cluster_setting.go, line 86 at r2 (raw file):
Previously, andreimatei (Andrei Matei) wrote…
we used to retry on this, now we don't. Shouldn't we?
Yes I suppose we should. Is the right way to do that to keep the outer Retry that I deleted and embed this Txn call within? Also, I don't understand what the last WithMaxAttempts was for - it seems to have been set to MaxInt32 retries.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
PTAL @andreimatei |
andreimatei
approved these changes
Oct 11, 2018
LGTM
But what did you think about disallowing show cluster setting in a txn?
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/sql/show_cluster_setting.go, line 23 at r3 (raw file):
"strings" "time"
extra line
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordanlewis
Oct 11, 2018
Member
But what did you think about disallowing show cluster setting in a txn?
What's the point? I guess to just prevent people from being confused? If we're doing this, I think we should do them all at once - and if that's the case, not in this PR.
What's the point? I guess to just prevent people from being confused? If we're doing this, I think we should do them all at once - and if that's the case, not in this PR. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
TFTR! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
bot
pushed a commit
that referenced
this pull request
Oct 11, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
andreimatei
Oct 11, 2018
Member
The point is that this patch has made show cluster setting non-transactional, as in non-repeatable read anomaly. Isn't that a biggie?
|
The point is that this patch has made |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jordanlewis
Oct 11, 2018
Member
Doesn't feel like a biggie to me. We have other things like that, such as schema changes, don't we?
|
Doesn't feel like a biggie to me. We have other things like that, such as schema changes, don't we? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
andreimatei
Oct 11, 2018
Member
Schema changes are special beasts indeed, but I don't quite see the analogy. The atomicity of schema changes is questionable, leading to write-skew type anomalies, but that's different (even schema changes outside of txns would have that problem).
|
Schema changes are special beasts indeed, but I don't quite see the analogy. The atomicity of schema changes is questionable, leading to write-skew type anomalies, but that's different (even schema changes outside of txns would have that problem). |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
craig
bot
commented
Oct 11, 2018
Build succeeded |
craig
bot
merged commit 90568da
into
cockroachdb:master
Oct 11, 2018
This was referenced Oct 11, 2018
jordanlewis
deleted the
jordanlewis:restart-show-cluster-setting-txm
branch
Oct 12, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
this needs a backport if you claim it fixes #28879. |
jordanlewis commentedSep 27, 2018
Previously, SHOW CLUSTER SETTING would run in the parent txn. This was
troublesome because if it misses a KV update once (due to an older txn
timestamp), it'll miss it in perpetuity.
Now, we make a fresh transaction for the kv read, and allow it to
restart.
Closes #30225.
Release note: None