Skip to content

Commit 45057e1

Browse files
craig[bot]yuzefovich
andcommitted
Merge #145220
145220: logictest: harden a couple buffered writes tests r=yuzefovich a=yuzefovich This commit fixes two flakes in `buffered_writes` logic test: - the test added in 31ab5c3 can result in an extra Scan request in the trace with low `default-batch-bytes-limit` value (we paginate over several rows). I don't think we need to use tracing as a regression test for checking ReturnRawMVCCValues option, so this commit simply uses the `crdb_internal_origin_id` explicitly and deletes the tracing tests - the test added in 238f0e3 has a txn that writes some rows and then reads large already present blobs. We've seen a few cases when this hits a RETRY_SERIALIZABLE error under race. My guess is that it could happen if the txn becomes long-running due to race config overhead, especially in fakedist configs, so this commit bumps the closed ts interval to avoid hitting the retry error. Additionally this commit fixes a couple of nits. Fixes: #144756. Fixes: #145065. Fixes: #145280. Fixes: #145281. Fixes: #145282. Fixes: #145285. Fixes: #145286. Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
2 parents 26eb2dc + 5f25cc3 commit 45057e1

File tree

3 files changed

+23
-59
lines changed

3 files changed

+23
-59
lines changed

pkg/kv/kvclient/kvcoord/txn_interceptor_write_buffer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,13 @@ func (twb *txnWriteBuffer) validateRequests(ba *kvpb.BatchRequest) error {
356356
// ReturnRawMVCCValues is unsupported because we don't know how to serve
357357
// such reads from the write buffer currently.
358358
if t.ReturnRawMVCCValues {
359-
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValue")
359+
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValues")
360360
}
361361
case *kvpb.ScanRequest:
362362
// ReturnRawMVCCValues is unsupported because we don't know how to serve
363363
// such reads from the write buffer currently.
364364
if t.ReturnRawMVCCValues {
365-
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValue")
365+
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValues")
366366
}
367367
if t.ScanFormat == kvpb.COL_BATCH_RESPONSE {
368368
return unsupportedOptionError(t.Method(), "COL_BATCH_RESPONSE scan format")
@@ -371,7 +371,7 @@ func (twb *txnWriteBuffer) validateRequests(ba *kvpb.BatchRequest) error {
371371
// ReturnRawMVCCValues is unsupported because we don't know how to serve
372372
// such reads from the write buffer currently.
373373
if t.ReturnRawMVCCValues {
374-
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValue")
374+
return unsupportedOptionError(t.Method(), "ReturnRawMVCCValues")
375375
}
376376
if t.ScanFormat == kvpb.COL_BATCH_RESPONSE {
377377
return unsupportedOptionError(t.Method(), "COL_BATCH_RESPONSE scan format")

pkg/sql/delete_range.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ func (d *deleteRangeNode) deleteSpans(params runParams, b *kv.Batch, spans roach
181181
if traceKV {
182182
log.VEventf(ctx, 2, "DelRange %s - %s", span.Key, span.EndKey)
183183
}
184-
// TODO(yuzefovich): decide what we do with DeleteRange requests. If
185-
// we won't buffer them, then we don't need to make any changes; if
186-
// we do buffer them in the interceptor, we'll need to set
187-
// to-be-added MustAcquireExclusiveLock flag too.
188184
b.DelRange(span.Key, span.EndKey, true /* returnKeys */)
189185
}
190186
}

pkg/sql/logictest/testdata/logic_test/buffered_writes

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -261,64 +261,19 @@ EXPLAIN CREATE DATABASE foo
261261
statement ok
262262
EXPLAIN ANALYZE CREATE DATABASE foo
263263

264-
# Regression test for #144273.
265-
statement ok
266-
CREATE TABLE t144273 (
267-
k INT PRIMARY KEY,
268-
a INT,
269-
b INT,
270-
INDEX (a),
271-
INDEX (b),
272-
FAMILY (k, a, b)
273-
)
274-
275-
statement ok
276-
PREPARE p AS UPDATE t144273 t1 SET a = t2.a + 1, b = t2.b + 1 FROM t144273 t2 WHERE t1.k = t2.a AND t1.k = $1
264+
# Regression test for #144273 (not supporting ReturnRawMVCCValues option).
277265

266+
# Get request.
278267
statement ok
279-
SET vectorize = on
268+
SELECT k, crdb_internal_origin_id FROM t4 WHERE k = 1
280269

270+
# Scan request.
281271
statement ok
282-
INSERT INTO t144273 VALUES (1, 1, 1);
283-
284-
# The table IDs in the kv trace below are different with the legacy schema
285-
# changer, so disable that configuration.
286-
skipif config local-legacy-schema-changer
287-
query T kvtrace
288-
EXECUTE p(1)
289-
----
290-
Scan /Table/114/2/{1-2}
291-
Scan /Table/114/1/1/0
292-
Scan /Table/114/1/1/0
293-
Put (locking) /Table/114/1/1/0 -> /TUPLE/2:2:Int/2/1:3:Int/2
294-
Del /Table/114/2/1/1/0
295-
Put /Table/114/2/2/1/0 -> /BYTES/
296-
Del /Table/114/3/1/1/0
297-
Put /Table/114/3/2/1/0 -> /BYTES/
272+
SELECT k, crdb_internal_origin_id FROM t4
298273

274+
# ReverseScan request.
299275
statement ok
300-
SET vectorize = off
301-
302-
statement ok
303-
INSERT INTO t144273 VALUES (2, 2, 2);
304-
305-
# The table IDs in the kv trace below are different with the legacy schema
306-
# changer, so disable that configuration.
307-
skipif config local-legacy-schema-changer
308-
query T kvtrace
309-
EXECUTE p(2)
310-
----
311-
Scan /Table/114/2/{2-3}
312-
Scan /Table/114/1/1/0, /Table/114/1/2/0
313-
Scan /Table/114/1/2/0
314-
Put (locking) /Table/114/1/2/0 -> /TUPLE/2:2:Int/3/1:3:Int/3
315-
Del /Table/114/2/2/2/0
316-
Put /Table/114/2/3/2/0 -> /BYTES/
317-
Del /Table/114/3/2/2/0
318-
Put /Table/114/3/3/2/0 -> /BYTES/
319-
320-
statement ok
321-
RESET vectorize
276+
SELECT k, crdb_internal_origin_id FROM t4 ORDER BY k DESC
322277

323278
statement ok
324279
CREATE TABLE uvw (
@@ -440,6 +395,19 @@ SELECT count(*) FROM uvw
440395
----
441396
64
442397

398+
# Increase the closed timestamp interval since the transaction below can take
399+
# long time under race which could result in a RETRY_SERIALIZABLE error on
400+
# COMMIT (#145065).
401+
#
402+
# The cluster setting is SystemVisible, so we must run this query on the host
403+
# cluster in multi-tenant environment.
404+
user host-cluster-root
405+
406+
statement ok
407+
SET CLUSTER SETTING kv.closed_timestamp.target_duration = '30s'
408+
409+
user root
410+
443411
# Create some large blobs that will require the scans to be paginated (in 10MiB
444412
# chunks).
445413
statement ok

0 commit comments

Comments
 (0)