Skip to content

Commit e7cb6d4

Browse files
craig[bot]arulajmaniangles-n-daemonsRaduBerindeyuzefovich
committed
153745: concurrency: make the lock table limit configurable and add metrics r=stevendanna a=arulajmani See individual commits for details. 154541: unsafesql: avoid panicking during query formatting r=angles-n-daemons a=angles-n-daemons Part of the effort to guard access to the crdb_internal and system namespaces includes auditing override access (and denied access) to these unsafe internals. Included in this audit is the offending query which attempted to pry into these namespaces. In multiple locations however, this auditing caused the system to panic, for different reasons. In one case, an incorrect number of annotations on the query caused a panic. Another included a plan builder which had no associated statement. We see the process of going from plan -> query as a difficult one, and thus guard this attempt to audit these accesses in a blanket panic catcher, as it's not common that this will happen, and when it does we don't want the system to wholesale fail the query. Fixes: #153590 Epic: CRDB-24527 Release note: none 154740: go.mod: bump Pebble to 0ac45a74e10a r=RaduBerinde a=RaduBerinde Changes: * [`0ac45a74`](cockroachdb/pebble@0ac45a74) metrics: fix TestMetrics flake * [`98c989b1`](cockroachdb/pebble@98c989b1) metamorphic: fix bug in suffix generation when prefix == startPrefix * [`d37d2f4b`](cockroachdb/pebble@d37d2f4b) pebble: materialize virtual tables only if backing contains >= 30% garbage Release note: none. Epic: none. 154877: roachtest/pg_regress: accept recent diff r=yuzefovich a=yuzefovich Fixes: #154808. Release note: None 154880: dev-inf: Add Vertex AI environment variables to Claude Code action r=rickystewart a=ajstorm The Claude Code action requires ANTHROPIC_VERTEX_PROJECT_ID and CLOUD_ML_REGION to be set when using Vertex AI. Added these environment variables to all four action steps. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Arul Ajmani <[email protected]> Co-authored-by: Brian Dillmann <[email protected]> Co-authored-by: Radu Berinde <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]> Co-authored-by: Adam Storm <[email protected]>
6 parents 58a3f6f + ee80cea + 96ffcb5 + fdd44c4 + a5c9a64 + ffa3a87 commit e7cb6d4

File tree

17 files changed

+282
-74
lines changed

17 files changed

+282
-74
lines changed

.github/workflows/pr-analyzer-threestage.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Stage 1 - Initial Bug Screening
3030
id: stage1
3131
uses: cockroachdb/claude-code-action@v1
32+
env:
33+
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
34+
CLOUD_ML_REGION: global
3235
with:
3336
github_token: ${{ secrets.GITHUB_TOKEN }}
3437
use_vertex: "true"
@@ -63,6 +66,9 @@ jobs:
6366
id: stage2
6467
if: contains(steps.stage1.outputs.result, 'STAGE1_RESULT - POTENTIAL_BUG_DETECTED')
6568
uses: cockroachdb/claude-code-action@v1
69+
env:
70+
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
71+
CLOUD_ML_REGION: global
6672
with:
6773
github_token: ${{ secrets.GITHUB_TOKEN }}
6874
use_vertex: "true"
@@ -98,6 +104,9 @@ jobs:
98104
id: stage3
99105
if: contains(steps.stage2.outputs.result, 'STAGE2_RESULT - POTENTIAL_BUG_DETECTED')
100106
uses: cockroachdb/claude-code-action@v1
107+
env:
108+
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
109+
CLOUD_ML_REGION: global
101110
with:
102111
github_token: ${{ secrets.GITHUB_TOKEN }}
103112
use_vertex: "true"
@@ -147,6 +156,9 @@ jobs:
147156
- name: Final Analysis Report
148157
if: always()
149158
uses: cockroachdb/claude-code-action@v1
159+
env:
160+
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
161+
CLOUD_ML_REGION: global
150162
with:
151163
github_token: ${{ secrets.GITHUB_TOKEN }}
152164
use_vertex: "true"

DEPS.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,10 +1834,10 @@ def go_deps():
18341834
patches = [
18351835
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch",
18361836
],
1837-
sha256 = "1fcaa5c3baecb9719f8aa46b75020d0a87927e5e2496bcfa82e689d2ffea9c6b",
1838-
strip_prefix = "github.com/cockroachdb/[email protected]20251002180823-347d5dc77850",
1837+
sha256 = "ca8b29434d9447e2e943160fa26b234cb9296d7e919e58ca2dda023a95776920",
1838+
strip_prefix = "github.com/cockroachdb/[email protected]20251002220049-0ac45a74e10a",
18391839
urls = [
1840-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002180823-347d5dc77850.zip",
1840+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002220049-0ac45a74e10a.zip",
18411841
],
18421842
)
18431843
go_repository(

build/bazelutil/distdir_files.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ DISTDIR_FILES = {
356356
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.19.0.zip": "c4d516bcfe8c07b6fc09b8a9a07a95065b36c2855627cb3514e40c98f872b69e",
357357
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20241215232642-bb51bb14a506.zip": "920068af09e3846d9ebb4e4a7787ff1dd10f3989c5f940ad861b0f6a9f824f6e",
358358
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/metamorphic/com_github_cockroachdb_metamorphic-v0.0.0-20231108215700-4ba948b56895.zip": "28c8cf42192951b69378cf537be5a9a43f2aeb35542908cc4fe5f689505853ea",
359-
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002180823-347d5dc77850.zip": "1fcaa5c3baecb9719f8aa46b75020d0a87927e5e2496bcfa82e689d2ffea9c6b",
359+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20251002220049-0ac45a74e10a.zip": "ca8b29434d9447e2e943160fa26b234cb9296d7e919e58ca2dda023a95776920",
360360
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.6.zip": "018eccb5fb9ca52d43ec9eaf213539d01c1f2b94e0e822406ebfb2e9321ef6cf",
361361
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/returncheck/com_github_cockroachdb_returncheck-v0.0.0-20200612231554-92cdbca611dd.zip": "ce92ba4352deec995b1f2eecf16eba7f5d51f5aa245a1c362dfe24c83d31f82b",
362362
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/stress/com_github_cockroachdb_stress-v0.0.0-20220803192808-1806698b1b7b.zip": "3fda531795c600daf25532a4f98be2a1335cd1e5e182c72789bca79f5f69fcc1",

docs/generated/metrics/metrics.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12312,6 +12312,14 @@ layers:
1231212312
unit: COUNT
1231312313
aggregation: AVG
1231412314
derivative: NONE
12315+
- name: kv.concurrency.locks_shed_due_to_memory_limit
12316+
exported_name: kv_concurrency_locks_shed_due_to_memory_limit
12317+
description: The number of locks that were shed because the lock table ran into memory limits
12318+
y_axis_label: Locks
12319+
type: COUNTER
12320+
unit: COUNT
12321+
aggregation: AVG
12322+
derivative: NON_NEGATIVE_DERIVATIVE
1231512323
- name: kv.concurrency.locks_with_wait_queues
1231612324
exported_name: kv_concurrency_locks_with_wait_queues
1231712325
description: Number of active locks held in lock tables with active wait-queues
@@ -12344,6 +12352,14 @@ layers:
1234412352
unit: COUNT
1234512353
aggregation: AVG
1234612354
derivative: NONE
12355+
- name: kv.concurrency.num_lock_shed_due_to_memory_limit_events
12356+
exported_name: kv_concurrency_num_lock_shed_due_to_memory_limit_events
12357+
description: The number of times locks that were shed by the lock table because it ran into memory limits
12358+
y_axis_label: Lock Shed Events
12359+
type: COUNTER
12360+
unit: COUNT
12361+
aggregation: AVG
12362+
derivative: NON_NEGATIVE_DERIVATIVE
1234712363
- name: kv.loadsplitter.cleardirection
1234812364
exported_name: kv_loadsplitter_cleardirection
1234912365
description: Load-based splitter observed an access direction greater than 80% left or right in the samples.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ require (
142142
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
143143
github.com/cockroachdb/gostdlib v1.19.0
144144
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506
145-
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850
145+
github.com/cockroachdb/pebble v0.0.0-20251002220049-0ac45a74e10a
146146
github.com/cockroachdb/redact v1.1.6
147147
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
148148
github.com/cockroachdb/stress v0.0.0-20220803192808-1806698b1b7b

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 h1:ASDL+UJcILM
577577
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506/go.mod h1:Mw7HqKr2kdtu6aYGn3tPmAftiP3QPX63LdK/zcariIo=
578578
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895 h1:XANOgPYtvELQ/h4IrmPAohXqe2pWA8Bwhejr3VQoZsA=
579579
github.com/cockroachdb/metamorphic v0.0.0-20231108215700-4ba948b56895/go.mod h1:aPd7gM9ov9M8v32Yy5NJrDyOcD8z642dqs+F0CeNXfA=
580-
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850 h1:pT7rhCsjLQJrmTxV79g6d0oSBSgJ4Mqqs448ADowab0=
581-
github.com/cockroachdb/pebble v0.0.0-20251002180823-347d5dc77850/go.mod h1:H/DxkYtsYVJwPFLikOL9yzb/PV7oIkz44CUmn4KecKg=
580+
github.com/cockroachdb/pebble v0.0.0-20251002220049-0ac45a74e10a h1:K31Go2TsBQEhEUNRSRbv63Qiu6ImEawHedYASgIyZOU=
581+
github.com/cockroachdb/pebble v0.0.0-20251002220049-0ac45a74e10a/go.mod h1:H/DxkYtsYVJwPFLikOL9yzb/PV7oIkz44CUmn4KecKg=
582582
github.com/cockroachdb/redact v1.1.6 h1:zXJBwDZ84xJNlHl1rMyCojqyIxv+7YUpQiJLQ7n4314=
583583
github.com/cockroachdb/redact v1.1.6/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
584584
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd h1:KFOt5I9nEKZgCnOSmy8r4Oykh8BYQO8bFOTgHDS8YZA=

pkg/cmd/roachtest/testdata/pg_regress/truncate.diffs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
2525
SELECT * FROM truncate_a;
2626
col1
2727
------
28-
@@ -32,42 +34,27 @@
28+
@@ -32,42 +34,34 @@
2929
-- Test foreign-key checks
3030
CREATE TABLE trunc_b (a int REFERENCES truncate_a);
3131
CREATE TABLE trunc_c (a serial PRIMARY KEY);
@@ -37,72 +37,83 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
3737
-DETAIL: Table "trunc_b" references "truncate_a".
3838
-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
3939
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
40+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
4041
TRUNCATE TABLE truncate_a,trunc_b; -- fail
4142
-ERROR: cannot truncate a table referenced in a foreign key constraint
4243
-DETAIL: Table "trunc_e" references "truncate_a".
4344
-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
4445
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_e"
46+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
4547
TRUNCATE TABLE truncate_a,trunc_b,trunc_e; -- ok
4648
TRUNCATE TABLE truncate_a,trunc_e; -- fail
4749
-ERROR: cannot truncate a table referenced in a foreign key constraint
4850
-DETAIL: Table "trunc_b" references "truncate_a".
4951
-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
5052
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
53+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
5154
TRUNCATE TABLE trunc_c; -- fail
5255
-ERROR: cannot truncate a table referenced in a foreign key constraint
5356
-DETAIL: Table "trunc_d" references "trunc_c".
5457
-HINT: Truncate table "trunc_d" at the same time, or use TRUNCATE ... CASCADE.
5558
+ERROR: "trunc_c" is referenced by foreign key from table "trunc_d"
59+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
5660
TRUNCATE TABLE trunc_c,trunc_d; -- fail
5761
-ERROR: cannot truncate a table referenced in a foreign key constraint
5862
-DETAIL: Table "trunc_e" references "trunc_c".
5963
-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
6064
+ERROR: "trunc_c" is referenced by foreign key from table "trunc_e"
65+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
6166
TRUNCATE TABLE trunc_c,trunc_d,trunc_e; -- ok
6267
TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a; -- fail
6368
-ERROR: cannot truncate a table referenced in a foreign key constraint
6469
-DETAIL: Table "trunc_b" references "truncate_a".
6570
-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
6671
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
72+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
6773
TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a,trunc_b; -- ok
6874
TRUNCATE TABLE truncate_a RESTRICT; -- fail
6975
-ERROR: cannot truncate a table referenced in a foreign key constraint
7076
-DETAIL: Table "trunc_b" references "truncate_a".
7177
-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
7278
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
79+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
7380
TRUNCATE TABLE truncate_a CASCADE; -- ok
7481
-NOTICE: truncate cascades to table "trunc_b"
7582
-NOTICE: truncate cascades to table "trunc_e"
7683
-- circular references
7784
ALTER TABLE truncate_a ADD FOREIGN KEY (col1) REFERENCES trunc_c;
7885
-- Add some data to verify that truncating actually works ...
79-
@@ -77,21 +64,13 @@
86+
@@ -77,21 +71,17 @@
8087
INSERT INTO trunc_d VALUES (1);
8188
INSERT INTO trunc_e VALUES (1,1);
8289
TRUNCATE TABLE trunc_c;
8390
-ERROR: cannot truncate a table referenced in a foreign key constraint
8491
-DETAIL: Table "truncate_a" references "trunc_c".
8592
-HINT: Truncate table "truncate_a" at the same time, or use TRUNCATE ... CASCADE.
8693
+ERROR: "trunc_c" is referenced by foreign key from table "truncate_a"
94+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
8795
TRUNCATE TABLE trunc_c,truncate_a;
8896
-ERROR: cannot truncate a table referenced in a foreign key constraint
8997
-DETAIL: Table "trunc_d" references "trunc_c".
9098
-HINT: Truncate table "trunc_d" at the same time, or use TRUNCATE ... CASCADE.
9199
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
100+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
92101
TRUNCATE TABLE trunc_c,truncate_a,trunc_d;
93102
-ERROR: cannot truncate a table referenced in a foreign key constraint
94103
-DETAIL: Table "trunc_e" references "trunc_c".
95104
-HINT: Truncate table "trunc_e" at the same time, or use TRUNCATE ... CASCADE.
96105
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
106+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
97107
TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e;
98108
-ERROR: cannot truncate a table referenced in a foreign key constraint
99109
-DETAIL: Table "trunc_b" references "truncate_a".
100110
-HINT: Truncate table "trunc_b" at the same time, or use TRUNCATE ... CASCADE.
101111
+ERROR: "truncate_a" is referenced by foreign key from table "trunc_b"
112+
+HINT: truncate dependent tables at the same time or specify the CASCADE option
102113
TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e,trunc_b;
103114
-- Verify that truncating did actually work
104115
SELECT * FROM truncate_a
105-
@@ -117,10 +96,6 @@
116+
@@ -117,10 +107,6 @@
106117
INSERT INTO trunc_d VALUES (1);
107118
INSERT INTO trunc_e VALUES (1,1);
108119
TRUNCATE TABLE trunc_c CASCADE; -- ok
@@ -113,7 +124,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
113124
SELECT * FROM truncate_a
114125
UNION ALL
115126
SELECT * FROM trunc_c
116-
@@ -143,144 +118,103 @@
127+
@@ -143,144 +129,103 @@
117128
INSERT INTO trunc_f VALUES (1);
118129
INSERT INTO trunc_f VALUES (2);
119130
CREATE TABLE trunc_fa (col2a text) INHERITS (trunc_f);
@@ -300,7 +311,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
300311
-- Test ON TRUNCATE triggers
301312
CREATE TABLE trunc_trigger_test (f1 int, f2 text, f3 text);
302313
CREATE TABLE trunc_trigger_log (tgop text, tglevel text, tgwhen text,
303-
@@ -294,12 +228,26 @@
314+
@@ -294,12 +239,26 @@
304315
return null;
305316
end;
306317
$$ LANGUAGE plpgsql;
@@ -327,7 +338,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
327338
SELECT count(*) as "Row count in test table" FROM trunc_trigger_test;
328339
Row count in test table
329340
-------------------------
330-
@@ -319,12 +267,12 @@
341+
@@ -319,12 +278,12 @@
331342
(1 row)
332343

333344
SELECT * FROM trunc_trigger_log;
@@ -344,15 +355,15 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
344355
truncate trunc_trigger_log;
345356
-- same test with an after trigger
346357
INSERT INTO trunc_trigger_test VALUES(1, 'foo', 'bar'), (2, 'baz', 'quux');
347-
@@ -332,6 +280,7 @@
358+
@@ -332,6 +291,7 @@
348359
AFTER TRUNCATE ON trunc_trigger_test
349360
FOR EACH STATEMENT
350361
EXECUTE PROCEDURE trunctrigger('after trigger truncate');
351362
+ERROR: unknown function: trunctrigger()
352363
SELECT count(*) as "Row count in test table" FROM trunc_trigger_test;
353364
Row count in test table
354365
-------------------------
355-
@@ -351,17 +300,18 @@
366+
@@ -351,17 +311,18 @@
356367
(1 row)
357368

358369
SELECT * FROM trunc_trigger_log;
@@ -376,7 +387,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
376387
id1 integer default nextval('truncate_a_id1'));
377388
ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1;
378389
INSERT INTO truncate_a DEFAULT VALUES;
379-
@@ -384,14 +334,20 @@
390+
@@ -384,14 +345,20 @@
380391
(2 rows)
381392

382393
TRUNCATE truncate_a RESTART IDENTITY;
@@ -400,7 +411,7 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
400411

401412
CREATE TABLE truncate_b (id int GENERATED ALWAYS AS IDENTITY (START WITH 44));
402413
INSERT INTO truncate_b DEFAULT VALUES;
403-
@@ -414,56 +370,74 @@
414+
@@ -414,56 +381,74 @@
404415
(2 rows)
405416

406417
TRUNCATE truncate_b RESTART IDENTITY;
@@ -492,15 +503,15 @@ diff -U3 --label=/mnt/data1/postgres/src/test/regress/expected/truncate.out --la
492503
-- foreign key on partitioned table: partition key is referencing column.
493504
-- Make sure truncate did execute on all tables
494505
CREATE FUNCTION tp_ins_data() RETURNS void LANGUAGE plpgsql AS $$
495-
@@ -472,6 +446,7 @@
506+
@@ -472,6 +457,7 @@
496507
INSERT INTO truncpart VALUES (1), (100), (150);
497508
END
498509
$$;
499510
+ERROR: relation "truncprim" does not exist
500511
CREATE FUNCTION tp_chk_data(OUT pktb regclass, OUT pkval int, OUT fktb regclass, OUT fkval int)
501512
RETURNS SETOF record LANGUAGE plpgsql AS $$
502513
BEGIN
503-
@@ -481,114 +456,158 @@
514+
@@ -481,114 +467,158 @@
504515
ORDER BY 2, 4;
505516
END
506517
$$;

pkg/kv/kvserver/concurrency/concurrency_manager.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,11 @@ type Config struct {
186186
Stopper *stop.Stopper
187187
IntentResolver IntentResolver
188188
// Metrics.
189-
TxnWaitMetrics *txnwait.Metrics
190-
SlowLatchGauge *metric.Gauge
191-
LatchWaitDurations metric.IHistogram
189+
TxnWaitMetrics *txnwait.Metrics
190+
SlowLatchGauge *metric.Gauge
191+
LatchWaitDurations metric.IHistogram
192+
LocksShedDueToMemoryLimit *metric.Counter
193+
NumLockShedDueToMemoryLimitEvents *metric.Counter
192194
// Configs + Knobs.
193195
MaxLockTableSize int64
194196
DisableTxnPushing bool
@@ -206,7 +208,10 @@ func NewManager(cfg Config) Manager {
206208
cfg.initDefaults()
207209
m := new(managerImpl)
208210
lt := maybeWrapInVerifyingLockTable(
209-
newLockTable(cfg.MaxLockTableSize, cfg.RangeDesc.RangeID, cfg.Clock, cfg.Settings),
211+
newLockTable(
212+
cfg.MaxLockTableSize, cfg.RangeDesc.RangeID, cfg.Clock, cfg.Settings,
213+
cfg.LocksShedDueToMemoryLimit, cfg.NumLockShedDueToMemoryLimitEvents,
214+
),
210215
)
211216
*m = managerImpl{
212217
st: cfg.Settings,

pkg/kv/kvserver/concurrency/concurrency_manager_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -755,13 +755,16 @@ func newClusterWithSettings(st *clustersettings.Settings) *cluster {
755755
}
756756

757757
func (c *cluster) makeConfig() concurrency.Config {
758+
m := concurrency.TestingMakeLockTableMetricsCfg()
758759
return concurrency.Config{
759-
NodeDesc: c.nodeDesc,
760-
RangeDesc: c.rangeDesc,
761-
Settings: c.st,
762-
Clock: c.clock,
763-
IntentResolver: c,
764-
TxnWaitMetrics: txnwait.NewMetrics(time.Minute),
760+
NodeDesc: c.nodeDesc,
761+
RangeDesc: c.rangeDesc,
762+
Settings: c.st,
763+
Clock: c.clock,
764+
IntentResolver: c,
765+
TxnWaitMetrics: txnwait.NewMetrics(time.Minute),
766+
LocksShedDueToMemoryLimit: m.LocksShedDueToMemoryLimit,
767+
NumLockShedDueToMemoryLimitEvents: m.NumLockShedDueToMemoryLimitEvents,
765768
}
766769
}
767770

0 commit comments

Comments
 (0)