@@ -281,13 +281,13 @@ var detailedLatencyMetricLabel = "fingerprint"
281
281
// the fact that there's two distinct categories of errors to speak of. There
282
282
// are "query execution errors" and there are the rest. Most things fall in the
283
283
// former category: invalid queries, queries that fail constraints at runtime,
284
- // data unavailability errors, retriable errors (i.e. serializability
284
+ // data unavailability errors, retryable errors (i.e. serializability
285
285
// violations) "internal errors" (e.g. connection problems in the cluster). This
286
286
// category of errors doesn't represent dramatic events as far as the connExecutor
287
287
// is concerned: they produce "results" for the query to be passed to the client
288
288
// just like more successful queries do and they produce Events for the
289
289
// state machine just like the successful queries (the events in question
290
- // are generally event{non}RetriableErr and they generally cause the
290
+ // are generally event{non}RetryableErr and they generally cause the
291
291
// state machine to move to the Aborted state, but the connExecutor doesn't
292
292
// concern itself with this). The way the connExecutor reacts to these errors is
293
293
// the same as how it reacts to a successful query completing: it moves the
@@ -1374,19 +1374,19 @@ func (ex *connExecutor) close(ctx context.Context, closeType closeType) {
1374
1374
1375
1375
var payloadErr error
1376
1376
if closeType == normalClose {
1377
- // We'll cleanup the SQL txn by creating a non-retriable (commit:true) event.
1377
+ // We'll cleanup the SQL txn by creating a non-retryable (commit:true) event.
1378
1378
// This event is guaranteed to be accepted in every state.
1379
- ev := eventNonRetriableErr {IsCommit : fsm .True }
1379
+ ev := eventNonRetryableErr {IsCommit : fsm .True }
1380
1380
payloadErr = connExecutorNormalCloseErr
1381
- payload := eventNonRetriableErrPayload {err : payloadErr }
1381
+ payload := eventNonRetryableErrPayload {err : payloadErr }
1382
1382
if err := ex .machine .ApplyWithPayload (ctx , ev , payload ); err != nil {
1383
1383
log .Warningf (ctx , "error while cleaning up connExecutor: %s" , err )
1384
1384
}
1385
1385
switch t := ex .machine .CurState ().(type ) {
1386
1386
case stateNoTxn :
1387
1387
// No txn to finish.
1388
1388
case stateAborted :
1389
- // A non-retriable error with IsCommit set to true causes the transaction
1389
+ // A non-retryable error with IsCommit set to true causes the transaction
1390
1390
// to be cleaned up.
1391
1391
case stateCommitWait :
1392
1392
ex .state .finishSQLTxn ()
@@ -2397,8 +2397,8 @@ func (ex *connExecutor) execCmd() (retErr error) {
2397
2397
if ! ok {
2398
2398
err := pgerror .Newf (
2399
2399
pgcode .InvalidCursorName , "unknown portal %q" , portalName )
2400
- ev = eventNonRetriableErr {IsCommit : fsm .False }
2401
- payload = eventNonRetriableErrPayload {err : err }
2400
+ ev = eventNonRetryableErr {IsCommit : fsm .False }
2401
+ payload = eventNonRetryableErrPayload {err : err }
2402
2402
res = ex .clientComm .CreateErrorResult (pos )
2403
2403
return nil
2404
2404
}
@@ -2512,8 +2512,8 @@ func (ex *connExecutor) execCmd() (retErr error) {
2512
2512
ev , payload = ex .execDelPrepStmt (ctx , tcmd )
2513
2513
case SendError :
2514
2514
res = ex .clientComm .CreateErrorResult (pos )
2515
- ev = eventNonRetriableErr {IsCommit : fsm .False }
2516
- payload = eventNonRetriableErrPayload {err : tcmd .Err }
2515
+ ev = eventNonRetryableErr {IsCommit : fsm .False }
2516
+ payload = eventNonRetryableErrPayload {err : tcmd .Err }
2517
2517
case Sync :
2518
2518
// The Postgres docs say: "At completion of each series of extended-query
2519
2519
// messages, the frontend should issue a Sync message. This parameterless
@@ -2595,7 +2595,7 @@ func (ex *connExecutor) execCmd() (retErr error) {
2595
2595
// otherwise there will be leftover bytes.
2596
2596
shouldClosePausablePortalsAndCursors := func (payload fsm.EventPayload ) bool {
2597
2597
switch payload .(type ) {
2598
- case eventNonRetriableErrPayload , eventRetriableErrPayload :
2598
+ case eventNonRetryableErrPayload , eventRetryableErrPayload :
2599
2599
return true
2600
2600
default :
2601
2601
return false
@@ -3039,10 +3039,10 @@ func (ex *connExecutor) execCopyOut(
3039
3039
// Even in the cases where the error is a retryable error, we want to
3040
3040
// intercept the event and payload returned here to ensure that the query
3041
3041
// is not retried.
3042
- retEv = eventNonRetriableErr {
3042
+ retEv = eventNonRetryableErr {
3043
3043
IsCommit : fsm .FromBool (false ),
3044
3044
}
3045
- retPayload = eventNonRetriableErrPayload {err : cancelchecker .QueryCanceledError }
3045
+ retPayload = eventNonRetryableErrPayload {err : cancelchecker .QueryCanceledError }
3046
3046
}
3047
3047
3048
3048
// If the query timed out, we intercept the error, payload, and event here
@@ -3058,15 +3058,15 @@ func (ex *connExecutor) execCopyOut(
3058
3058
if queryTimedOut {
3059
3059
// A timed out query should never produce retryable errors/events/payloads
3060
3060
// so we intercept and overwrite them all here.
3061
- retEv = eventNonRetriableErr {
3061
+ retEv = eventNonRetryableErr {
3062
3062
IsCommit : fsm .FromBool (false ),
3063
3063
}
3064
- retPayload = eventNonRetriableErrPayload {err : sqlerrors .QueryTimeoutError }
3064
+ retPayload = eventNonRetryableErrPayload {err : sqlerrors .QueryTimeoutError }
3065
3065
} else if txnTimedOut {
3066
- retEv = eventNonRetriableErr {
3066
+ retEv = eventNonRetryableErr {
3067
3067
IsCommit : fsm .FromBool (false ),
3068
3068
}
3069
- retPayload = eventNonRetriableErrPayload {err : sqlerrors .TxnTimeoutError }
3069
+ retPayload = eventNonRetryableErrPayload {err : sqlerrors .TxnTimeoutError }
3070
3070
}
3071
3071
}(ctx )
3072
3072
@@ -3139,8 +3139,8 @@ func (ex *connExecutor) execCopyOut(
3139
3139
3140
3140
return nil
3141
3141
}); copyErr != nil {
3142
- ev := eventNonRetriableErr {IsCommit : fsm .False }
3143
- payload := eventNonRetriableErrPayload {err : copyErr }
3142
+ ev := eventNonRetryableErr {IsCommit : fsm .False }
3143
+ payload := eventNonRetryableErrPayload {err : copyErr }
3144
3144
return ev , payload
3145
3145
}
3146
3146
return nil , nil
@@ -3272,8 +3272,8 @@ func (ex *connExecutor) execCopyIn(
3272
3272
)
3273
3273
}
3274
3274
if copyErr != nil {
3275
- ev := eventNonRetriableErr {IsCommit : fsm .False }
3276
- payload := eventNonRetriableErrPayload {err : copyErr }
3275
+ ev := eventNonRetryableErr {IsCommit : fsm .False }
3276
+ payload := eventNonRetryableErrPayload {err : copyErr }
3277
3277
return ev , payload
3278
3278
}
3279
3279
@@ -3313,10 +3313,10 @@ func (ex *connExecutor) execCopyIn(
3313
3313
// Even in the cases where the error is a retryable error, we want to
3314
3314
// intercept the event and payload returned here to ensure that the query
3315
3315
// is not retried.
3316
- retEv = eventNonRetriableErr {
3316
+ retEv = eventNonRetryableErr {
3317
3317
IsCommit : fsm .FromBool (false ),
3318
3318
}
3319
- retPayload = eventNonRetriableErrPayload {err : cancelchecker .QueryCanceledError }
3319
+ retPayload = eventNonRetryableErrPayload {err : cancelchecker .QueryCanceledError }
3320
3320
}
3321
3321
3322
3322
cm .Close (ctx )
@@ -3334,15 +3334,15 @@ func (ex *connExecutor) execCopyIn(
3334
3334
if queryTimedOut {
3335
3335
// A timed out query should never produce retryable errors/events/payloads
3336
3336
// so we intercept and overwrite them all here.
3337
- retEv = eventNonRetriableErr {
3337
+ retEv = eventNonRetryableErr {
3338
3338
IsCommit : fsm .FromBool (false ),
3339
3339
}
3340
- retPayload = eventNonRetriableErrPayload {err : sqlerrors .QueryTimeoutError }
3340
+ retPayload = eventNonRetryableErrPayload {err : sqlerrors .QueryTimeoutError }
3341
3341
} else if txnTimedOut {
3342
- retEv = eventNonRetriableErr {
3342
+ retEv = eventNonRetryableErr {
3343
3343
IsCommit : fsm .FromBool (false ),
3344
3344
}
3345
- retPayload = eventNonRetriableErrPayload {err : sqlerrors .TxnTimeoutError }
3345
+ retPayload = eventNonRetryableErrPayload {err : sqlerrors .TxnTimeoutError }
3346
3346
}
3347
3347
}(ctx )
3348
3348
@@ -3406,16 +3406,16 @@ func (ex *connExecutor) execCopyIn(
3406
3406
}
3407
3407
return cm .run (ctx )
3408
3408
}); copyErr != nil {
3409
- // TODO(andrei): We don't have a full retriable error story for the copy machine.
3409
+ // TODO(andrei): We don't have a full retryable error story for the copy machine.
3410
3410
// When running outside of a txn, the copyMachine should probably do retries
3411
3411
// internally - this is partially done, see `copyMachine.insertRows`.
3412
3412
// When not, it's unclear what we should do. For now, we abort
3413
3413
// the txn (if any).
3414
3414
// We also don't have a story for distinguishing communication errors (which
3415
3415
// should terminate the connection) from query errors. For now, we treat all
3416
3416
// errors as query errors.
3417
- ev := eventNonRetriableErr {IsCommit : fsm .False }
3418
- payload := eventNonRetriableErrPayload {err : copyErr }
3417
+ ev := eventNonRetryableErr {IsCommit : fsm .False }
3418
+ payload := eventNonRetryableErrPayload {err : copyErr }
3419
3419
return ev , payload
3420
3420
}
3421
3421
return nil , nil
@@ -3471,25 +3471,25 @@ func isCommit(stmt tree.Statement) bool {
3471
3471
return ok
3472
3472
}
3473
3473
3474
- var retriableMinTimestampBoundUnsatisfiableError = errors .Newf (
3475
- "retriable MinTimestampBoundUnsatisfiableError" ,
3474
+ var retryableMinTimestampBoundUnsatisfiableError = errors .Newf (
3475
+ "retryable MinTimestampBoundUnsatisfiableError" ,
3476
3476
)
3477
3477
3478
- // errIsRetriable is true if the error is a client-visible retry error
3478
+ // errIsRetryable is true if the error is a client-visible retry error
3479
3479
// or the error is a special error that is handled internally and retried.
3480
- func errIsRetriable (err error ) bool {
3480
+ func errIsRetryable (err error ) bool {
3481
3481
return errors .HasInterface (err , (* pgerror .ClientVisibleRetryError )(nil )) ||
3482
- errors .Is (err , retriableMinTimestampBoundUnsatisfiableError ) ||
3482
+ errors .Is (err , retryableMinTimestampBoundUnsatisfiableError ) ||
3483
3483
descs .IsTwoVersionInvariantViolationError (err )
3484
3484
}
3485
3485
3486
- // convertRetriableErrorIntoUserVisibleError converts internal retriable
3486
+ // convertRetryableErrorIntoUserVisibleError converts internal retryable
3487
3487
// errors into external, so that the client goes and retries this
3488
3488
// transaction. One example of this is two version invariant errors, which
3489
3489
// happens when a schema change is waiting for a schema change transition to
3490
3490
// propagate. When this happens, we either need to retry externally or internally,
3491
3491
// depending on if we are in an explicit transaction.
3492
- func (ex * connExecutor ) convertRetriableErrorIntoUserVisibleError (
3492
+ func (ex * connExecutor ) convertRetryableErrorIntoUserVisibleError (
3493
3493
ctx context.Context , origErr error ,
3494
3494
) (modifiedErr error , err error ) {
3495
3495
if descs .IsTwoVersionInvariantViolationError (origErr ) {
@@ -3505,8 +3505,8 @@ func (ex *connExecutor) convertRetriableErrorIntoUserVisibleError(
3505
3505
return origErr , nil
3506
3506
}
3507
3507
3508
- // makeErrEvent takes an error and returns either an eventRetriableErr or an
3509
- // eventNonRetriableErr , depending on the error type.
3508
+ // makeErrEvent takes an error and returns either an eventRetryableErr or an
3509
+ // eventNonRetryableErr , depending on the error type.
3510
3510
func (ex * connExecutor ) makeErrEvent (err error , stmt tree.Statement ) (fsm.Event , fsm.EventPayload ) {
3511
3511
// Check for MinTimestampBoundUnsatisfiableError errors.
3512
3512
// If this is detected, it means we are potentially able to retry with a lower
@@ -3530,41 +3530,41 @@ func (ex *connExecutor) makeErrEvent(err error, stmt tree.Statement) (fsm.Event,
3530
3530
)
3531
3531
}
3532
3532
if aost .Timestamp .Less (minTSErr .MinTimestampBound ) {
3533
- err = errors .Mark (err , retriableMinTimestampBoundUnsatisfiableError )
3533
+ err = errors .Mark (err , retryableMinTimestampBoundUnsatisfiableError )
3534
3534
}
3535
3535
}
3536
3536
}
3537
3537
3538
- retriable := errIsRetriable (err )
3539
- if retriable && execinfra .IsDynamicQueryHasNoHomeRegionError (err ) {
3538
+ retryable := errIsRetryable (err )
3539
+ if retryable && execinfra .IsDynamicQueryHasNoHomeRegionError (err ) {
3540
3540
// Retry only # of remote regions times if the retry is due to the
3541
3541
// enforce_home_region setting.
3542
- retriable = int (ex .state .mu .autoRetryCounter ) < len (ex .planner .EvalContext ().RemoteRegions )
3543
- if ! retriable {
3542
+ retryable = int (ex .state .mu .autoRetryCounter ) < len (ex .planner .EvalContext ().RemoteRegions )
3543
+ if ! retryable {
3544
3544
err = execinfra .MaybeGetNonRetryableDynamicQueryHasNoHomeRegionError (err )
3545
3545
}
3546
3546
}
3547
- if retriable {
3547
+ if retryable {
3548
3548
var rc rewindCapability
3549
3549
var canAutoRetry bool
3550
3550
if ex .implicitTxn () || ! ex .sessionData ().InjectRetryErrorsEnabled {
3551
3551
rc , canAutoRetry = ex .getRewindTxnCapability ()
3552
3552
}
3553
3553
3554
- ev := eventRetriableErr {
3554
+ ev := eventRetryableErr {
3555
3555
IsCommit : fsm .FromBool (isCommit (stmt )),
3556
3556
CanAutoRetry : fsm .FromBool (canAutoRetry ),
3557
3557
}
3558
- payload := eventRetriableErrPayload {
3558
+ payload := eventRetryableErrPayload {
3559
3559
err : err ,
3560
3560
rewCap : rc ,
3561
3561
}
3562
3562
return ev , payload
3563
3563
}
3564
- ev := eventNonRetriableErr {
3564
+ ev := eventNonRetryableErr {
3565
3565
IsCommit : fsm .FromBool (isCommit (stmt )),
3566
3566
}
3567
- payload := eventNonRetriableErrPayload {err : err }
3567
+ payload := eventNonRetryableErrPayload {err : err }
3568
3568
return ev , payload
3569
3569
}
3570
3570
@@ -3974,7 +3974,7 @@ func (ex *connExecutor) initPlanner(ctx context.Context, p *planner) {
3974
3974
func (ex * connExecutor ) maybeAdjustMaxTimestampBound (p * planner , txn * kv.Txn ) {
3975
3975
if autoRetryReason := ex .state .mu .autoRetryReason ; autoRetryReason != nil {
3976
3976
// If we are retrying due to an unsatisfiable timestamp bound which is
3977
- // retriable , it means we were unable to serve the previous minimum
3977
+ // retryable , it means we were unable to serve the previous minimum
3978
3978
// timestamp as there was a schema update in between. When retrying, we
3979
3979
// want to keep the same minimum timestamp for the AOST read, but set
3980
3980
// the maximum timestamp to the point just before our failed read to
0 commit comments