Skip to content
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: optimizer always on #39439

Merged
merged 2 commits into from
Aug 8, 2019
Merged

Conversation

RaduBerinde
Copy link
Member

sql, workload: don't disable the optimizer in tests

In preparation for removing the possibility of turning off the
optimizer, adjust tests and benchmarks that are disabling the
optimizer.

Release note: None

sql: optimizer always on

This change deprecates the optimizer session setting and associated
cluster setting. It is no longer possible to disable the optimizer.
The settings still exist but the only allowed value is "on" (mostly so
that SET OPTIMIZER = ON still works).

The logic test configurations are reworked: they now all use the
optimizer, and the -opt versions are gone (e.g. what used to be
local-opt is now local). The HP-specific planner tests are
removed.

Release note: None

@RaduBerinde RaduBerinde requested review from jordanlewis and knz August 8, 2019 03:18
@RaduBerinde RaduBerinde requested a review from a team as a code owner August 8, 2019 03:18
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must have been tedious. But good riddance! 💯

Reviewed 7 of 7 files at r1, 198 of 198 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @RaduBerinde)


pkg/sql/exec_util.go, line 125 at r2 (raw file):

	"on",
	map[int64]string{
		1: "on",

I think the settings machinery is not happy to see a value stored in kv that's not valid according to the map here. Not sure. In either case, maybe worth considering a migration to reset the value? Or you could remove it entirely, and add the name to retiredSettings in settings/registry.go.

In any case you should call SetDeprecated() on the setting if you keep it.


pkg/sql/logictest/testdata/logic_test/explain_analyze_plans, line 35 at r2 (raw file):


# Verify data placement.
query TTTI colnames,rowsort

Can you explain why this changed.


pkg/sql/logictest/testdata/logic_test/explain_analyze_plans, line 69 at r2 (raw file):

SELECT url FROM [EXPLAIN ANALYZE (DISTSQL) SELECT DISTINCT(kw.w) FROM kv JOIN kw ON kv.k =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u_LrXRDzO3cxy_wDupQHk3700jPHvXgulDSzVHrK0ca9nxegs3nOw0f-f49qSjgaQe7OwRuDfHXSsCRBuPKebqYACxB3feccaQYCAc3UJB6sjDtZkHGwVcixsQso_oW1CDSiATagBBcgUOkTObcOaNQFsQorioW1CDSiATagBhfizmAaRc9uwZk0Am5Dy-dAmbjQ2IWUjRzYhRZxLbMKlwasBBbAJNaAQNqFBZGgT_hC5tw0ZgZS2L7EJlzxWAwpgE2pAIWxCg8jQJvwhcm8b8u8lUk4f_vKA1TZBpHh0oU2sHn_4PwAA__-RJ7dt

And this too

Copy link
Member Author

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @knz)


pkg/sql/exec_util.go, line 125 at r2 (raw file):

Previously, knz (kena) wrote…

I think the settings machinery is not happy to see a value stored in kv that's not valid according to the map here. Not sure. In either case, maybe worth considering a migration to reset the value? Or you could remove it entirely, and add the name to retiredSettings in settings/registry.go.

In any case you should call SetDeprecated() on the setting if you keep it.

@jordanlewis what is your preference? I think I want to remove it altogether, but I can also add back the values and say in the text that it doesn't do anything anymore.


pkg/sql/logictest/testdata/logic_test/explain_analyze_plans, line 35 at r2 (raw file):

Previously, knz (kena) wrote…

Can you explain why this changed.

It's a SELECT with no ORDER BY so the optimizer doesn't guarantee any particular ordering.


pkg/sql/logictest/testdata/logic_test/explain_analyze_plans, line 69 at r2 (raw file):

Previously, knz (kena) wrote…

And this too

It's a better plan. It's faster to do a sort followed by streaming distinct than a non-streaming distinct followed by a sort.

In preparation for removing the possibility of turning off the
optimizer, adjust tests and benchmarks that are disabling the
optimizer.

Release note: None
Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 199 of 199 files at r4.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis)


pkg/sql/logictest/testdata/logic_test/explain_analyze_plans, line 35 at r2 (raw file):

Previously, RaduBerinde wrote…

It's a SELECT with no ORDER BY so the optimizer doesn't guarantee any particular ordering.

thanks

This change deprecates the `optimizer` session setting and associated
cluster setting. It is no longer possible to disable the optimizer.
The settings still exist but the only allowed value is "on" (mostly so
that `SET OPTIMIZER = ON` still works).

The logic test configurations are reworked: they now all use the
optimizer, and the `-opt` versions are gone (e.g. what used to be
`local-opt` is now `local`). The HP-specific planner tests are
removed.

Release note: None
@RaduBerinde
Copy link
Member Author

Updated to remove the cluster setting (checked offline with Jordan).

Copy link
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff :lgtm_strong:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis, @knz, and @RaduBerinde)


pkg/sql/exec_util.go, line 125 at r2 (raw file):

Previously, RaduBerinde wrote…

@jordanlewis what is your preference? I think I want to remove it altogether, but I can also add back the values and say in the text that it doesn't do anything anymore.

Yeah, I believe Raphael's right that if you upgrade into a new version with missing possible settings it will log messages about unknown cluster settings.

I'm okay with deleting this and adding to retiredSettings (which TIL exists)


pkg/sql/metric_test.go, line 72 at r4 (raw file):

		{query: "SET DISTSQL = 'off'", miscCount: 1, miscExecutedCount: 1, optCount: 1},
		{query: "BEGIN; END", txnBeginCount: 1, txnCommitCount: 1},
		{query: "SELECT 1", selectCount: 1, selectExecutedCount: 1, txnCommitCount: 1, optCount: 1},

Should we just delete optCount from these tests or is it still useful somehow?

@RaduBerinde
Copy link
Member Author


pkg/sql/metric_test.go, line 72 at r4 (raw file):

Previously, jordanlewis (Jordan Lewis) wrote…

Should we just delete optCount from these tests or is it still useful somehow?

We will want to clean up the counter itself too, we'll clean up the test at the same time.

@RaduBerinde
Copy link
Member Author

TFTRs!

bors r+

craig bot pushed a commit that referenced this pull request Aug 8, 2019
39439: sql: optimizer always on r=RaduBerinde a=RaduBerinde

#### sql, workload: don't disable the optimizer in tests

In preparation for removing the possibility of turning off the
optimizer, adjust tests and benchmarks that are disabling the
optimizer.

Release note: None

#### sql: optimizer always on

This change deprecates the `optimizer` session setting and associated
cluster setting. It is no longer possible to disable the optimizer.
The settings still exist but the only allowed value is "on" (mostly so
that `SET OPTIMIZER = ON` still works).

The logic test configurations are reworked: they now all use the
optimizer, and the `-opt` versions are gone (e.g. what used to be
`local-opt` is now `local`). The HP-specific planner tests are
removed.

Release note: None


39463: roachtest: Bump min version for direct ingest import roachtest r=adityamaru27 a=adityamaru27

Bumping the roachtest version to 19.2.0 to ensure it runs on
master branch.

Closes: #39395

Release note: None

39467: roachtest: add backward compat to replicate/wide r=solongordon a=solongordon

In 6c24930, I updated the way replication zones are named, which
affected the replicate/wide roachtest. However I neglected to add
backward compatibility for testing against previous releases. This
commit restores the old logic for that scenario.

Release note: None

Co-authored-by: Radu Berinde <[email protected]>
Co-authored-by: Aditya Maru <[email protected]>
Co-authored-by: Solon Gordon <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 8, 2019

Build succeeded

@craig craig bot merged commit 57f7ad3 into cockroachdb:master Aug 8, 2019
@knz knz deleted the opt-always-on branch August 9, 2019 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants