Skip to content

roachtest: ensure privileges stay consistent after version upgrades#67375

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
RichardJCai:privilege_version_upgrade_06302021
Jul 13, 2021
Merged

roachtest: ensure privileges stay consistent after version upgrades#67375
craig[bot] merged 1 commit intocockroachdb:masterfrom
RichardJCai:privilege_version_upgrade_06302021

Conversation

@RichardJCai
Copy link
Copy Markdown
Contributor

roachtest: ensure privileges stay consistent after version upgrades

Release note: None

Resolves #65011

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@RichardJCai RichardJCai requested review from a team and rafiss July 8, 2021 17:23
@RichardJCai RichardJCai force-pushed the privilege_version_upgrade_06302021 branch from 195b8c3 to fdbef6e Compare July 8, 2021 20:43
Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

this test is cool! hadn't looked at a version upgrade test before -- i like how you wrote this

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RichardJCai)


pkg/cmd/roachtest/privilege_version_upgrade.go, line 30 at r1 (raw file):

		Name:       "versionupgrade/privileges",
		Owner:      OwnerSQLExperience,
		MinVersion: "v20.1.0",

oh hm, i thought MinVersion got removed recently? i might be mistaken


pkg/cmd/roachtest/privilege_version_upgrade.go, line 66 at r1 (raw file):

			expectedGrants = append(expectedGrants, []string{"test", "testuser", privilege})
		}
		r.CheckQueryResults(t, `SHOW GRANTS ON DATABASE test`, expectedGrants)

is the order of the results stable? might be worth adding an extra ORDER BY 1, 2, 3 to be sure. (same for the other SHOW GRANTS below


pkg/cmd/roachtest/privilege_version_upgrade.go, line 206 at r1 (raw file):

	// An empty string will lead to the cockroach binary specified by flag
	// `cockroach` to be used.
	const mainVersion = ""

nit: would this be better named currentVersion or something? also, why don't we want to use buildVersion here?


pkg/cmd/roachtest/privilege_version_upgrade.go, line 221 at r1 (raw file):

		steps = append(
			steps,
			createUserStep(1),

nit: since loadNode is always 1, could it be defined as a const rather than passed as a parameter?


pkg/cmd/roachtest/privilege_version_upgrade.go, line 273 at r1 (raw file):

			continue
		}
		if i%2 == 0 {

i thought for a second if this would be a good place to randomize, but i'm not sure. of course the downside is that it could get annoying to reproduce, but on the pro side, the test will always log the expected privileges it it fails and we might get more coverage... idk if it's worth it though

Copy link
Copy Markdown
Contributor Author

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


pkg/cmd/roachtest/privilege_version_upgrade.go, line 30 at r1 (raw file):

nVer

Yeah you're right looks like its gone


pkg/cmd/roachtest/privilege_version_upgrade.go, line 66 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

is the order of the results stable? might be worth adding an extra ORDER BY 1, 2, 3 to be sure. (same for the other SHOW GRANTS below

The underlying SHOW GRANTS query actually has an ORDER BY 1,2,3


pkg/cmd/roachtest/privilege_version_upgrade.go, line 206 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

nit: would this be better named currentVersion or something? also, why don't we want to use buildVersion here?

Yeah I think currentVersion makes sense. buildVersion probably also makes sense


pkg/cmd/roachtest/privilege_version_upgrade.go, line 221 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

nit: since loadNode is always 1, could it be defined as a const rather than passed as a parameter?

Done


pkg/cmd/roachtest/privilege_version_upgrade.go, line 273 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

i thought for a second if this would be a good place to randomize, but i'm not sure. of course the downside is that it could get annoying to reproduce, but on the pro side, the test will always log the expected privileges it it fails and we might get more coverage... idk if it's worth it though

Yeah imo I don't think it's worth it to randomize.
I don't think randomizing will do much since we're just trying to make sure each privilege stays consistent after upgrading. Testing different combinations won't really expand coverage.

Copy link
Copy Markdown
Contributor Author

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


pkg/cmd/roachtest/privilege_version_upgrade.go, line 206 at r1 (raw file):

Previously, RichardJCai (Richard Cai) wrote…

Yeah I think currentVersion makes sense. buildVersion probably also makes sense

Nvm using buildVersion errors out, seems like it doesn't find the right binary name or the url doesn't match the buildVersion exactly.

		Wraps: (3) /Users/rcai/go/src/github.com/cockroachdb/cockroach/bin/roachprod stage richardc-1625856233-01-n3cpu4:3 release vv21.2.0-alpha.00000000 --dir='vv21.2.0-alpha.00000000' returned
		  | stderr:
		  | curl: (22) The requested URL returned error: 404 Not Found
		  |
		  | gzip: stdin: unexpected end of file
		  | tar: Child returned status 1
		  | tar: Error is not recoverable: exiting now
		  | Error: COMMAND_PROBLEM: exit status 2
		  | (1) COMMAND_PROBLEM
		  | Wraps: (2) Node 3. Command with error:
		  |   | ```
		  |   |
		  |   | tmpdir="$(mktemp -d /tmp/cockroach-release.XXX)" && \
		  |   | dir='vv21.2.0-alpha.00000000' && \
		  |   | curl -f -s -S -o- https://s3.amazonaws.com/binaries.cockroachdb.com/cockroach-vv21.2.0-alpha.00000000.linux-amd64.tgz | tar xfz - -C "${tmpdir}" --strip-components 1 && \
		  |   | mv ${tmpdir}/cockroach ${dir}/cockroach && \
		  |   | mkdir -p ${dir}/lib && \
		  |   | if [ -d ${tmpdir}/lib ]; then mv ${tmpdir}/lib/* ${dir}/lib; fi && \
		  |   | chmod 755 ${dir}/cockroach
		  |   |
		  |   | ```
		  | Wraps: (3) exit status 2
		  | Error types: (1) errors.Cmd (2) *hintdetail.withDetail (3) *exec.ExitError
		  |
		  | stdout:
		  | Resolved release url for cockroach version vv21.2.0-alpha.00000000: https://s3.amazonaws.com/binaries.cockroachdb.com/cockroach-vv21.2.0-alpha.00000000.linux-amd64.tgz

@RichardJCai RichardJCai requested a review from rafiss July 9, 2021 18:54
@rafiss
Copy link
Copy Markdown
Collaborator

rafiss commented Jul 9, 2021

Seems like some changes didn't get pushed

@RichardJCai RichardJCai force-pushed the privilege_version_upgrade_06302021 branch 2 times, most recently from e875713 to 520e4df Compare July 9, 2021 19:26
Copy link
Copy Markdown
Contributor Author

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

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

Oops yeah I think I forgot to add the file or something

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)

@RichardJCai RichardJCai force-pushed the privilege_version_upgrade_06302021 branch from 520e4df to e47cdfe Compare July 12, 2021 17:26
@rafiss rafiss requested a review from a team July 12, 2021 20:15
Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

looks good!

Reviewed 2 of 3 files at r1, 2 of 2 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)

@RichardJCai
Copy link
Copy Markdown
Contributor Author

Thanks!
bors r=rafiss

craig bot pushed a commit that referenced this pull request Jul 13, 2021
66560:  sql: allowing add missing tables from json file r=RichardJCai a=mnovelodou

 Previously, we could only add missing tables on information_schema or
 pg_catalog from dump json file
 This was inadequate because sometimes we need to manually decide how
 columns data types are going to be
 To address this, this patch adds a flag that allows to specify the json
 file where to find the missing tables

 Release note: None

67375: roachtest: ensure privileges stay consistent after version upgrades r=rafiss a=RichardJCai

roachtest: ensure privileges stay consistent after version upgrades

Release note: None

Resolves #65011

67548: roachtest: fix typeorm apt-get update r=rail a=RichardJCai

Release note: None

67550: authors: add xinhaoz to AUTHORS r=xinhaoz a=xinhaoz

Release note: None

67560: authors: add harding@cockroachlabs.com to authors. r=rharding6373 a=rharding6373

Release note: None

Co-authored-by: MiguelNovelo <miguel.novelo@digitalonus.com>
Co-authored-by: richardjcai <caioftherichard@gmail.com>
Co-authored-by: Xin Hao Zhang <xzhang@cockroachlabs.com>
Co-authored-by: rharding6373 <rharding6373@users.noreply.github.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 13, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 13, 2021

Build succeeded:

@craig craig bot merged commit faa4c2c into cockroachdb:master Jul 13, 2021
"z_test_test.go",
],
embed = [":roachtest_lib"],
tags = ["broken_in_bazel"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Careful -- the removal of this tag started breaking Bazel CI runs. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Interesting, thanks for fixing. Odd enough I think the tag got removed by make bazel-generate. I'll keep this in mind for the future.

@RichardJCai RichardJCai deleted the privilege_version_upgrade_06302021 branch July 14, 2021 14:39
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.

sql: add validating privileges after version upgrades

4 participants