sql/schemachanger: enable add column by default in declarative schema changer#76983
Merged
craig[bot] merged 21 commits intocockroachdb:masterfrom May 17, 2022
Merged
sql/schemachanger: enable add column by default in declarative schema changer#76983craig[bot] merged 21 commits intocockroachdb:masterfrom
craig[bot] merged 21 commits intocockroachdb:masterfrom
Conversation
Member
a4d1a10 to
d0d552d
Compare
2057b22 to
751cc3d
Compare
076619a to
9a4ed6e
Compare
HonoreDB
reviewed
Apr 26, 2022
| SET CLUSTER SETTING kv.closed_timestamp.target_duration = '1s'; | ||
| SET CLUSTER SETTING changefeed.experimental_poll_interval = '10ms'; | ||
| SET CLUSTER SETTING sql.defaults.vectorize=on; | ||
| SET CLUSTER SETTING sql.defaults.use_declarative_schema_changer='off'; |
Contributor
There was a problem hiding this comment.
Would you mind adding a comment explaining which tests break with this on?
HonoreDB
reviewed
Apr 26, 2022
Contributor
HonoreDB
left a comment
There was a problem hiding this comment.
Excited to see this! Two questions:
- I see you're turning off the declarative schema changer in changefeed tests. What breaks when add column uses the declarative schema changer? Will it be possible to remove that from the tests before merging this? (cdc team could make a PR to this branch if you need).
- You mention
Support empty column family namesas one of the fixes. cdc interacts with column family names--will we need to handle the possibility of a public column having an empty column family name? If so, is there a unique identifier we can use that can't conflict with other family names in the same table?
Collaborator
Author
|
Ah, I need to handle offline descriptors here as well for hydration. |
c2a33ca to
a63bdfc
Compare
Previously, when looking up descriptors in the cached uncommitted descriptors we would not hydrate type information, which could lead to certain operations like add columns inside the declarative schema changer failing. This change, adds logic to hydrate table descriptors inside the uncommitted descriptor cache when used for lookups. Additionally, synthetic descriptors are skipped when hydrating types, since during execution these can be injected to mark descriptors as dropped for the statement phase. Release note: None
Previously, add column was not enabled by default with the declarative schema changer, which does not support the new MVCC back filler fully yet. This was inadequate, since we have a number of tests depending on the new backfiller now, which only works with the legacy schema changer. To address this, this patch will temporarily force the legacy schema changer for these tests. Additionally, update existing schame changer test related expected files. Release note: None
Collaborator
Author
|
@ajwerner @chengxiong-ruan TFTR! |
Collaborator
Author
|
bors r+ |
Contributor
|
Build succeeded: |
|
This is a huge step forward, great work! |
This was referenced May 23, 2022
Merged
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
May 23, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
May 25, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
craig bot
pushed a commit
that referenced
this pull request
May 25, 2022
81279: storage: specify and test iterator visibility semantics r=jbowens a=erikgrinaker `@jbowens` I split this out from the range key PR in #77417, since we'll need to audit/update existing code for the new point key batch semantics, and it seems cleaner/easier to do this separately. As you know, the test currently fails because existing batch iterators see concurrent batch writes. This only covers point keys, but range keys should have identical semantics, and the tests will be extended for range keys in #77417. --- This patch specifies and tests iterator visibility semantics. See comment on `Engine.NewMVCCIterator` for details. Release note: None 81403: kvserver: address assorted comments from previous refactor of `TransferLeaseTarget()` r=aayushshah15 a=aayushshah15 This commit addresses miscelleneous review comments from #80834. Release note: None 81679: sql: enforce nullability when evaluating expressions in index backfills r=ajwerner a=ajwerner Prior to this change, we never enforced nullability of values when performing index backfills. Up until #76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in #81675. 81777: util/metric: delete Rate r=andreimatei a=andreimatei This exponentially moving Rate was unused. It also was exporting to Prometheus as a gauge. It seems unlikely that we'll use this in the future; I think we're happy enough with counters and computing rates in the monitoring system. The Rate seems to have come from a time when we liked moving measurements more; since then, we've adapted the Histogram, for example, to include non-windowed state. Release note: None 81798: sql: enable streamer for lookup joins r=yuzefovich a=yuzefovich We've just fixed an issue with incorrectly using leaf txns for mutations because of the streamer, so I think it is ok to fully enable the streamer. I expect that there might be some fallout, so I'm curious to see the run of nightlies. Release note: None 81804: build: use bazel for roachtest stress r=rickystewart a=nicktrav Currently, the Roachtest Stress TeamCity job uses `make` (via the `mkrelease.sh` script) for building the required binaries. Recently, the pipeline started hanging while building the binary. Rather than investigating and fixing the existing `make`-based pipeline, convert the job to using Bazel for building the binaries. Retain the existing entrypoint to the job, converting it to use [the existing pattern][1] of calling `run_bazel` with the required environment variables, invoking an `_impl.sh` script. The existing logic is moved into the new `_impl.sh` script, with some minor additions to source some additional scripts. Additionally, the TeamCity job itself was updated to set pass in the `TARGET_CLOUD` environment variable (set to `gce`), and remove the need to build within a container (instead deferring to Bazel to manage the build environment). The diff for the TeamCity pipeline is as follows (for posterity): ```diff 18c18 < --- > <param name="env.TARGET_CLOUD" value="gce" /> 24c24 < <param name="plugin.docker.imageId" value="%builder.dockerImage%" /> --- > 28,29c28,29 < export BUILD_TAG="$(git describe --abbrev=0 --tags --match=v[0-9]*)" < ./build/teamcity-roachtest-stress.sh]]></param> --- > build_tag="$(git describe --abbrev=0 --tags --match=v[0-9]*)" > CLOUD=${TARGET_CLOUD} BUILD_TAG="${build_tag}" ./build/teamcity-roachtest-stress.sh]]></param> ``` Release note: None. [1]: https://github.com/cockroachdb/cockroach/blob/12198a51408e7333cd4f96b221e6734239479765/build/teamcity/cockroach/nightlies/roachtest_nightly_gce.sh#L10-L11 81813: liveness: run sync disk write in a stopper task r=stevendanna,nicktrav a=erikgrinaker **liveness: move stopper to `NodeLivenessOptions`** Release note: None **liveness: run sync disk write in a stopper task** This patch runs the sync disk write during node heartbeats in a stopper task. The write is done in a goroutine, so that we can respect the caller's context cancellation (even though the write itself won't). However, this could race with engine shutdown when stopping the node, violating the Pebble contract and triggering the race detector. Running it as a stopper task will cause the node to wait for the disk write to complete before closing the engine. Of course, if the disk stalls then node shutdown will now never complete. This is very unfortunate, since stopping the node is often the only mitigation to recover stuck ranges with stalled disks. This is mitigated by Pebble panic'ing the node on stalled disks, and Kubernetes and other orchestration tools killing the process after some time. Touches #81786. Resolves #81511. Resolves #81827. Release note: None 81828: sql: deflake TestPrimaryKeyDropIndexNotCancelable r=chengxiong-ruan a=ajwerner The problem was that we weren't atomically setting the boolean, at least, I think. I repro'd another flake of it pretty quickly. Release note: None Co-authored-by: Erik Grinaker <grinaker@cockroachlabs.com> Co-authored-by: Aayush Shah <aayush.shah15@gmail.com> Co-authored-by: Andrew Werner <awerner32@gmail.com> Co-authored-by: Andrei Matei <andrei@cockroachlabs.com> Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com> Co-authored-by: Nick Travers <travers@cockroachlabs.com> Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jun 28, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jun 28, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jul 7, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jul 7, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jul 7, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this pull request
Jul 7, 2022
Prior to this change, we never enforced nullability of values when performing index backfills. Up until cockroachdb#76983, all column additions used the legacy schema changer and its column backfill protocol. The column backfiller indeed checks on nullability violations for columns [here](https://github.com/cockroachdb/cockroach/blob/d5313438aaa61a71a5a66c5718963bbb0fd7268b/pkg/sql/backfill/backfill.go#L355-L357). Release note (bug fix): Prior to this change, virtual computed columns which were marked as NOT NULL could be added to new secondary index. After this change, attempts to add such columns to a secondary index will result in an error. Note that such invalid columns can still be added to tables. Work to resolve that bug is tracked in cockroachdb#81675.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes will enable add column by default in the declarative schema changer and the following fixes:
Along with the following known issues and limitations (tracked by issue: #80545)