-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: add sql.mutations.mutation_batch_byte_size setting
Previously we always constructed 10k row insert batches, regardless of the size of those rows. With large rows, this could easily exceed the kv size limit of 64MB. This changes batch construction to track the size of added keys and values, and send the batch either when it has 10k entries of when the size of added keys and values exceeds the setting, which defaults to 4MB. Release note (bug fix): INSERT and UPDATE statements which operate on larger rows are split into batches using the sql.mutations.mutation_batch_byte_size setting.
- Loading branch information
1 parent
0e5432e
commit 192e83b
Showing
10 changed files
with
80 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
pkg/sql/opt/exec/execbuilder/testdata/show_trace_mutations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# LogicTest: local | ||
|
||
# make a table with some big strings in it. | ||
statement ok | ||
CREATE TABLE blobs (i INT PRIMARY KEY, j STRING, FAMILY (i, j)) | ||
|
||
# Get the range id. | ||
let $rangeid | ||
SELECT range_id FROM [ SHOW RANGES FROM TABLE blobs ] | ||
|
||
# Populate table descriptor cache. | ||
query IT | ||
SELECT * FROM blobs | ||
---- | ||
|
||
# make a table with some big (1mb) strings in it. | ||
statement ok | ||
SET TRACING=ON; | ||
INSERT INTO blobs SELECT generate_series(1, 24), repeat('0123456789ab', 65536); | ||
SET TRACING=OFF; | ||
|
||
# verify insert of 24 rows paginated into 4 batches since they are .75mb each. | ||
query TT | ||
SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] | ||
WHERE message LIKE '%r$rangeid: sending batch%' | ||
AND message NOT LIKE '%PushTxn%' | ||
AND message NOT LIKE '%QueryTxn%' | ||
AND operation NOT LIKE '%[async]%' | ||
AND message NOT LIKE '%HeartbeatTxn%' | ||
---- | ||
dist sender send r35: sending batch 6 CPut to (n1,s1):1 | ||
dist sender send r35: sending batch 6 CPut to (n1,s1):1 | ||
dist sender send r35: sending batch 6 CPut to (n1,s1):1 | ||
dist sender send r35: sending batch 6 CPut to (n1,s1):1 | ||
dist sender send r35: sending batch 1 EndTxn to (n1,s1):1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters