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: add catalog.Partitioning interface #64013

Merged
merged 1 commit into from
May 14, 2021

Conversation

postamar
Copy link
Contributor

This commit aims at reducing direct usage of
descpb.PartitioningDescriptor types and instead using the new
catalog.Partitioning interface. This refactoring is in line with recent
virtualization work tracked under #56306.

In an effort to improve readability and ability to reason about state
changes, this commit changes the type signature of sql.CreatePartitioning
and, notably, removes its side-effects on the index descriptor. The
latter is now modified using a new tabledesc.UpdateIndexPartitioning
function.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@postamar postamar force-pushed the virtualize-partitioning branch 2 times, most recently from a9e817f to 00edda4 Compare April 21, 2021 21:42
@postamar postamar marked this pull request as ready for review April 21, 2021 21:43
@postamar postamar requested review from a team and otan April 21, 2021 21:43
@otan
Copy link
Contributor

otan commented Apr 21, 2021

i'm happy to take a look, but may i request these changes be merged after the v21.1 release is finalised (i.e. out as GA)? we may have some backports coming that will not backport nicely when these are in

@postamar
Copy link
Contributor Author

Yes absolutely, none of this is urgent.

@postamar postamar marked this pull request as draft April 22, 2021 13:31
Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

Reviewed 27 of 27 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @postamar)


pkg/ccl/partitionccl/partition.go, line 609 at r1 (raw file):

	if part.NumRange() > 0 {
		log.Fatal(context.TODO(), "TODO(dan): unsupported for range partitionings")

evalCtx.Context


pkg/sql/partition_utils.go, line 242 at r1 (raw file):

	}

	if part.NumRange() > 0 {

nit: should this be called NumRanges()


pkg/sql/catalog/table_elements.go, line 407 at r1 (raw file):

	// NumList returns the number of list elements in the underlying partitioning
	// descriptor.
	NumList() int

nit: NumLists() ?

Copy link
Contributor Author

@postamar postamar left a comment

Choose a reason for hiding this comment

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

Thanks for the review!

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


pkg/ccl/partitionccl/partition.go, line 609 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

evalCtx.Context

Done.


pkg/sql/partition_utils.go, line 242 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

nit: should this be called NumRanges()

Done.


pkg/sql/catalog/table_elements.go, line 407 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

nit: NumLists() ?

Done.

@postamar postamar marked this pull request as ready for review May 5, 2021 12:27
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 12 of 12 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan)

This commit aims at reducing direct usage of
descpb.PartitioningDescriptor types and instead using the new
catalog.Partitioning interface. This refactoring is in line with recent
virtualization work tracked under cockroachdb#56306.

In an effort to improve readability and ability to reason about state
changes, this commit changes the type signature of sql.CreatePartitioning
and, notably, removes its side-effects on the index descriptor. The
latter is now modified using a new tabledesc.UpdateIndexPartitioning
function.

Release note: None
@postamar
Copy link
Contributor Author

Rebased on fresh master.

@postamar
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented May 14, 2021

Build succeeded:

@craig craig bot merged commit 101b4e4 into cockroachdb:master May 14, 2021
@postamar postamar deleted the virtualize-partitioning branch May 14, 2021 01:21
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