-
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/schemachanger: prerequisite changes for DROP COLUMN #84157
sql/schemachanger: prerequisite changes for DROP COLUMN #84157
Conversation
e721f90
to
c6056c8
Compare
This needs another commit to make the changefeed behavior happy, and maybe there's a |
There are two more things that need to be fixed on this:
Today's going to be very busy, so I don't think I'll be able to resolve both before EOD. I hope to have it all ready to merge some time tomorrow. |
c6056c8
to
fde07d1
Compare
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.
In light of the above comment I reviewed all but the last commit. I recommend you put up a separate PR with these so that we can ship these welcome changes right away. The only major comment I have is that if you need to track referenced columns in existing expressions then you should add those IDs to the Expression
element building block and populate them during scdecomp
.
Reviewed 2 of 2 files at r1, 3 of 3 files at r2, 8 of 8 files at r3, 11 of 11 files at r4, 2 of 2 files at r5, 2 of 2 files at r6, 1 of 1 files at r7, 5 of 5 files at r8.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @postamar)
-- commits
line 42 at r6:
reword
pkg/sql/catalog/index_id_set.go
line 90 at r6 (raw file):
// numbers are shown as ranges. For example, for the set {1, 2, 3 5, 6, 10}, // the output is "(1-3,5,6,10)". func (s IndexIDSet) String() string { return s.set.String() }
This is all fine but should we move this and its cousins to catid
?
pkg/sql/schemachanger/scbuild/builder_state.go
line 559 at r5 (raw file):
} return cols }
Shouldn't these column references be in the scpb.Expression
element instead, and populated by scdecomp
?
pkg/sql/schemachanger/scplan/plan_explain.go
line 237 at r4 (raw file):
} rn.AddLine(fmt.Sprintf("rules: [%s]", strings.Join(rules, ", "))) }
Can you treeprinterify the rules to have them printed as separate tree nodes instead, or at least on separate lines? It's good to print them all, but like this it won't age well.
pkg/sql/schemachanger/scplan/internal/rules/dep_index_and_column.go
line 366 at r3 (raw file):
) // TODO(ajwerner): Understand this rule and why it needs to exist.
The reason the name is tied to the column type instead of the column is because otherwise DROP TABLE would be sad. See rules further below involving IsRelationBeingDropped
(I thought we'd gotten rid of those? idk)
Whether that still applies is unclear.
pkg/sql/schemachanger/scplan/internal/scgraph/graph.go
line 375 at r4 (raw file):
if de, ok := e.(*DepEdge); ok { sb.WriteString(de.rules.String())
unintentional newline?
pkg/sql/logictest/testdata/logic_test/new_schema_changer
line 176 at r4 (raw file):
RunningStatus: all stages completed
noise
pkg/sql/schemachanger/scplan/plan_test.go
line 176 at r4 (raw file):
screl.ElementString(de.To().Element()), de.To().CurrentStatus) fmt.Fprintf(&deps, " kind: %s\n", de.Kind()) fmt.Fprintf(&deps, " rule: %s\n", de.RuleNames())
s/rule/rules/
This refactors the code a tad and extracts some helpers. Release note: None
Extracted a few helpers for code reuse. Release note: None
One rule was too strict, and another would only match the secondary index and not the temp index. Also, the variable names were swapped. Release note: None
fde07d1
to
a53bd4b
Compare
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.
TFTR!
I've peeled the last commit off of this PR and reworked the descriptor so this can merge. I'll put up the last commit separately.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @postamar)
Previously, postamar (Marius Posta) wrote…
reword
Done.
pkg/sql/schemachanger/scplan/plan_explain.go
line 237 at r4 (raw file):
Previously, postamar (Marius Posta) wrote…
Can you treeprinterify the rules to have them printed as separate tree nodes instead, or at least on separate lines? It's good to print them all, but like this it won't age well.
Done.
pkg/sql/schemachanger/scplan/internal/rules/dep_index_and_column.go
line 366 at r3 (raw file):
Previously, postamar (Marius Posta) wrote…
The reason the name is tied to the column type instead of the column is because otherwise DROP TABLE would be sad. See rules further below involving
IsRelationBeingDropped
(I thought we'd gotten rid of those? idk)Whether that still applies is unclear.
Ack.
pkg/sql/schemachanger/scplan/internal/scgraph/graph.go
line 375 at r4 (raw file):
Previously, postamar (Marius Posta) wrote…
unintentional newline?
Done.
pkg/sql/logictest/testdata/logic_test/new_schema_changer
line 176 at r4 (raw file):
Previously, postamar (Marius Posta) wrote…
noise
Done.
pkg/sql/schemachanger/scplan/plan_test.go
line 176 at r4 (raw file):
Previously, postamar (Marius Posta) wrote…
s/rule/rules/
Done.
pkg/sql/catalog/index_id_set.go
line 90 at r6 (raw file):
Previously, postamar (Marius Posta) wrote…
This is all fine but should we move this and its cousins to
catid
?
Done.
pkg/sql/schemachanger/scbuild/builder_state.go
line 559 at r5 (raw file):
Previously, postamar (Marius Posta) wrote…
Shouldn't these column references be in the
scpb.Expression
element instead, and populated byscdecomp
?
Done.
a53bd4b
to
7519009
Compare
…o apply Before this change, due to how the depEdgeTree works, we'd arbitrarily throw away matching depEdges for the purpose of planning. This was extremely confusing in some cases. Release note: None
This is needed to determine whether an expression uses a column. Release note: None
Release note: None
… index Release note: None
I wanted to extend this and making it internally a set of filters works better than a hodge-podge of policies. Release note: None
Without this patch, it would not apply at Statement or PreCommit Release note: None
7519009
to
3c0c52b
Compare
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.
Reviewed 53 of 53 files at r11, 3 of 3 files at r12, 6 of 8 files at r13, 10 of 12 files at r14, 8 of 11 files at r15, 2 of 6 files at r16, 1 of 5 files at r17, 9 of 9 files at r18, 4 of 4 files at r19, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)
TFTR! bors r+ |
Build succeeded: |
This PR comes in a number of commits and is best reviewed commit-by-commit. This PR contains cleanup needed to implement
DROP COLUMN
(#84072). The actual support for that feature will follow in a separate PR.IndexSet
tocatid
.MakeFirstMutationPublic
in order to make introducing a new filter easier.