diff --git a/AUTHORS b/AUTHORS index e0053f3fe244..cdb2cef7f6bd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -34,6 +34,7 @@ Adam Spindler Adam Storm Adam Yao Aditya Maru <@cockroachlabs.com> +Adwit Tumuluri <@cockroachlabs.com> Aid Idrizović Ajaya Agrawal Alan Acosta @@ -41,6 +42,7 @@ Alex Barganier Alex Gaynor Alex Lunev Alex Robinson <@cockroachlabs.com> +Alex Sarkesian Alex Yarosh Alfonso Subiotto Marqués Alfonso Subiotto Marques Alyshan Jahani @@ -120,6 +122,7 @@ Dmitry Vorobev Dominique Luna Dong Liang Drew Kimball +Duoc Nguyen Dustin Hiatt Eamon Zhang EamonZhang Eli Lindsey @@ -168,6 +171,7 @@ Jay Kominek Jay Lim <6175557+imjching@users.noreply.github.com> Jay Rauchenstein Jayant Shrivastava +Jeff Swenson Jeffrey Dallatezza Jeffrey Xiao <@cockroachlabs.com> Jennifer Georgevich @@ -218,6 +222,7 @@ Lasantha Pambagoda Lauren Hirata Lauren lhirata Lee Reilly Levon Lloyd +Liv Lobo liyanan Lizhong Louis Hust louishust @@ -243,6 +248,7 @@ Matt Jibson <@cockroachlabs.com> Matt Sherman Matt Tracy Matthew O'Connor +Matthew Todd Max Lang Mayank Oli mbonaci @@ -254,6 +260,7 @@ Mo Firouz Mohamed Elqdusy Monica Xu Namrata Kodali +Nancy Vargas Balderas Nandu Pokhrel Nate Stewart Nate Nathan Johnson @@ -343,6 +350,7 @@ Thomas Hardy Tim O'Brien <38867162+tim-o@users.noreply.github.com> tim-o <38867162+tim-o@users.noreply.github.com> <@cockroachlabs.com> Tommy Reilly Tommy Truongchau +Toshi Noguchi Timothy Chen Tobias Grieger Tristan Ohlson <@cockroachlabs.com> diff --git a/build/release/teamcity-publish-release.sh b/build/release/teamcity-publish-release.sh index c13f7e5cf669..d341bca59ce2 100755 --- a/build/release/teamcity-publish-release.sh +++ b/build/release/teamcity-publish-release.sh @@ -59,6 +59,8 @@ tc_end_block "Variable Setup" tc_start_block "Check remote tag" +github_ssh_key="${GITHUB_COCKROACH_TEAMCITY_PRIVATE_SSH_KEY}" +configure_git_ssh_key if git_wrapped ls-remote --exit-code --tags "ssh://git@github.com/${git_repo_for_tag}.git" "${build_name}"; then echo "Tag ${build_name} already exists" exit 1 @@ -110,8 +112,6 @@ tc_end_block "Make and push docker images" tc_start_block "Push release tag to GitHub" -github_ssh_key="${GITHUB_COCKROACH_TEAMCITY_PRIVATE_SSH_KEY}" -configure_git_ssh_key git_wrapped push "ssh://git@github.com/${git_repo_for_tag}.git" "$build_name" tc_end_block "Push release tag to GitHub" diff --git a/cloud/kubernetes/prometheus/README.md b/cloud/kubernetes/prometheus/README.md index c29d5cfbd02f..a43dee6c8896 100644 --- a/cloud/kubernetes/prometheus/README.md +++ b/cloud/kubernetes/prometheus/README.md @@ -34,10 +34,13 @@ one another, we'd have two different prometheus jobs that had duplicated backends. * `kubectl label svc cockroachdb prometheus=cockroachdb` +Check for the latest Prometheus Operator +[release version](https://github.com/prometheus-operator/prometheus-operator/blob/master/RELEASE.md). +Specify the version number in the below command. Install Prometheus Operator: * `kubectl apply -f -https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.20/bundle.yaml` +https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.47.1/bundle.yaml` Ensure that the instance of prometheus-operator has started before continuing. The `kubectl get` command and its desired output is below: diff --git a/cloud/kubernetes/prometheus/prometheus.yaml b/cloud/kubernetes/prometheus/prometheus.yaml index b7cac8c28d24..c2073a9cbcee 100644 --- a/cloud/kubernetes/prometheus/prometheus.yaml +++ b/cloud/kubernetes/prometheus/prometheus.yaml @@ -60,11 +60,12 @@ spec: - port: http path: /_status/vars tlsConfig: - # The HTTPS certs are signed by the kubernetes internal - # certificate authority. - caFile: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" - # This overrides the hostname verification check for the admin - # UI port to match our quickstart secure-mode cluster setup. + ca: + secret: + key: ca.crt + # This is the secret name used by the CockroachDB Kubernetes Operator. + # When using a custom CA, replace this with your secret name + name: cockroachdb-node serverName: "127.0.0.1" --- # Have prometheus-operator run a replicated Prometheus cluster diff --git a/pkg/sql/backfill/backfill.go b/pkg/sql/backfill/backfill.go index 4ab3570355f1..56e71697d82d 100644 --- a/pkg/sql/backfill/backfill.go +++ b/pkg/sql/backfill/backfill.go @@ -108,9 +108,13 @@ func (cb *ColumnBackfiller) init( cb.updateExprs[j+len(cb.added)] = tree.DNull } - // We need all the columns. + // We need all the non-virtual columns. var valNeededForCol util.FastIntSet - valNeededForCol.AddRange(0, len(desc.PublicColumns())-1) + for i, c := range desc.PublicColumns() { + if !c.IsVirtual() { + valNeededForCol.Add(i) + } + } tableArgs := row.FetcherTableArgs{ Desc: desc, diff --git a/pkg/sql/logictest/testdata/logic_test/alter_table b/pkg/sql/logictest/testdata/logic_test/alter_table index 3a3f24f54389..d4709a9abd2e 100644 --- a/pkg/sql/logictest/testdata/logic_test/alter_table +++ b/pkg/sql/logictest/testdata/logic_test/alter_table @@ -1812,3 +1812,19 @@ CREATE TABLE duplicate_index_test (k INT PRIMARY KEY, v INT, INDEX idx (v)); statement error pgcode 42P07 duplicate index name: \"idx\" ALTER TABLE duplicate_index_test ADD CONSTRAINT idx UNIQUE (v) + +# Regression test for a bug which occurred when adding a foreign key +# constraint which is marked NOT VALID and is self-referencing. +subtest self_reference_fk_not_valid + +statement ok +DROP TABLE IF EXISTS t; +CREATE TABLE t (i INT PRIMARY KEY, j INT); +ALTER TABLE t ADD CONSTRAINT fk FOREIGN KEY (j) REFERENCES t(i) NOT VALID; + +# Demonstrate that the constraint is enforced. +statement error pgcode 23503 insert on table "t" violates foreign key constraint "fk" +INSERT INTO t VALUES (1, 0) + +statement ok +DROP TABLE t; diff --git a/pkg/sql/logictest/testdata/logic_test/virtual_columns b/pkg/sql/logictest/testdata/logic_test/virtual_columns index 0d92c1b12f01..25d11f219a65 100644 --- a/pkg/sql/logictest/testdata/logic_test/virtual_columns +++ b/pkg/sql/logictest/testdata/logic_test/virtual_columns @@ -1175,3 +1175,21 @@ CREATE TABLE public.t63167_b ( CONSTRAINT "primary" PRIMARY KEY (rowid ASC), FAMILY "primary" (a, rowid) ) + +# Test that columns backfills to tables with virtual columns work. +subtest column_backfill + +statement ok +CREATE TABLE t_65915 (i INT PRIMARY KEY, j INT AS (i + 1) VIRTUAL NOT NULL); +INSERT INTO t_65915 VALUES (1) + +statement ok +ALTER TABLE t_65915 ADD COLUMN k INT DEFAULT 42; + +query III +SELECT * FROM t_65915; +---- +1 2 42 + +statement ok +DROP TABLE t_65915 diff --git a/pkg/sql/schema_changer.go b/pkg/sql/schema_changer.go index a9f3ef6aef80..b2d806ffc15d 100644 --- a/pkg/sql/schema_changer.go +++ b/pkg/sql/schema_changer.go @@ -1102,8 +1102,10 @@ func (sc *SchemaChanger) done(ctx context.Context) error { return err } backrefTable.InboundFKs = append(backrefTable.InboundFKs, constraint.ForeignKey()) - if err := descsCol.WriteDescToBatch(ctx, kvTrace, backrefTable, b); err != nil { - return err + if backrefTable != scTable { + if err := descsCol.WriteDescToBatch(ctx, kvTrace, backrefTable, b); err != nil { + return err + } } } }