Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
88454: ui: insights transaction details support multiple blocking transactions r=j82w a=j82w

This adds support for multiple blocking transactions for a single waiting transaction. The cards were merged into the table, and the data was piped through to show multiple rows. The total contention time was also fixed to aggregate the contention time instead of just picking the latest.

before:
https://loom.com/share/0384ed937a344e2fb0105fefbc313acb

after:
https://www.loom.com/share/78e906f50a694cd59ac893ddb9c2239a

closes #88264

Release justification: Category 2: Bug fixes and
low-risk updates to new functionality

Release note: (ui change): Add support for multiple
 blocking transaction on insights transaction
 details page. Merged the cards into the table,
 and fixed the total contention time.

88470: *: upgrade grpc to v1.47.0 r=erikgrinaker a=pavelkalinnikov

Fixes #81227

Release note: upgrade grpc from v1.46.0 to v.1.47.0 which fixes a subtle bug
causing panic on a nil pointer.

88477: keys: mark 49 as reserved r=ajwerner a=ajwerner

Release note: None

88496: persistedsqlstats: speed up a test r=yuzefovich a=yuzefovich

Previously, a single unit test could take on the order of 4 minutes (or even exceed 5 minute timeout, rarely) because the job monitor checks whether a cluster setting has been updated only every minute, and we update the cluster setting twice in a unit test. This commit makes it so that in a testing setup the check happens every second.

Release note: None

88499: bazel: upgrade `rules_go` r=rail a=healthy-pod

Pull in cockroachdb/rules_go#8.

Closes #88048

Release note: None

Co-authored-by: j82w <jwilley@cockroachlabs.com>
Co-authored-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
Co-authored-by: Andrew Werner <awerner32@gmail.com>
Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Co-authored-by: healthy-pod <ahmad@cockroachlabs.com>
  • Loading branch information
6 people committed Sep 22, 2022
6 parents 7823039 + 83f3f2f + a2089f9 + c1e88c0 + 1cc47c2 + 8cd7f30 commit dc1fd19
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 114 deletions.
24 changes: 12 additions & 12 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)

Expand Down
10 changes: 5 additions & 5 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down
12 changes: 12 additions & 0 deletions pkg/keys/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/sqlstats/persistedsqlstats/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 9 additions & 1 deletion pkg/sql/sqlstats/persistedsqlstats/scheduled_job_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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)
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand Down
5 changes: 5 additions & 0 deletions pkg/sql/sqlstats/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading

0 comments on commit dc1fd19

Please sign in to comment.