-
Notifications
You must be signed in to change notification settings - Fork 4k
sql: default to node-level cache for sequences #148290
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
Conversation
a17b235 to
98b007a
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/sql/catalog/descpb/structured.go line 301 at r1 (raw file):
// EffectiveCacheSize evaluates the cache size fields of a sequence option. // A cache size of 1 indicates that the cache is disabled. // The session cache size takes precedence: If set and enabled, it will be the used.
super nit: "it will be the one used."
(feel free to amend this and update the PR, and merge whenever ready)
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.
there are a few things that need updating as a side effect of this:
- run
./dev gen docsto update the auto-generated syntax docs. - run
./dev test pkg/sql/opt/optbuilder -f=TestBuilder --rewriteto update an optimizer test that was affected by this. - run
./dev test pkg/sql/opt/testutils/testcat -f=TestCatalog --rewriteto update another optimizer test
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @bghal)
pkg/sql/catalog/descpb/structured.go line 301 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
super nit: "it will be the one used."
(feel free to amend this and update the PR, and merge whenever ready)
my bad -- i meant to add this comment on your first PR.
pkg/sql/show_create_clauses.go line 622 at r2 (raw file):
f.Printf(" PER SESSION CACHE %d", opts.SessionCacheSize) } else if opts.NodeCacheSize > 1 { f.Printf(" CACHE %d", opts.NodeCacheSize)
nit: let's actually keep the old formatting logic of showing PER NODE CACHE in this case. when we have the choice, we should normalize the statement to the less ambiguous form.
pkg/sql/pg_catalog.go line 4196 at r2 (raw file):
tree.NewDInt(tree.DInt(opts.Increment)), // increment_by tree.DBoolFalse, // cycle tree.NewDInt(tree.DInt(opts.SessionCacheSize)), // cache_size
nit: i think we should change this to be EffectiveCacheSize(). (this was an oversight from before your PR, but may as well fix it now.)
501c865 to
707cd79
Compare
707cd79 to
d3df1c7
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.
Reviewed 12 of 17 files at r2, 15 of 18 files at r3, all commit messages.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @bghal and @rafiss)
pkg/sql/logictest/testdata/logic_test/datetime line 2102 at r3 (raw file):
---- make_timestamptz -2013-07-15 08:15:23.5 -0500 -0500
Was this change intentional? It doesn't seem related to the sequence change. And I saw that it's causing diffs in the CI run.
pkg/sql/logictest/testdata/logic_test/alter_sequence line 42 at r3 (raw file):
SELECT nextval('foo'); ---- 17
Isn't the sequence behaviour going to stay the same? We had set the session cache before (implicilty), but now we are doing it explicitly. I'm wondering why the sequence values needed to change. I saw this is picked up as a CI diff too.
d3df1c7 to
e7cf1de
Compare
|
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
ebe1ca2 to
c640827
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @spilchen)
pkg/sql/logictest/testdata/logic_test/alter_sequence line 42 at r3 (raw file):
Previously, spilchen wrote…
Isn't the sequence behaviour going to stay the same? We had set the session cache before (implicilty), but now we are doing it explicitly. I'm wondering why the sequence values needed to change. I saw this is picked up as a CI diff too.
Yeah turns out I needed to run the rewrite again after making it explicit. The ./dev test pkg/sql/logictest/tests/local --rewrite takes >20 minutes so a bit challenging to be attentive.
pkg/sql/schemachanger/testdata/end_to_end/add_column_generated/add_column_generated.side_effects line 497 at r4 (raw file):
upsert descriptor #107 ... ownerTableId: 106
Might need to pair on this I don't really understand this side-effect.
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @bghal and @rafiss)
pkg/sql/logictest/testdata/logic_test/alter_sequence line 42 at r3 (raw file):
Previously, bghal wrote…
Yeah turns out I needed to run the rewrite again after making it explicit. The
./dev test pkg/sql/logictest/tests/local --rewritetakes >20 minutes so a bit challenging to be attentive.
I understand. If you know what logic test to rewrite, you can do so individually rather than running the entire suite. Something like this should work:
dev testlogic base --ignore-cache --files=alter_sequence --config=local --rewrite
pkg/sql/schemachanger/testdata/end_to_end/add_column_generated/add_column_generated.side_effects line 497 at r4 (raw file):
Previously, bghal wrote…
Might need to pair on this I don't really understand this side-effect.
I think this is just showing context for the diff. The only actual change in the descriptor is the version field, which behaves the same way it did before your change. The line you're seeing is just a preceding unchanged line. I'm guessing the pretty-print order shifted when you renamed cacheSize to sessionCacheSize.
The session-level cache was implemented first and shared node-level cache was added in cockroachdb#118546. The better behaving node-level cache is not the default option. Changes the default for `CACHE` option to set node-level cache. A new option to allows the session-level cache to be set. Epic: CRDB-42587 Fixes: cockroachdb#131531 Release note (sql change): Changed the basic sequence cache option to set cache at the node-level. The PER SESSION NODE sequence option (syntax is is [ PER SESSION CACHE # ]) provides the previous behavior to set session-level cache.
c640827 to
f41dde4
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.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @rafiss and @spilchen)
pkg/sql/catalog/descpb/structured.go line 301 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
my bad -- i meant to add this comment on your first PR.
Done.
pkg/sql/logictest/testdata/logic_test/alter_sequence line 42 at r3 (raw file):
Previously, spilchen wrote…
I understand. If you know what logic test to rewrite, you can do so individually rather than running the entire suite. Something like this should work:
dev testlogic base --ignore-cache --files=alter_sequence --config=local --rewrite
Done.
pkg/sql/logictest/testdata/logic_test/datetime line 2102 at r3 (raw file):
Previously, spilchen wrote…
Was this change intentional? It doesn't seem related to the sequence change. And I saw that it's causing diffs in the CI run.
Done.
a discussion (no related file):
Unclear on the failed teamcity test? I ran ./dev test //pkg/sql:sql_test -f=TestShowCreateSequence locally.
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.
Reviewed 2 of 18 files at r3, 15 of 16 files at r4, 9 of 9 files at r5, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @bghal, @michae2, and @rafiss)
a discussion (no related file):
Previously, bghal wrote…
Unclear on the failed teamcity test? I ran
./dev test //pkg/sql:sql_test -f=TestShowCreateSequencelocally.
I think it’s safe to ignore (the test doesn’t need to be clean to merge to master). It looks like a timeout and it's running under stress with race enabled. If you want to try it locally, you can use:
dev test //pkg/sql:sql_test -f=TestShowCreateSequence --race --stress
|
bors r+ |
The session-level cache was implemented first and shared node-level cache was added in #118546.
The better behaving node-level cache is not the default option.
Changes the default for
CACHEoption to set node-level cache. A new option to allows the session-level cache to be set.Epic: CRDB-42587
Fixes: #131531
Release note (sql change): Changed the basic sequence cache option to set cache at the node-level. The PER SESSION NODE sequence option (syntax is is [ PER SESSION CACHE # ]) provides the previous behavior to set session-level cache.