Skip to content

Commit

Permalink
roachpb: include observed_max_timestamp in ReadWithinUncertaintyInter…
Browse files Browse the repository at this point in the history
…valError

This commit adds the new observed_max_timestamp field to the
ReadWithinUncertaintyIntervalError proto.
  • Loading branch information
nvanbenschoten committed Nov 25, 2020
1 parent 4d07110 commit 96b2b88
Show file tree
Hide file tree
Showing 6 changed files with 555 additions and 523 deletions.
11 changes: 5 additions & 6 deletions pkg/roachpb/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,6 @@ var _ transactionRestartError = &WriteTooOldError{}
// NewReadWithinUncertaintyIntervalError creates a new uncertainty retry error.
// The read and existing timestamps as well as the txn are purely informational
// and used for formatting the error message.
// TODO(nvanbenschoten): what should these fields be after the introduction of
// the observed max timestamp?
func NewReadWithinUncertaintyIntervalError(
readTS, existingTS hlc.Timestamp, txn *Transaction,
) *ReadWithinUncertaintyIntervalError {
Expand All @@ -921,8 +919,8 @@ func NewReadWithinUncertaintyIntervalError(
ExistingTimestamp: existingTS,
}
if txn != nil {
maxTS := txn.MaxTimestamp
rwue.MaxTimestamp = &maxTS
rwue.MaxTimestamp = txn.MaxTimestamp
rwue.ObservedMaxTimestamp = txn.ObservedMaxTimestamp
rwue.ObservedTimestamps = txn.ObservedTimestamps
}
return rwue
Expand All @@ -931,9 +929,10 @@ func NewReadWithinUncertaintyIntervalError(
// SafeFormat implements redact.SafeFormatter.
func (e *ReadWithinUncertaintyIntervalError) SafeFormat(s redact.SafePrinter, _ rune) {
s.Printf("ReadWithinUncertaintyIntervalError: read at time %s encountered "+
"previous write with future timestamp %s within uncertainty interval `t <= %v`; "+
"previous write with future timestamp %s within uncertainty interval `t <= "+
"(observed_max=%v, max=%v)`; "+
"observed timestamps: ",
e.ReadTimestamp, e.ExistingTimestamp, e.MaxTimestamp)
e.ReadTimestamp, e.ExistingTimestamp, e.ObservedMaxTimestamp, e.MaxTimestamp)

s.SafeRune('[')
for i, ot := range observedTimestampSlice(e.ObservedTimestamps) {
Expand Down
Loading

0 comments on commit 96b2b88

Please sign in to comment.