Skip to content

Commit 0fbd967

Browse files
committed
sql: increase default max_retries_for_read_committed to 100
In #107044 we added a retry loop for individual statements executing under Read Committed isolation. We chose 10 as the default retry limit, but testing has shown that this is too low for high-contention workloads. (By comparison, automatic transaction retries in conn_fsm are unlimited.) Increase the default limit to 100. Informs: #145377 Release note (sql change): This change increases the default value for the `max_retries_for_read_committed` session variable from 10 to 100. Testing has shown that some high-contention workloads running under Read Committed isolation benefit from more statement retries.
1 parent c7d1e2f commit 0fbd967

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

pkg/sql/logictest/testdata/logic_test/information_schema

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4036,7 +4036,7 @@ max_connections -1
40364036
max_identifier_length 128
40374037
max_index_keys 32
40384038
max_prepared_transactions 2147483647
4039-
max_retries_for_read_committed 10
4039+
max_retries_for_read_committed 100
40404040
node_id 1
40414041
null_ordered_last off
40424042
on_update_rehome_row_enabled on

pkg/sql/logictest/testdata/logic_test/manual_retry

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ query error restart transaction: TransactionRetryWithProtoRefreshError: forced b
3838
SELECT crdb_internal.force_retry('1h':::INTERVAL)
3939

4040
onlyif config local-read-committed
41-
query error restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=10: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
41+
query error restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=100: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
4242
SELECT crdb_internal.force_retry('1h':::INTERVAL)
4343

4444
statement ok

pkg/sql/logictest/testdata/logic_test/pg_catalog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ max_connections -1 N
30303030
max_identifier_length 128 NULL NULL NULL string
30313031
max_index_keys 32 NULL NULL NULL string
30323032
max_prepared_transactions 2147483647 NULL NULL NULL string
3033-
max_retries_for_read_committed 10 NULL NULL NULL string
3033+
max_retries_for_read_committed 100 NULL NULL NULL string
30343034
node_id 1 NULL NULL NULL string
30353035
null_ordered_last off NULL NULL NULL string
30363036
on_update_rehome_row_enabled on NULL NULL NULL string
@@ -3261,7 +3261,7 @@ max_connections -1 N
32613261
max_identifier_length 128 NULL user NULL 128 128
32623262
max_index_keys 32 NULL user NULL 32 32
32633263
max_prepared_transactions 2147483647 NULL user NULL 2147483647 2147483647
3264-
max_retries_for_read_committed 10 NULL user NULL 10 10
3264+
max_retries_for_read_committed 100 NULL user NULL 100 100
32653265
node_id 1 NULL user NULL 1 1
32663266
null_ordered_last off NULL user NULL off off
32673267
on_update_rehome_row_enabled on NULL user NULL on on

pkg/sql/logictest/testdata/logic_test/show_source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ max_connections -1
144144
max_identifier_length 128
145145
max_index_keys 32
146146
max_prepared_transactions 2147483647
147-
max_retries_for_read_committed 10
147+
max_retries_for_read_committed 100
148148
node_id 1
149149
null_ordered_last off
150150
on_update_rehome_row_enabled on

pkg/sql/logictest/testdata/logic_test/txn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ query error pgcode 40001 restart transaction: TransactionRetryWithProtoRefreshEr
11881188
SELECT crdb_internal.force_retry('1h':::INTERVAL)
11891189

11901190
onlyif config local-read-committed
1191-
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=10: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
1191+
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=100: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
11921192
SELECT crdb_internal.force_retry('1h':::INTERVAL)
11931193

11941194
query T
@@ -1330,7 +1330,7 @@ query error pgcode 40001 restart transaction: TransactionRetryWithProtoRefreshEr
13301330
SELECT crdb_internal.force_retry('1h':::INTERVAL)
13311331

13321332
onlyif config local-read-committed
1333-
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=10: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
1333+
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=100: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
13341334
SELECT crdb_internal.force_retry('1h':::INTERVAL)
13351335

13361336
statement ok
@@ -1602,7 +1602,7 @@ query error pgcode 40001 restart transaction: TransactionRetryWithProtoRefreshEr
16021602
SELECT crdb_internal.force_retry('1h':::INTERVAL)
16031603

16041604
onlyif config local-read-committed
1605-
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=10: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
1605+
query error pgcode 40001 pq: restart transaction: read committed retry limit exceeded; set by max_retries_for_read_committed=100: TransactionRetryWithProtoRefreshError: forced by crdb_internal.force_retry\(\)
16061606
SELECT crdb_internal.force_retry('1h':::INTERVAL)
16071607

16081608
statement ok

pkg/sql/vars.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2275,7 +2275,7 @@ var varGen = map[string]sessionVar{
22752275
return strconv.FormatInt(int64(evalCtx.SessionData().MaxRetriesForReadCommitted), 10), nil
22762276
},
22772277
GlobalDefault: func(sv *settings.Values) string {
2278-
return "10"
2278+
return "100"
22792279
},
22802280
},
22812281

0 commit comments

Comments
 (0)