Skip to content

Commit d263ef2

Browse files
committed
kvserver: Remove SnapshotReservationTimeoutError
SnapshotReservationTimeoutError is a part of the gRPC response error that was getting overly redacted. The overall gRPC response should be handled to fix the over redaction instead just the error part. Epic: CRDB-37533 Part of: CRDB-44885 Release note: None
1 parent 0777857 commit d263ef2

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

pkg/kv/kvpb/errors.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,34 +1828,6 @@ func NewKeyCollisionError(key roachpb.Key, value []byte) error {
18281828
return ret
18291829
}
18301830

1831-
// snapshotReservationTimeoutError represents an error that occurs when
1832-
// giving up during snapshot reservation due to cluster setting timeout.
1833-
type SnapshotReservationTimeoutError struct {
1834-
cause error
1835-
settingName string
1836-
}
1837-
1838-
// Error implements the error interface.
1839-
func (e *SnapshotReservationTimeoutError) Error() string {
1840-
return redact.Sprint(e).StripMarkers()
1841-
}
1842-
1843-
// SafeFormatError implements errors.SafeFormatter.
1844-
func (e *SnapshotReservationTimeoutError) SafeFormatError(p errors.Printer) (next error) {
1845-
p.Printf("giving up during snapshot reservation due to cluster setting %q: %v", redact.SafeString(e.settingName), redact.SafeString(e.cause.Error()))
1846-
return nil
1847-
}
1848-
1849-
// NewSnapshotReservationTimeoutError creates a new SnapshotReservationTimeoutError.
1850-
func NewSnapshotReservationTimeoutError(
1851-
cause error, settingName string,
1852-
) *SnapshotReservationTimeoutError {
1853-
return &SnapshotReservationTimeoutError{
1854-
cause: cause,
1855-
settingName: settingName,
1856-
}
1857-
}
1858-
18591831
// NewExclusionViolationError creates a new ExclusionViolationError. This error
18601832
// is returned by requests that encounter an existing value written at a
18611833
// timestamp at which they expected to have an exclusive lock on the key. This
@@ -1960,5 +1932,4 @@ var _ errors.SafeFormatter = &UnhandledRetryableError{}
19601932
var _ errors.SafeFormatter = &ReplicaUnavailableError{}
19611933
var _ errors.SafeFormatter = &ProxyFailedError{}
19621934
var _ errors.SafeFormatter = &KeyCollisionError{}
1963-
var _ errors.SafeFormatter = &SnapshotReservationTimeoutError{}
19641935
var _ errors.SafeFormatter = &ExclusionViolationError{}

pkg/kv/kvserver/store_snapshot.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ func (s *Store) throttleSnapshot(
273273
if err := ctx.Err(); err != nil {
274274
return nil, errors.Wrap(err, "acquiring snapshot reservation")
275275
}
276-
return nil, kvpb.NewSnapshotReservationTimeoutError(
277-
queueCtx.Err(), string(snapshotReservationQueueTimeoutFraction.Name()),
276+
return nil, errors.Wrapf(
277+
queueCtx.Err(),
278+
"giving up during snapshot reservation due to cluster setting %q",
279+
snapshotReservationQueueTimeoutFraction.Name(),
278280
)
279281
case <-s.stopper.ShouldQuiesce():
280282
return nil, errors.Errorf("stopped")

pkg/kv/kvserver/store_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,11 +3471,6 @@ func TestReserveSnapshotQueueTimeoutAvoidsStarvation(t *testing.T) {
34713471
if errors.Is(err, context.DeadlineExceeded) {
34723472
return nil
34733473
}
3474-
// Also handle the new SnapshotReservationTimeoutError as a timeout condition
3475-
var snapshotTimeoutErr *kvpb.SnapshotReservationTimeoutError
3476-
if errors.As(err, &snapshotTimeoutErr) {
3477-
return nil
3478-
}
34793474
return err
34803475
}
34813476
defer cleanup()

0 commit comments

Comments
 (0)