Skip to content

Commit 40124c1

Browse files
craig[bot]yuzefovich
andcommitted
Merge #144736
144736: kvclient,sql: harden the code for buffered writes r=yuzefovich a=yuzefovich **kvclient: remove no longer valid assertion about batch splitting** This commit removes a fatal assertion that batch with MaxSpanRequestKeys or TargetBytes set doesn't need to be split. This assertion has been in place for many years, but it no longer holds true in some cases with buffered writes (namely when we buffered some writes, but then they were disabled, so we need to flush the buffer together with the next batch: that next batch can fail the assertion). **sql: disable buffered writes on the txn when it's used by IE** This commit is a follow-up to 07d8902 where we disabled the session variable that controls whether buffered writes are enabled when the variable is consulted by the internal executor. That change had an oversight - that if the IE is using already created txn, the session variable has no influence, so this commit explicitly disables buffered writes on the txn whenever it's used by the IE for the first time. Epic: None Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
2 parents 580602a + 0c8f3ac commit 40124c1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/kv/kvclient/kvcoord/dist_sender.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,12 +1222,6 @@ func (ds *DistSender) Send(
12221222
splitET = true
12231223
}
12241224
parts := splitBatchAndCheckForRefreshSpans(ba, splitET)
1225-
if len(parts) > 1 && (ba.MaxSpanRequestKeys != 0 || ba.TargetBytes != 0) {
1226-
// We already verified above that the batch contains only scan requests of the same type.
1227-
// Such a batch should never need splitting.
1228-
log.Fatalf(ctx, "batch with MaxSpanRequestKeys=%d, TargetBytes=%d needs splitting",
1229-
redact.Safe(ba.MaxSpanRequestKeys), redact.Safe(ba.TargetBytes))
1230-
}
12311225
var singleRplChunk [1]*kvpb.BatchResponse
12321226
rplChunks := singleRplChunk[:0:1]
12331227

pkg/sql/internal.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,12 @@ func (ie *InternalExecutor) execInternal(
11851185

11861186
applyInternalExecutorSessionExceptions(sd)
11871187
applyOverrides(sessionDataOverride, sd)
1188+
if txn != nil && txn.Type() == kv.RootTxn {
1189+
// For 25.2, we're being conservative and explicitly disabling buffered
1190+
// writes for the internal executor.
1191+
// TODO(yuzefovich): remove this for 25.3.
1192+
txn.SetBufferedWritesEnabled(false)
1193+
}
11881194
attributeToUser := sessionDataOverride.AttributeToUser && attributeToUserEnabled.Get(&ie.s.cfg.Settings.SV)
11891195
growStackSize := sessionDataOverride.GrowStackSize
11901196
if !rw.async() && (txn != nil && txn.Type() == kv.RootTxn) {

0 commit comments

Comments
 (0)