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

*: Rename "default" cluster to "quickstart" #24019

Merged

Conversation

ParkMyCar
Copy link
Member

@ParkMyCar ParkMyCar commented Dec 19, 2023

This PR renames the "default" cluster to "quickstart" for new environments, existing environments will not have their cluster renamed. To keep the default value for the "cluster" variable to "default" we add a Catalog migration that runs for existing environments.

Motivation

Fixes https://github.com/MaterializeInc/database-issues/issues/6755

Tips for reviewer

There are a large number of changes here, but the majority of them are test-only changes. The PR is broken up into commits that can ideally be review independently:

  1. The changes to actually rename the "default" cluster to "quickstart"
  2. Updates to sqllogictests
  3. Updates to testdrive tests
  4. Updates to our python tests
  5. Updates to our dbt tests
  6. Updates to our Rust tests
  7. Updates to the legacy-upgrade tests

The accompanying changes to our user documentation is here: #24035

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • This PR includes the following user-facing behavior changes:
    • Renames the cluster created for every environment from "default" to "quickstart"

@ParkMyCar ParkMyCar force-pushed the cluster/rename-default-to-quickstart branch 14 times, most recently from 0c7b1fd to a8f61a5 Compare December 21, 2023 16:53
@ParkMyCar ParkMyCar marked this pull request as ready for review December 21, 2023 17:15
@ParkMyCar ParkMyCar requested review from a team as code owners December 21, 2023 17:15
@ParkMyCar ParkMyCar requested review from a team and jkosh44 December 21, 2023 17:15
Copy link
Contributor

@def- def- left a comment

Choose a reason for hiding this comment

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

Glad to see you triggered nightly already, I'm expected lots of related failures. If that's green, ok

Copy link
Contributor

@def- def- left a comment

Choose a reason for hiding this comment

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

The "Detect references to already closed issues" can be ignored, but platform-checks looks like a new issue:

Running manipulate() from <materialize.checks.all_checks.identifiers.Identifiers object at 0x7ff8495ce250>
--- docker compose exec -T testdrive testdrive --kafka-addr=kafka:9092 --schema-registry-url=http://schema-registry:8081 --materialize-url=postgres://materialize@materialized:6875 --materialize-internal-url=postgres://materialize@materialized:6877 --aws-endpoint=http://localstack:4566 --no-reset --default-timeout=300s --seed=1 --persist-blob-url=file:///mzdata/persist/blob --persist-consensus-url=postgres://root@materialized:26257?options=--search_path=consensus --var=replicas=1 --var=default-replica-size=4-4 --var=default-storage-size=4-1 --source=/var/lib/buildkite-agent/builds/buildkite-builders-d43b1b5-i-092248735da8c3952-1/materialize/nightlies/misc/python/materialize/checks/all_checks/identifiers.py:150
> SET CLUSTER=identifiers;
rows match; continuing at ts 1703179510.3750253
> SET DATABASE="	� …             ​

 � ";
rows match; continuing at ts 1703179510.3760698
> CREATE MATERIALIZED VIEW "../../../../../../../../../../../etc/hosts"." " IN CLUSTER quickstart AS
SELECT "<foo val=“bar� />", c2 as "<foo val=“bar� />" FROM "../../../../../../../../../../../etc/hosts"."<a href=""javascript\x0D:javascript:alert(1)"" id=""fuzzelement1"">test</a>";

^^^ +++
4:1: error: executing query failed: db error: ERROR: column "<foo val=“bar� />" specified more than once: ERROR: column "<foo val=“bar� />" specified more than once

I'm wondering why that is failing now

@ParkMyCar
Copy link
Member Author

Glad to see you triggered nightly already, I'm expected lots of related failures. If that's green, ok

There were a lot of test failures, but I've been iterating :)

Running manipulate() from <materialize.checks.all_checks.identifiers.Identifiers object at 0x7ff8495ce250>
--- docker compose exec -T testdrive testdrive --kafka-addr=kafka:9092 --schema-registry-url=http://schema-registry:8081 --materialize-url=postgres://materialize@materialized:6875 --materialize-internal-url=postgres://materialize@materialized:6877 --aws-endpoint=http://localstack:4566 --no-reset --default-timeout=300s --seed=1 --persist-blob-url=file:///mzdata/persist/blob --persist-consensus-url=postgres://root@materialized:26257?options=--search_path=consensus --var=replicas=1 --var=default-replica-size=4-4 --var=default-storage-size=4-1 --source=/var/lib/buildkite-agent/builds/buildkite-builders-d43b1b5-i-092248735da8c3952-1/materialize/nightlies/misc/python/materialize/checks/all_checks/identifiers.py:150
> SET CLUSTER=identifiers;
rows match; continuing at ts 1703179510.3750253
> SET DATABASE="	� …             ​

 � ";
rows match; continuing at ts 1703179510.3760698
> CREATE MATERIALIZED VIEW "../../../../../../../../../../../etc/hosts"." " IN CLUSTER quickstart AS
SELECT "<foo val=“bar� />", c2 as "<foo val=“bar� />" FROM "../../../../../../../../../../../etc/hosts"."<a href=""javascript\x0D:javascript:alert(1)"" id=""fuzzelement1"">test</a>";

^^^ +++
4:1: error: executing query failed: db error: ERROR: column "<foo val=“bar� />" specified more than once: ERROR: column "<foo val=“bar� />" specified more than once

I'm wondering why that is failing now

I'm not sure why this is failing either, I changed some strings to f-strings but not this one. I was going to dig into it

@ParkMyCar ParkMyCar force-pushed the cluster/rename-default-to-quickstart branch from a8f61a5 to 1ca6a4e Compare December 21, 2023 17:42
@ParkMyCar
Copy link
Member Author

@def- it seems like these two lines have the same exact content, was that intentional?. I copied them into Rust Playground and inspected their byte representation. So it seems possible that this conflict could happen, because column and alias could map to the same ident. Maybe we're just getting unlucky now?

@def-
Copy link
Contributor

def- commented Dec 21, 2023

Oooh, that is indeed not supposed to happen. Let me scan that file for other duplicates, thanks!

def- added a commit to def-/materialize that referenced this pull request Dec 21, 2023
Since our tests depend on them being unique, thanks to ParkMyCar for
noticing: MaterializeInc#24019 (comment)
@def- def- mentioned this pull request Dec 21, 2023
5 tasks
Comment on lines 51 to 58
if self.base_version >= MzVersion.parse_mz("v0.81.0-dev"):
return "quickstart"
else:
return "default"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

_conn_catalog: &ConnCatalog<'_>,
_connection_context: &ConnectionContext,
) -> Result<(), anyhow::Error> {
txn.upsert_system_config("cluster", "default".to_string())?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check if they've already overwritten their cluster var and not upsert in that case?

Copy link
Member Author

Choose a reason for hiding this comment

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

#23903 has yet to be included in a release, so it wouldn't have been previously possible for users to overwrite their cluster var in this case

@@ -220,7 +220,7 @@ impl CatalogState {
state: Cow::Borrowed(self),
unresolvable_ids: BTreeSet::new(),
conn_id: SYSTEM_CONN_ID.clone(),
cluster: "default".into(),
cluster: "quickstart".into(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use mz_catalog::durable::initialize::DEFAULT_USER_CLUSTER_NAME here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This made me realize we shouldn't use a static value for a session-less user, and instead we should use whatever value is in the system vars, updated!

Comment on lines +154 to +169
id: 6,
event_type: Grant,
object_type: Database,
user: None,
occurred_at: Some(
EpochMillis {
millis: 0,
},
),
details: Some(
IdNameV1(
IdNameV1 {
id: "u1",
name: "default",
UpdatePrivilegeV1(
UpdatePrivilegeV1 {
object_id: "Du1",
grantee_id: "p",
grantor_id: "s1",
privileges: "U",
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened here? There's a lot more changes than I was expecting.

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out the snapshot isn't sorted, so the large amount of changes comes from audit log events being ordered differently in the formatting of the snapshot. If you'd like I can fix the ordering in this PR, or in a follow up!

Copy link
Contributor

Choose a reason for hiding this comment

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

No that's ok. As long as it's just ordering it's fine.


# to make it easier to run the test again, let's recreate the default cluster
# to make it easier to run the test again, let's recreate the defaquickstartult cluster
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# to make it easier to run the test again, let's recreate the defaquickstartult cluster
# to make it easier to run the test again, let's recreate the quickstart cluster

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, updated!

Copy link
Contributor

@jkosh44 jkosh44 left a comment

Choose a reason for hiding this comment

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

LGTM

@ParkMyCar ParkMyCar requested a review from a team as a code owner December 29, 2023 02:01
rename default cluster to quickstart

add catalog migration so existing users' cluster is 'default'

fix catalog migration
update sqllogictests, again
update testdrive to pick cluster name based on db version
python test fmt

update python tests, again

update python tests, again again

update python tests, again

python fmt

python type fixes

python, use base version not current version
update dbt tests, again

update dbt tests, again
rust test fmt

update rust tests, again
@ParkMyCar ParkMyCar force-pushed the cluster/rename-default-to-quickstart branch from b966ba0 to 236d460 Compare January 2, 2024 14:17
@ParkMyCar ParkMyCar merged commit f82746e into MaterializeInc:main Jan 2, 2024
152 of 155 checks passed
@ParkMyCar ParkMyCar deleted the cluster/rename-default-to-quickstart branch June 17, 2024 20:37
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.

4 participants