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: introduce system.settings table #14646

Merged
merged 1 commit into from
Apr 6, 2017
Merged

sql: introduce system.settings table #14646

merged 1 commit into from
Apr 6, 2017

Conversation

dt
Copy link
Member

@dt dt commented Apr 5, 2017

this will be used to store and manage cluster-wide, runtime changable settings.
this introduces the new table via a migration -- later work will use it to provide
settings accessors for calling code.

@dt dt requested review from bdarnell and benesch April 5, 2017 21:22
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@benesch
Copy link
Contributor

benesch commented Apr 5, 2017

Reviewed 7 of 7 files at r1.
Review status: all files reviewed at latest revision, 8 unresolved discussions.


pkg/migrations/migrations.go, line 61 at r1 (raw file):

		workFn:         createSettingsTable,
		newDescriptors: 1,
		newRanges:      0, // settings doesn't count, since its gossip range.

nit: "it's"

(sorry)


pkg/migrations/migrations.go, line 352 at r1 (raw file):

		b.CPut(sqlbase.MakeNameMetadataKey(desc.GetParentID(), desc.GetName()), desc.GetID(), nil)
		b.CPut(sqlbase.MakeDescMetadataKey(desc.GetID()), sqlbase.WrapDescriptor(&desc), nil)
		txn.SetSystemConfigTrigger()

I think make check is about to complain about this unchecked error.


pkg/sql/sqlbase/system.go, line 121 at r1 (raw file):

CREATE TABLE system.settings (
	name              STRING    NOT NULL PRIMARY KEY,
	value            	STRING    NOT NULL,

This seems misaligned. Stray tab?


pkg/sql/sqlbase/system.go, line 125 at r1 (raw file):

	valueType         STRING,
	FAMILY (name, value, lastUpdated, valueType)
);`

This entire def should be in the previous const declaration for system config tables; this declaration is for non-config tables.


pkg/sql/sqlbase/system.go, line 177 at r1 (raw file):

	// the use of a validating, logging accessor, so we'll go ahead and tolerate
	// read-only privs to make that migration possible later.
	keys.SettingsTableID: {privilege.ReadWriteData, privilege.ReadData},

👍

I'd move this between Zones and Lease, though, to keep it with the other system config tables.


pkg/sql/sqlbase/system.go, line 521 at r1 (raw file):

		PrimaryIndex:   pk("name"),
		NextIndexID:    2,
		Privileges:     NewPrivilegeDescriptor(security.RootUser, SystemDesiredPrivileges(keys.SettingsTableID)),

This should also be up in the previous var block.


pkg/sql/testdata/logic_test/system, line 149 at r1 (raw file):

created  TIMESTAMP  false  now()           {jobs_status_created_idx}
payload  BYTES      false  NULL            {}

Can you add SHOW COLUMNS FROM system.settings here for consistency?


pkg/sql/testdata/logic_test/system, line 231 at r1 (raw file):

jobs  root  SELECT
jobs  root  UPDATE

and SHOW GRANTS ON system.settings here?


Comments from Reviewable

@dt
Copy link
Member Author

dt commented Apr 6, 2017

Review status: 4 of 7 files reviewed at latest revision, 8 unresolved discussions.


pkg/migrations/migrations.go, line 61 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

nit: "it's"

(sorry)

Done.


pkg/migrations/migrations.go, line 352 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

I think make check is about to complain about this unchecked error.

Done.


pkg/sql/sqlbase/system.go, line 121 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

This seems misaligned. Stray tab?

Done.


pkg/sql/sqlbase/system.go, line 125 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

This entire def should be in the previous const declaration for system config tables; this declaration is for non-config tables.

Done.


pkg/sql/sqlbase/system.go, line 177 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

👍

I'd move this between Zones and Lease, though, to keep it with the other system config tables.

Done.


pkg/sql/sqlbase/system.go, line 521 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

This should also be up in the previous var block.

Done.


pkg/sql/testdata/logic_test/system, line 149 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

Can you add SHOW COLUMNS FROM system.settings here for consistency?

Done.


pkg/sql/testdata/logic_test/system, line 231 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

and SHOW GRANTS ON system.settings here?

Done.


Comments from Reviewable

@benesch
Copy link
Contributor

benesch commented Apr 6, 2017

Nice, that's all of the comments I have! (Though looks like TestZip is legitimately failing because its output depends on the installed system tables.)

Holding off on the LGTM because I don't know what protocol is for implementations that precede their RFC.


Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

this will be used to store and manage cluster-wide, runtime changable settings.
this introduces the new table via a migration -- later work will use it to provide
settings accessors for calling code.
@benesch
Copy link
Contributor

benesch commented Apr 6, 2017

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending.


Comments from Reviewable

@dt
Copy link
Member Author

dt commented Apr 6, 2017

Fixed TestZip.

I'll update the RFC to in-progress and merge it.


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@dt dt merged commit c8e9c26 into cockroachdb:master Apr 6, 2017
@dt dt deleted the settingstbl branch April 6, 2017 17:28
@danhhz
Copy link
Contributor

danhhz commented Apr 6, 2017

lgtm, though sciencedog on the privilege stuff


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants