Skip to content

Commit 4a5a266

Browse files
committed
kv: make kv.transaction.write_buffering.max_buffer_size bytes setting
This was incorrectly called an int setting previously. While here, handle the zero case correctly too. Epic: none Release note: None
1 parent 094779f commit 4a5a266

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

docs/generated/settings/settings-for-tenants.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ kv.transaction.max_refresh_spans_bytes integer 4194304 maximum number of bytes u
9999
kv.transaction.randomized_anchor_key.enabled boolean false dictates whether a transactions anchor key is randomized or not application
100100
kv.transaction.reject_over_max_intents_budget.enabled boolean false if set, transactions that exceed their lock tracking budget (kv.transaction.max_intents_bytes) are rejected instead of having their lock spans imprecisely compressed application
101101
kv.transaction.write_buffering.enabled boolean false if enabled, transactional writes are buffered on the client application
102-
kv.transaction.write_buffering.max_buffer_size integer 4194304 if non-zero, defines that maximum size of the buffer that will be used to buffer transactional writes per-transaction application
102+
kv.transaction.write_buffering.max_buffer_size byte size 4.0 MiB if non-zero, defines that maximum size of the buffer that will be used to buffer transactional writes per-transaction application
103103
kv.transaction.write_pipelining.locking_reads.enabled boolean true if enabled, transactional locking reads are pipelined through Raft consensus application
104104
kv.transaction.write_pipelining.ranged_writes.enabled boolean true if enabled, transactional ranged writes are pipelined through Raft consensus application
105105
kv.transaction.write_pipelining.enabled (alias: kv.transaction.write_pipelining_enabled) boolean true if enabled, transactional writes are pipelined through Raft consensus application

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<tr><td><div id="setting-kv-transaction-randomized-anchor-key-enabled" class="anchored"><code>kv.transaction.randomized_anchor_key.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>dictates whether a transactions anchor key is randomized or not</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
129129
<tr><td><div id="setting-kv-transaction-reject-over-max-intents-budget-enabled" class="anchored"><code>kv.transaction.reject_over_max_intents_budget.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>if set, transactions that exceed their lock tracking budget (kv.transaction.max_intents_bytes) are rejected instead of having their lock spans imprecisely compressed</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
130130
<tr><td><div id="setting-kv-transaction-write-buffering-enabled" class="anchored"><code>kv.transaction.write_buffering.enabled</code></div></td><td>boolean</td><td><code>false</code></td><td>if enabled, transactional writes are buffered on the client</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
131-
<tr><td><div id="setting-kv-transaction-write-buffering-max-buffer-size" class="anchored"><code>kv.transaction.write_buffering.max_buffer_size</code></div></td><td>integer</td><td><code>4194304</code></td><td>if non-zero, defines that maximum size of the buffer that will be used to buffer transactional writes per-transaction</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
131+
<tr><td><div id="setting-kv-transaction-write-buffering-max-buffer-size" class="anchored"><code>kv.transaction.write_buffering.max_buffer_size</code></div></td><td>byte size</td><td><code>4.0 MiB</code></td><td>if non-zero, defines that maximum size of the buffer that will be used to buffer transactional writes per-transaction</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
132132
<tr><td><div id="setting-kv-transaction-write-pipelining-locking-reads-enabled" class="anchored"><code>kv.transaction.write_pipelining.locking_reads.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled, transactional locking reads are pipelined through Raft consensus</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
133133
<tr><td><div id="setting-kv-transaction-write-pipelining-ranged-writes-enabled" class="anchored"><code>kv.transaction.write_pipelining.ranged_writes.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled, transactional ranged writes are pipelined through Raft consensus</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
134134
<tr><td><div id="setting-kv-transaction-write-pipelining-enabled" class="anchored"><code>kv.transaction.write_pipelining.enabled<br />(alias: kv.transaction.write_pipelining_enabled)</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled, transactional writes are pipelined through Raft consensus</td><td>Serverless/Dedicated/Self-Hosted</td></tr>

pkg/kv/kvclient/kvcoord/txn_interceptor_write_buffer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var BufferedWritesEnabled = settings.RegisterBoolSetting(
3535
settings.WithPublic,
3636
)
3737

38-
var bufferedWritesMaxBufferSize = settings.RegisterIntSetting(
38+
var bufferedWritesMaxBufferSize = settings.RegisterByteSizeSetting(
3939
settings.ApplicationLevel,
4040
"kv.transaction.write_buffering.max_buffer_size",
4141
"if non-zero, defines that maximum size of the "+
@@ -246,7 +246,9 @@ func (twb *txnWriteBuffer) SendLocked(
246246
// and flush the buffer.
247247
maxSize := bufferedWritesMaxBufferSize.Get(&twb.st.SV)
248248
bufSize := twb.estimateSize(ba) + twb.bufferSize
249-
if bufSize > maxSize {
249+
// NB: if bufferedWritesMaxBufferSize is set to 0 then we effectively disable
250+
// any buffer limiting.
251+
if maxSize != 0 && bufSize > maxSize {
250252
// TODO(arul): add some metrics for this case.
251253
log.VEventf(ctx, 2, "flushing buffer because buffer size (%s) exceeds max size (%s)",
252254
humanizeutil.IBytes(bufSize),

0 commit comments

Comments
 (0)