diff --git a/DEPS.bzl b/DEPS.bzl index b561038bc04e..0a7edc2253b1 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -9214,10 +9214,10 @@ def go_deps(): name = "org_golang_google_grpc", build_file_proto_mode = "disable_global", importpath = "google.golang.org/grpc", - sha256 = "f7bd2af40f0d6b16f7d771099e0ae7ed3468b9e40faf88be9d9759fffaff2a4a", - strip_prefix = "google.golang.org/grpc@v1.46.0", + sha256 = "30dde2a858d77414c283994f1ace3dd52f2fa75e43a9b13057d458525808917f", + strip_prefix = "google.golang.org/grpc@v1.47.0", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.46.0.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.47.0.zip", ], ) go_repository( @@ -9244,10 +9244,10 @@ def go_deps(): name = "org_golang_google_protobuf", build_file_proto_mode = "disable_global", importpath = "google.golang.org/protobuf", - sha256 = "f06dc39ce93043d6ec91a5106c7ec958be6b4ba520cab3a21a2448d387cf15a4", - strip_prefix = "google.golang.org/protobuf@v1.28.0", + sha256 = "bf386bcd36987f898e70c8330c6f7ada03e5112909f0a92b7510961403bf61da", + strip_prefix = "google.golang.org/protobuf@v1.28.1", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.0.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.1.zip", ], ) go_repository( @@ -9334,10 +9334,10 @@ def go_deps(): name = "org_golang_x_net", build_file_proto_mode = "disable_global", importpath = "golang.org/x/net", - sha256 = "1decf7a324a0916bc66304da1b68a834ce679379422de3a2855f3031f6dc39bd", - strip_prefix = "golang.org/x/net@v0.0.0-20220722155237-a158d28d115b", + sha256 = "a2aca21dfa7047e11a767e866b561195610da04db6963f579914c53fcf930539", + strip_prefix = "golang.org/x/net@v0.0.0-20220921203646-d300de134e69", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/net/org_golang_x_net-v0.0.0-20220722155237-a158d28d115b.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/net/org_golang_x_net-v0.0.0-20220921203646-d300de134e69.zip", ], ) go_repository( @@ -9374,10 +9374,10 @@ def go_deps(): name = "org_golang_x_sys", build_file_proto_mode = "disable_global", importpath = "golang.org/x/sys", - sha256 = "f4480597a942160a2aaeb761d41ee67f610287785c263f1df253a3e157c98594", - strip_prefix = "golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f", + sha256 = "4aeeb830ccb9693edde1127a1498a52f3d715664e091a033f99c4647a60f0032", + strip_prefix = "golang.org/x/sys@v0.0.0-20220919091848-fb04ddd9f9c8", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220722155257-8c9f86f7a55f.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220919091848-fb04ddd9f9c8.zip", ], ) go_repository( diff --git a/WORKSPACE b/WORKSPACE index bc98d417ce58..9520a1abbc7c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,12 +18,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Load go bazel tools. This gives us access to the go bazel SDK/toolchains. http_archive( name = "io_bazel_rules_go", - sha256 = "0f95eeba78dc5eeea37673039ac9db00eb25d1a2c65a7c44779678ad460ced95", - strip_prefix = "cockroachdb-rules_go-4e5db62", + sha256 = "8a11a59c977f90b09b05cc91901c36fd566683824993c76fa79bc0927e67726f", + strip_prefix = "cockroachdb-rules_go-c7e85b7", urls = [ - # cockroachdb/rules_go as of 4e5db6270b33b19f1ebcafee5dd97f54f990afdb + # cockroachdb/rules_go as of c7e85b7266f5eb686354c8e6f362ca3baaf47199 # (upstream release-0.34 plus a few patches). - "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-165-g4e5db62.tar.gz", + "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-167-gc7e85b7.tar.gz", ], ) diff --git a/build/bazelutil/distdir_files.bzl b/build/bazelutil/distdir_files.bzl index 6cbf401aef2b..29bff3942258 100644 --- a/build/bazelutil/distdir_files.bzl +++ b/build/bazelutil/distdir_files.bzl @@ -867,11 +867,11 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/lint/org_golang_x_lint-v0.0.0-20210508222113-6edffad5e616.zip": "0a4a5ebd2b1d79e7f480cbf5a54b45a257ae1ec9d11f01688efc5c35268d4603", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/mobile/org_golang_x_mobile-v0.0.0-20201217150744-e6ae53a27f4f.zip": "1fd2f665cdb7f64b80e2e1224941d1ecad10bd99327c6fc8906183d2ef3816df", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/mod/org_golang_x_mod-v0.6.0-dev.0.20220419223038-86c51ed26bb4.zip": "2b7471ed34a349f91055527c5328acd40e9aba006b644e51d40a8627efa76a92", - "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/net/org_golang_x_net-v0.0.0-20220722155237-a158d28d115b.zip": "1decf7a324a0916bc66304da1b68a834ce679379422de3a2855f3031f6dc39bd", + "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/net/org_golang_x_net-v0.0.0-20220921203646-d300de134e69.zip": "a2aca21dfa7047e11a767e866b561195610da04db6963f579914c53fcf930539", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/oauth2/org_golang_x_oauth2-v0.0.0-20220411215720-9780585627b5.zip": "81f60a99f4f3bcb34993ca5831386d8399c472a0ca4dc6f1e3659a071d002029", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/perf/org_golang_x_perf-v0.0.0-20180704124530-6e6d33e29852.zip": "a2c7d02cc94c4ba767b6322f70ddcba4941cb5f60fed1bada3aa7a4d3a8128f1", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sync/org_golang_x_sync-v0.0.0-20220513210516-0976fa681c29.zip": "71d4baca5c8f5ba665560e1bd96e3f73187d73d7dbc8f4a26faa73e5865b0749", - "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220722155257-8c9f86f7a55f.zip": "f4480597a942160a2aaeb761d41ee67f610287785c263f1df253a3e157c98594", + "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/sys/org_golang_x_sys-v0.0.0-20220919091848-fb04ddd9f9c8.zip": "4aeeb830ccb9693edde1127a1498a52f3d715664e091a033f99c4647a60f0032", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/term/org_golang_x_term-v0.0.0-20210927222741-03fcf44c2211.zip": "3adf713afa49fe26580ffe4adb1f4fb2f4921c945301aa5a9fb6d34031fa30cd", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/text/org_golang_x_text-v0.3.7.zip": "e1a9115e61a38da8bdc893d0ba83b65f89cc1114f152a98eb572c5ea6551e8d4", "https://storage.googleapis.com/cockroach-godeps/gomod/golang.org/x/time/org_golang_x_time-v0.0.0-20210723032227-1f47c861a9ac.zip": "e5d8ade42804ec7d96a632c031dde7db087e8bc4cd5dfd6f38df03ce4f16d9b6", @@ -886,8 +886,8 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/genproto/org_golang_google_genproto-v0.0.0-20220505152158-f39f71e6c8f3.zip": "8aa446ba7fe5a28d398eceefdad569b604bd4f9c0f86662db0d35fbf61d316cf", "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/cmd/protoc-gen-go-grpc/org_golang_google_grpc_cmd_protoc_gen_go_grpc-v1.1.0.zip": "13877d86cbfa30bde4d62fef2bc58dd56377dcb502c16cf78197f6934193009a", "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/examples/org_golang_google_grpc_examples-v0.0.0-20210324172016-702608ffae4d.zip": "f5cad7b05a93557c91864a02890a35c6bc5c394897222978cff2b880a78f7a11", - "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.46.0.zip": "f7bd2af40f0d6b16f7d771099e0ae7ed3468b9e40faf88be9d9759fffaff2a4a", - "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.0.zip": "f06dc39ce93043d6ec91a5106c7ec958be6b4ba520cab3a21a2448d387cf15a4", + "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/grpc/org_golang_google_grpc-v1.47.0.zip": "30dde2a858d77414c283994f1ace3dd52f2fa75e43a9b13057d458525808917f", + "https://storage.googleapis.com/cockroach-godeps/gomod/google.golang.org/protobuf/org_golang_google_protobuf-v1.28.1.zip": "bf386bcd36987f898e70c8330c6f7ada03e5112909f0a92b7510961403bf61da", "https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/DataDog/dd-trace-go.v1/in_gopkg_datadog_dd_trace_go_v1-v1.17.0.zip": "2ebcc818df0b2d560a61037da4492ae7effbaed67de94339a1d3a72728d2cb09", "https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/airbrake/gobrake.v2/in_gopkg_airbrake_gobrake_v2-v2.0.9.zip": "2db903664908e5a9afafefba94821b9579bbf271e2929c1f0b7b1fdd23f7bbcf", "https://storage.googleapis.com/cockroach-godeps/gomod/gopkg.in/alecthomas/kingpin.v2/in_gopkg_alecthomas_kingpin_v2-v2.2.6.zip": "638080591aefe7d2642f2575b627d534c692606f02ea54ba89f42db112ba8839", @@ -973,7 +973,7 @@ DISTDIR_FILES = { "https://storage.googleapis.com/public-bazel-artifacts/bazel/bmatcuk-doublestar-v4.0.1-0-gf7a8118.tar.gz": "d11c3b3a45574f89d6a6b2f50e53feea50df60407b35f36193bf5815d32c79d1", "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-protobuf-3f5d91f.tar.gz": "6d4e7fe1cbd958dee69ce9becbf8892d567f082b6782d3973a118d0aa00807a8", "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_foreign_cc-6f7f1b1.tar.gz": "272ac2cde4efd316c8d7c0140dee411c89da104466701ac179286ef5a89c7b58", - "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-165-g4e5db62.tar.gz": "0f95eeba78dc5eeea37673039ac9db00eb25d1a2c65a7c44779678ad460ced95", + "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-167-gc7e85b7.tar.gz": "8a11a59c977f90b09b05cc91901c36fd566683824993c76fa79bc0927e67726f", "https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_nodejs-5.5.0-1-g59a92cc.tar.gz": "7f3f747db3f924547b9ffdf86da6c604335ad95e09d4e5a69fdcfdb505099421", "https://storage.googleapis.com/public-bazel-artifacts/bazel/google-starlark-go-e043a3d.tar.gz": "a35c6468e0e0921833a63290161ff903295eaaf5915200bbce272cbc8dfd1c1c", "https://storage.googleapis.com/public-bazel-artifacts/bazel/platforms-0.0.4.tar.gz": "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d", diff --git a/go.mod b/go.mod index 7496aa1f0e7a..f289b7c67a97 100644 --- a/go.mod +++ b/go.mod @@ -158,19 +158,19 @@ require ( golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 golang.org/x/exp v0.0.0-20220104160115-025e73f80486 golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 - golang.org/x/net v0.0.0-20220722155237-a158d28d115b + golang.org/x/net v0.0.0-20220921203646-d300de134e69 golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852 golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 golang.org/x/text v0.3.7 golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac golang.org/x/tools v0.1.11 google.golang.org/api v0.80.0 google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3 - google.golang.org/grpc v1.46.0 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.47.0 + google.golang.org/protobuf v1.28.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 honnef.co/go/tools v0.3.2 diff --git a/go.sum b/go.sum index 9e68f3f37d2d..f2d67c1e6ae9 100644 --- a/go.sum +++ b/go.sum @@ -2519,8 +2519,9 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220921203646-d300de134e69 h1:hUJpGDpnfwdJW8iNypFjmSY0sCBEL+spFTZ2eO+Sfps= +golang.org/x/net v0.0.0-20220921203646-d300de134e69/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2711,8 +2712,10 @@ golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -3058,8 +3061,9 @@ google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.41.0-dev.0.20210907181116-2f3355d2244e/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d h1:CJP00gEaaYNJuaTXEg456rWNC1oUOfiAiUjuwyAhEmM= google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= @@ -3077,8 +3081,9 @@ google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX7 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/DataDog/dd-trace-go.v1 v1.17.0/go.mod h1:DVp8HmDh8PuTu2Z0fVVlBsyWaC++fzwVCaGWylTe3tg= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/pkg/keys/constants.go b/pkg/keys/constants.go index 67bbe31131c1..f2d6b7c86a6c 100644 --- a/pkg/keys/constants.go +++ b/pkg/keys/constants.go @@ -467,8 +467,20 @@ const ( SQLInstancesTableID = 46 SpanConfigurationsTableID = 47 RoleIDSequenceID = 48 + + // reservedSystemTableID is a sentinel constant to reserve the use of the + // last remaining constant reserved descriptor ID. In 22.1, we added support + // for creating system tables with dynamically allocated IDs. Use of this ID + // should be well motivated. There are cases where having a constant ID can + // dramatically simplify cluster bootstrap. Any table which is not going to + // be used quite early in the server startup process should not need a + // constant ID. Note that there are some values we could reclaim, like 9 and + // 10, but let's not go there unless we need to. + reservedSystemTableID = 49 ) +var _ = reservedSystemTableID // defeat the unused linter + // CommentType the type of the schema object on which a comment has been // applied. type CommentType int diff --git a/pkg/sql/sqlstats/persistedsqlstats/provider.go b/pkg/sql/sqlstats/persistedsqlstats/provider.go index eaaa3a665ceb..de9b04744267 100644 --- a/pkg/sql/sqlstats/persistedsqlstats/provider.go +++ b/pkg/sql/sqlstats/persistedsqlstats/provider.go @@ -93,6 +93,9 @@ func New(cfg *Config, memSQLStats *sslocal.SQLStats) *PersistedSQLStats { scanInterval: defaultScanInterval, jitterFn: p.jitterInterval, } + if cfg.Knobs != nil { + p.jobMonitor.testingKnobs.updateCheckInterval = cfg.Knobs.JobMonitorUpdateCheckInterval + } return p } diff --git a/pkg/sql/sqlstats/persistedsqlstats/scheduled_job_monitor.go b/pkg/sql/sqlstats/persistedsqlstats/scheduled_job_monitor.go index d61779d3bff6..0c0b2694ed11 100644 --- a/pkg/sql/sqlstats/persistedsqlstats/scheduled_job_monitor.go +++ b/pkg/sql/sqlstats/persistedsqlstats/scheduled_job_monitor.go @@ -65,6 +65,9 @@ type jobMonitor struct { db *kv.DB scanInterval time.Duration jitterFn func(time.Duration) time.Duration + testingKnobs struct { + updateCheckInterval time.Duration + } } func (j *jobMonitor) start(ctx context.Context, stopper *stop.Stopper) { @@ -80,6 +83,11 @@ func (j *jobMonitor) start(ctx context.Context, stopper *stop.Stopper) { timer.Reset(0) defer timer.Stop() + updateCheckInterval := time.Minute + if j.testingKnobs.updateCheckInterval != 0 { + updateCheckInterval = j.testingKnobs.updateCheckInterval + } + // This loop runs every minute to check if we need to update the job schedule. // We only hit the jobs table if the schedule needs to be updated due to a // change in the recurrence cluster setting or as a scheduled check to @@ -97,7 +105,7 @@ func (j *jobMonitor) start(ctx context.Context, stopper *stop.Stopper) { currentRecurrence = SQLStatsCleanupRecurrence.Get(&j.st.SV) } - timer.Reset(time.Minute) + timer.Reset(updateCheckInterval) } }) } diff --git a/pkg/sql/sqlstats/persistedsqlstats/scheduled_sql_stats_compaction_test.go b/pkg/sql/sqlstats/persistedsqlstats/scheduled_sql_stats_compaction_test.go index 47fdfb692b28..10a2a1e2e8a3 100644 --- a/pkg/sql/sqlstats/persistedsqlstats/scheduled_sql_stats_compaction_test.go +++ b/pkg/sql/sqlstats/persistedsqlstats/scheduled_sql_stats_compaction_test.go @@ -181,8 +181,7 @@ func TestSQLStatsScheduleOperations(t *testing.T) { skip.UnderStressRace(t, "test is too slow to run under race") ctx := context.Background() - helper, helperCleanup := newTestHelper(t, nil /* sqlStatsKnobs */) - helper.sqlDB.SucceedsSoonDuration = 2 * time.Minute + helper, helperCleanup := newTestHelper(t, &sqlstats.TestingKnobs{JobMonitorUpdateCheckInterval: time.Second}) defer helperCleanup() schedID := getSQLStatsCompactionSchedule(t, helper).ScheduleID() @@ -218,7 +217,7 @@ func TestSQLStatsScheduleOperations(t *testing.T) { helper.sqlDB.Exec(t, "SET CLUSTER SETTING sql.stats.cleanup.recurrence = $1", expr) var err error - testutils.SucceedsWithin(t, func() error { + testutils.SucceedsSoon(t, func() error { // Reload schedule from DB. sj := getSQLStatsCompactionSchedule(t, helper) err = persistedsqlstats.CheckScheduleAnomaly(sj) @@ -227,7 +226,7 @@ func TestSQLStatsScheduleOperations(t *testing.T) { } require.Equal(t, expr, sj.ScheduleExpr()) return nil - }, time.Minute*2) + }) require.True(t, errors.Is( errors.Unwrap(err), persistedsqlstats.ErrScheduleIntervalTooLong), diff --git a/pkg/sql/sqlstats/test_utils.go b/pkg/sql/sqlstats/test_utils.go index 47f12a714c20..b024e6f30886 100644 --- a/pkg/sql/sqlstats/test_utils.go +++ b/pkg/sql/sqlstats/test_utils.go @@ -33,6 +33,11 @@ type TestingKnobs struct { // AOSTClause overrides the AS OF SYSTEM TIME clause in queries used in // persistedsqlstats. AOSTClause string + + // JobMonitorUpdateCheckInterval if non-zero indicates the frequency at + // which the job monitor needs to check whether the schedule needs to be + // updated. + JobMonitorUpdateCheckInterval time.Duration } // ModuleTestingKnobs implements base.ModuleTestingKnobs interface. diff --git a/pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts b/pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts index 67cf23d6c969..30611bc15ee1 100644 --- a/pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts +++ b/pkg/ui/workspaces/cluster-ui/src/api/insightsApi.ts @@ -10,13 +10,14 @@ import { executeInternalSql, - SqlExecutionRequest, - SqlExecutionResponse, INTERNAL_SQL_API_APP, - LONG_TIMEOUT, LARGE_RESULT_SIZE, + LONG_TIMEOUT, + SqlExecutionRequest, + SqlExecutionResponse, } from "./sqlApi"; import { + BlockedContentionDetails, InsightExecEnum, InsightNameEnum, StatementInsightEvent, @@ -57,22 +58,25 @@ const txnContentionQuery = `SELECT * FROM (SELECT waiting_txn_id, encode( waiting_txn_fingerprint_id, 'hex' - ) AS waiting_txn_fingerprint_id, + ) AS waiting_txn_fingerprint_id, collection_ts, - contention_duration, - row_number() over ( - PARTITION BY waiting_txn_fingerprint_id - ORDER BY - collection_ts DESC - ) AS rank, - threshold + total_contention_duration AS contention_duration, + row_number() over ( + PARTITION BY waiting_txn_fingerprint_id + ORDER BY + collection_ts DESC + ) AS rank, threshold FROM (SELECT "sql.insights.latency_threshold" :: INTERVAL AS threshold FROM [SHOW CLUSTER SETTING sql.insights.latency_threshold]), - (SELECT DISTINCT ON (waiting_txn_id) * - FROM crdb_internal.transaction_contention_events tce), + (SELECT waiting_txn_id, + waiting_txn_fingerprint_id, + max(collection_ts) AS collection_ts, + sum(contention_duration) AS total_contention_duration + FROM crdb_internal.transaction_contention_events tce + GROUP BY waiting_txn_id, waiting_txn_fingerprint_id), (SELECT txn_id FROM crdb_internal.cluster_execution_insights) - WHERE contention_duration > threshold + WHERE total_contention_duration > threshold OR waiting_txn_id = txn_id) WHERE rank = 1`; @@ -352,24 +356,47 @@ type TxnContentionDetailsResponseColumns = { function transactionContentionDetailsResultsToEventState( response: SqlExecutionResponse, ): TransactionContentionEventDetailsResponse { - if (!response.execution.txn_results[0].rows) { + const resultsRows = response.execution.txn_results[0].rows; + if (!resultsRows) { // No data. return; } - const row = response.execution.txn_results[0].rows[0]; + + const blockingContentionDetails = new Array( + resultsRows.length, + ); + + let totalContentionTime = 0; + resultsRows.forEach((value, idx) => { + const contentionTimeInMs = moment + .duration(value.contention_duration) + .asMilliseconds(); + totalContentionTime += contentionTimeInMs; + blockingContentionDetails[idx] = { + blockingExecutionID: value.blocking_txn_id, + blockingFingerprintID: value.blocking_txn_fingerprint_id, + blockingQueries: null, + collectionTimeStamp: moment(value.collection_ts), + contentionTimeMs: contentionTimeInMs, + contendedKey: value.key, + schemaName: value.schema_name, + databaseName: value.database_name, + tableName: value.table_name, + indexName: + value.index_name && value.index_name !== "" + ? value.index_name + : "primary index", + }; + }); + + const row = resultsRows[0]; return { executionID: row.waiting_txn_id, fingerprintID: row.waiting_txn_fingerprint_id, startTime: moment(row.collection_ts), - elapsedTime: moment.duration(row.contention_duration).asMilliseconds(), + totalContentionTime: totalContentionTime, + blockingContentionDetails: blockingContentionDetails, contentionThreshold: moment.duration(row.threshold).asMilliseconds(), - blockingExecutionID: row.blocking_txn_id, - blockingFingerprintID: row.blocking_txn_fingerprint_id, - schemaName: row.schema_name, - databaseName: row.database_name, - tableName: row.table_name, - indexName: row.index_name, - contendedKey: row.key, insightName: InsightNameEnum.highContention, execType: InsightExecEnum.TRANSACTION, }; @@ -425,9 +452,13 @@ export function getTransactionInsightEventDetailsState( return executeInternalSql( waitingFingerprintStmtsRequest, ).then(waitingTxnStmtQueries => { - const blockingTxnFingerprintId = - contentionResults.execution.txn_results[0].rows[0] - .blocking_txn_fingerprint_id; + let blockingTxnFingerprintId: string[] = []; + contentionResults.execution.txn_results.forEach(txnResult => { + blockingTxnFingerprintId = blockingTxnFingerprintId.concat( + txnResult.rows.map(x => x.blocking_txn_fingerprint_id), + ); + }); + const blockingTxnFingerprintRequest: SqlExecutionRequest = { statements: [ { @@ -441,9 +472,17 @@ export function getTransactionInsightEventDetailsState( return executeInternalSql( blockingTxnFingerprintRequest, ).then(blockingTxnStmtFingerprintIDs => { - const blockingStmtFingerprintIDs = - blockingTxnStmtFingerprintIDs.execution.txn_results[0].rows[0] - .query_ids; + let blockingStmtFingerprintIDs: string[] = []; + blockingTxnStmtFingerprintIDs.execution.txn_results[0].rows.map( + row => { + if (row.query_ids && row.query_ids.length > 0) { + blockingStmtFingerprintIDs = blockingStmtFingerprintIDs.concat( + row.query_ids, + ); + } + }, + ); + const blockingFingerprintStmtsRequest: SqlExecutionRequest = { statements: [ { @@ -492,6 +531,25 @@ export function combineTransactionInsightEventDetailsState( waitingFingerprintStmtState && blockingFingerprintStmtState ) { + txnContentionDetailsState.blockingContentionDetails.forEach(blockedRow => { + const currBlockedFingerprintStmts = blockingTxnFingerprintState.filter( + x => x.fingerprintID === blockedRow.blockingFingerprintID, + ); + if ( + !currBlockedFingerprintStmts || + currBlockedFingerprintStmts.length != 1 + ) { + return; + } + + blockedRow.blockingQueries = currBlockedFingerprintStmts[0].queryIDs.map( + id => + blockingFingerprintStmtState.find( + stmt => stmt.stmtFingerprintID === id, + )?.query, + ); + }); + res = { ...txnContentionDetailsState, application: waitingTxnFingerprintState[0].application, @@ -501,12 +559,6 @@ export function combineTransactionInsightEventDetailsState( stmt => stmt.stmtFingerprintID === id, )?.query, ), - blockingQueries: blockingTxnFingerprintState[0].queryIDs.map( - id => - blockingFingerprintStmtState.find( - stmt => stmt.stmtFingerprintID === id, - )?.query, - ), }; } return res; diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/types.ts b/pkg/ui/workspaces/cluster-ui/src/insights/types.ts index b8f456c6b830..a6f3ad69f6a9 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/types.ts +++ b/pkg/ui/workspaces/cluster-ui/src/insights/types.ts @@ -38,15 +38,8 @@ export type TransactionInsightEvent = { execType: InsightExecEnum; }; -export type TransactionInsightEventDetails = { - executionID: string; - queries: string[]; - insights: Insight[]; - startTime: Moment; - elapsedTime: number; - contentionThreshold: number; - application: string; - fingerprintID: string; +export type BlockedContentionDetails = { + collectionTimeStamp: Moment; blockingExecutionID: string; blockingFingerprintID: string; blockingQueries: string[]; @@ -55,6 +48,19 @@ export type TransactionInsightEventDetails = { databaseName: string; tableName: string; indexName: string; + contentionTimeMs: number; +}; + +export type TransactionInsightEventDetails = { + executionID: string; + queries: string[]; + insights: Insight[]; + startTime: Moment; + totalContentionTime: number; + contentionThreshold: number; + application: string; + fingerprintID: string; + blockingContentionDetails: BlockedContentionDetails[]; execType: InsightExecEnum; }; @@ -97,7 +103,11 @@ export type EventExecution = { fingerprintID: string; queries: string[]; startTime: Moment; - elapsedTime: number; + contentionTimeMs: number; + schemaName: string; + databaseName: string; + tableName: string; + indexName: string; execType: InsightExecEnum; }; diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx index 901834f8261f..eec85d95e76e 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/insightDetailsTables.tsx @@ -42,16 +42,40 @@ export function makeInsightDetailsColumns( sort: (item: EventExecution) => item.queries.length, }, { - name: "startTime", - title: insightsTableTitles.startTime(execType), + name: "contentionStartTime", + title: insightsTableTitles.contentionStartTime(execType), cell: (item: EventExecution) => item.startTime.format(DATE_FORMAT), sort: (item: EventExecution) => item.startTime.unix(), }, { - name: "elapsedTime", - title: insightsTableTitles.elapsedTime(execType), - cell: (item: EventExecution) => Duration(item.elapsedTime * 1e6), - sort: (item: EventExecution) => item.elapsedTime, + name: "contention", + title: insightsTableTitles.contention(execType), + cell: (item: EventExecution) => Duration(item.contentionTimeMs * 1e6), + sort: (item: EventExecution) => item.contentionTimeMs, + }, + { + name: "schemaName", + title: insightsTableTitles.schemaName(execType), + cell: (item: EventExecution) => item.schemaName, + sort: (item: EventExecution) => item.schemaName, + }, + { + name: "databaseName", + title: insightsTableTitles.databaseName(execType), + cell: (item: EventExecution) => item.databaseName, + sort: (item: EventExecution) => item.databaseName, + }, + { + name: "tableName", + title: insightsTableTitles.tableName(execType), + cell: (item: EventExecution) => item.tableName, + sort: (item: EventExecution) => item.tableName, + }, + { + name: "indexName", + title: insightsTableTitles.indexName(execType), + cell: (item: EventExecution) => item.indexName, + sort: (item: EventExecution) => item.indexName, }, ]; } diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx index 6487ed54f322..8e2394b913c1 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetails.tsx @@ -15,17 +15,13 @@ import { Heading } from "@cockroachlabs/ui-components"; import { Col, Row } from "antd"; import "antd/lib/col/style"; import "antd/lib/row/style"; -import moment from "moment"; import { Button } from "src/button"; import { Loading } from "src/loading"; import { SqlBox, SqlBoxSize } from "src/sql"; import { SummaryCard, SummaryCardItem } from "src/summaryCard"; import { DATE_FORMAT_24_UTC } from "src/util/format"; import { getMatchParamByName } from "src/util/query"; -import { - WaitTimeInsightsLabels, - WaitTimeInsightsPanel, -} from "src/detailsPanels/waitTimeInsightsPanel"; +import { WaitTimeInsightsLabels } from "src/detailsPanels/waitTimeInsightsPanel"; import { TransactionInsightEventDetailsRequest, TransactionInsightEventDetailsResponse, @@ -107,7 +103,7 @@ export class TransactionInsightDetails extends React.Component { + return { + executionID: x.blockingExecutionID, + fingerprintID: x.blockingFingerprintID, + queries: x.blockingQueries, + startTime: x.collectionTimeStamp, + contentionTimeMs: x.contentionTimeMs, + execType: insightDetails.execType, + schemaName: x.schemaName, + databaseName: x.databaseName, + tableName: x.tableName, + indexName: x.indexName, + }; + }); + return ( <>
@@ -164,17 +166,6 @@ export class TransactionInsightDetails extends React.Component
- diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/util/insightsColumns.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/util/insightsColumns.tsx index f87cb658eed6..230ff4c35b2b 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/util/insightsColumns.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/util/insightsColumns.tsx @@ -27,7 +27,12 @@ export const insightsColumnLabels = { numRetries: "Retries", isFullScan: "Full Scan", contention: "Contention Time", + contentionStartTime: "Contention Start Time (UTC)", rowsProcessed: "Rows Processed", + schemaName: "Schema Name", + databaseName: "Database Name", + tableName: "Table Name", + indexName: "Index Name", }; export type InsightsTableColumnKeys = keyof typeof insightsColumnLabels; @@ -99,6 +104,12 @@ export const insightsTableTitles: InsightsTableTitleType = { "startTime", ); }, + contentionStartTime: (execType: InsightExecEnum) => { + return makeToolTip( +

The timestamp at which contention was detected for the {execType}.

, + "contentionStartTime", + ); + }, elapsedTime: (execType: InsightExecEnum) => { return makeToolTip(

The time elapsed since the {execType} started execution.

, @@ -111,6 +122,21 @@ export const insightsTableTitles: InsightsTableTitleType = { "username", ); }, + schemaName: (execType: InsightExecEnum) => { + return makeToolTip(

The name of the contended schema.

, "schemaName"); + }, + databaseName: (execType: InsightExecEnum) => { + return makeToolTip( +

The name of the contended database.

, + "databaseName", + ); + }, + tableName: (execType: InsightExecEnum) => { + return makeToolTip(

The name of the contended table.

, "tableName"); + }, + indexName: (execType: InsightExecEnum) => { + return makeToolTip(

The name of the contended index.

, "indexName"); + }, applicationName: (execType: InsightExecEnum) => { return makeToolTip(

The name of the application that ran the {execType}.

, diff --git a/vendor b/vendor index 28841d69c13d..cdfaa946914d 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 28841d69c13d355384d9bbf41862558bfbb48aa7 +Subproject commit cdfaa946914d4c746b329befd64400f876e53d76