Skip to content

Commit

Permalink
Merge #102086
Browse files Browse the repository at this point in the history
102086: kv: improve `TestTxnCoordSenderRetries` r=nvanbenschoten a=nvanbenschoten

This PR improves `TestTxnCoordSenderRetries` in two ways, in preparation for its use to be expanded to demonstrate the difference in behavior between isolation levels.

### use local TxnMetrics in TestTxnCoordSenderRetries

The first commit updates `TestTxnCoordSenderRetries` to use a local `kv.DB` with a local `TxnMetrics` for its test transaction. This allows the test to precisely assert on the metrics without having to worry about other transactions in the system affecting them.

### add preemptive refreshes and 1PCs to TestTxnCoordSenderRetries

The second commit adds more testing conditions to TestTxnCoordSenderRetries. Each test now asserts it expectations for preemptive refreshes and for 1-phase commits.

Co-authored-by: Nathan VanBenschoten <[email protected]>
  • Loading branch information
craig[bot] and nvanbenschoten committed Apr 30, 2023
2 parents 12e2f3a + c59d66a commit d11890d
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 122 deletions.
5 changes: 5 additions & 0 deletions pkg/kv/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ func (db *DB) Clock() *hlc.Clock {
return db.clock
}

// Context returns the DB's DBContext.
func (db *DB) Context() DBContext {
return db.ctx
}

// NewDB returns a new DB.
func NewDB(
actx log.AmbientContext, factory TxnSenderFactory, clock *hlc.Clock, stopper *stop.Stopper,
Expand Down
Loading

0 comments on commit d11890d

Please sign in to comment.