-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: do add/drop column backfills via distsql #14331
sql: do add/drop column backfills via distsql #14331
Conversation
This is out for early review. The implementation currently passes logic tests but does not pass |
Reviewed 5 of 5 files at r1, 13 of 13 files at r2, 1 of 1 files at r3, 2 of 2 files at r4. pkg/sql/backfill.go, line 144 at r5 (raw file):
we don't need addedColumnDescs anymore pkg/sql/backfill.go, line 164 at r5 (raw file):
needColumnBackfill = true we use the same backfill mechanism to delete a column get rid of droppedColumnDescs pkg/sql/distsql_physical_planner.go, line 622 at r5 (raw file):
might as well create a generic distsqlrun.BackfillerSpec and only use the switch to set Type pkg/sql/distsqlrun/columnbackfiller.go, line 36 at r5 (raw file):
updateCols? pkg/sql/distsqlrun/columnbackfiller.go, line 41 at r5 (raw file):
and desc.Mutations that hold column descriptors. pkg/sql/distsqlrun/columnbackfiller.go, line 89 at r5 (raw file):
I think you meant to also append the mutation column to cols pkg/sql/distsqlrun/columnbackfiller.go, line 134 at r5 (raw file):
I think we do not need all the columns. Perhaps add a TODO to use a smaller set like the set of columns in the primary key. We basically want to create an insert event per row. pkg/sql/distsqlrun/columnbackfiller.go, line 164 at r5 (raw file):
we don't need it! pkg/sql/distsqlrun/processors.proto, line 360 at r4 (raw file):
other_tables pkg/sql/sqlbase/rowwriter.go, line 761 at r2 (raw file):
Did you really need to export these as part of this PR? Comments from Reviewable |
I took a first pass of this but would like to review runChunk() again. I actually forget why we care about FKs for column backfill and will look into that tomorrow. Review status: 15 of 20 files reviewed at latest revision, 10 unresolved discussions, some commit checks failed. Comments from Reviewable |
f621ea4
to
19df378
Compare
Review status: 13 of 20 files reviewed at latest revision, 10 unresolved discussions. pkg/sql/backfill.go, line 144 at r5 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/backfill.go, line 164 at r5 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/distsqlrun/columnbackfiller.go, line 36 at r5 (raw file): Previously, vivekmenezes wrote…
Added a comment. pkg/sql/distsqlrun/columnbackfiller.go, line 41 at r5 (raw file): Previously, vivekmenezes wrote…
I don't understand what you mean? pkg/sql/distsqlrun/columnbackfiller.go, line 89 at r5 (raw file): Previously, vivekmenezes wrote…
Yes, thanks! This fixed the test issue :) pkg/sql/distsqlrun/columnbackfiller.go, line 164 at r5 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/distsqlrun/processors.proto, line 360 at r4 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/sqlbase/rowwriter.go, line 761 at r2 (raw file): Previously, vivekmenezes wrote…
Unfortunately, yes. All of these structs needed to move to sqlbase, and in order to do that, I needed make a bunch of these fields public. Comments from Reviewable |
Review status: 13 of 20 files reviewed at latest revision, 10 unresolved discussions, some commit checks failed. pkg/sql/distsqlrun/columnbackfiller.go, line 41 at r5 (raw file): Previously, jordanlewis (Jordan Lewis) wrote…
the mutations can be either column or index mutations. But actually it's better the way it is because it is an index into Mutations[] independent of it hold. SO leave this as is. Comments from Reviewable |
pkg/sql/distsqlrun/processors.proto
Outdated
// other_tables contains any other (leased) table descriptors necessary for the | ||
// backfiller to do its job, such as the descriptors for tables with fk | ||
// relationships to the table being modified. | ||
repeated sqlbase.TableDescriptor other_tables = 6 [(gogoproto.nullable) = false]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed foreign key constraints can be checked before and after column backfill and so need not be passed to each processor.
3rd commit message lacks a verb: "add"? Reviewed 5 of 5 files at r1, 13 of 13 files at r2, 1 of 1 files at r3, 7 of 7 files at r6, 5 of 5 files at r7. pkg/sql/backfill.go, line 407 at r7 (raw file):
this should be otherTableDescs, right? this might include other things in the future. pkg/sql/distsql_physical_planner.go, line 604 at r7 (raw file):
otherTables? pkg/sql/distsql_physical_planner.go, line 640 at r7 (raw file):
otherTables? pkg/sql/distsqlrun/columnbackfiller.go, line 1 at r7 (raw file):
2017 pkg/sql/distsqlrun/processors.proto, line 357 at r6 (raw file):
Looks like the local convention avoids naming the field in its comment. pkg/sql/sqlbase/fk.go, line 32 at r2 (raw file):
s/An/an/ but this comment would be better on each field rather than here. Comments from Reviewable |
Review status: all files reviewed at latest revision, 18 unresolved discussions, some commit checks failed. pkg/sql/distsqlrun/columnbackfiller.go, line 64 at r7 (raw file):
should this deref in the caller? that's where the nil check is. Comments from Reviewable |
19df378
to
b0494c4
Compare
Review status: 12 of 20 files reviewed at latest revision, 18 unresolved discussions. pkg/sql/backfill.go, line 407 at r7 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/distsql_physical_planner.go, line 622 at r5 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/distsql_physical_planner.go, line 604 at r7 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/distsql_physical_planner.go, line 640 at r7 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/distsqlrun/columnbackfiller.go, line 1 at r7 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/distsqlrun/columnbackfiller.go, line 64 at r7 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/distsqlrun/processors.proto, line 357 at r6 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Reviewed 2 of 13 files at r2, 1 of 8 files at r8, 2 of 2 files at r9, 5 of 5 files at r10. Comments from Reviewable |
Exciting stuff! Review status: all files reviewed at latest revision, 12 unresolved discussions, some commit checks failed. Comments from Reviewable |
Do let me know when I should take a look
…On Fri, Mar 24, 2017, 10:27 AM RaduBerinde ***@***.***> wrote:
Exciting stuff!
------------------------------
Review status: all files reviewed at latest revision, 12 unresolved
discussions, some commit checks failed.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/cockroachdb/cockroach/14331#-:-Kg-hOk7F13ypfZd3IIX:bujbiap>*
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#14331 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALOpBKVAinf2Ui5z3JjXuWfUQJbOPAQKks5ro9LAgaJpZM4Ml8ER>
.
|
55770a2
to
c7df0b8
Compare
PTAL! Review status: 2 of 21 files reviewed at latest revision, 12 unresolved discussions, some commit checks pending. pkg/sql/distsqlrun/columnbackfiller.go, line 134 at r5 (raw file): Previously, vivekmenezes wrote…
There's already a todo for this in this file about tightening the bounds on the requestedCols down below in the rowUpdater. That todo encapsulates this request. pkg/sql/distsqlrun/processors.proto, line 360 at r7 (raw file): Previously, vivekmenezes wrote…
I'll do this in a subsequent PR as discussed. Comments from Reviewable |
Review status: 2 of 21 files reviewed at latest revision, 17 unresolved discussions, all commit checks successful. pkg/sql/backfill.go, line 144 at r16 (raw file):
created this issue: #14455 to clean this up pkg/sql/backfill.go, line 458 at r16 (raw file):
can you use getChunkSize(columnTruncateAndBackfillChunkSize) please also fix the backfillIndexes case to use getChunkSize(indexBackfillChunkSize) in a separate commit. Thanks! pkg/sql/distsql_physical_planner.go, line 615 at r16 (raw file):
call return ret, nil at the bottom pkg/sql/distsqlrun/columnbackfiller.go, line 82 at r16 (raw file):
TODO(jordan): fix #14455 pkg/sql/distsqlrun/columnbackfiller.go, line 132 at r16 (raw file):
Added a TODO that we need to only read one of the columns forming the primary key. It's better not to make that change in this PR. Comments from Reviewable |
c7df0b8
to
2340266
Compare
Review status: 2 of 21 files reviewed at latest revision, 17 unresolved discussions, all commit checks successful. pkg/sql/backfill.go, line 458 at r16 (raw file): Previously, vivekmenezes wrote…
I'll fix these both in a follow on. pkg/sql/distsql_physical_planner.go, line 615 at r16 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/distsqlrun/columnbackfiller.go, line 82 at r16 (raw file): Previously, vivekmenezes wrote…
Done. pkg/sql/distsqlrun/columnbackfiller.go, line 132 at r16 (raw file): Previously, vivekmenezes wrote…
Hmm, I'm not sure that this is true. What if we're adding a new column that's part of the same column family as the rest of the columns? Granted the correct bounds for this is more subtle, but agreed that I'll do this in a separate PR. Comments from Reviewable |
makeDefaultExprs is currently used by insert, update, upsert and backfill, which all live in the sql package. It will soon by used by distsqlrun, so it needed to be moved somewhere importable by both sql and distsqlrun - it now lives in sqlbase.
In preparation for being used by distsql.
Previously, the backfiller spec was passed to the index backfiller by reference, despite it getting dereferenced immediately afterwards and despite the caller being the one performing the nil check. Now, dereference the spec right after the nil check is done.
This commit replaces the add/drop column backfill methods in `backfill.go` with a new `chunkBackfiller` called `columnBackfiller` that does the backfill via distsql.
2340266
to
ad348ce
Compare
Reviewed 2 of 13 files at r2, 2 of 13 files at r12, 19 of 21 files at r17. pkg/sql/distsqlrun/columnbackfiller.go, line 132 at r16 (raw file): Previously, jordanlewis (Jordan Lewis) wrote…
ok Comments from Reviewable |
TFTRs! Review status: 2 of 21 files reviewed at latest revision, 16 unresolved discussions, all commit checks successful. Comments from Reviewable |
woohoo
…On Thu, Mar 30, 2017 at 2:19 PM Jordan Lewis ***@***.***> wrote:
Merged #14331 <#14331>.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#14331 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALOpBEx61_hA4UNw28IM4YrGVMf2TFRcks5rq_IzgaJpZM4Ml8ER>
.
|
rowwriter
andmakeDefaultExprs
intosqlbase
so they can be used from thedistsql
package.This change is