Skip to content

Commit

Permalink
kvserver: simplify TestClosedTimestampInactiveAfterSubsumption
Browse files Browse the repository at this point in the history
Fixes cockroachdb#59448

This patch moves the test away from using the "old closed timestamp
mechanism" to using the new one. The test becomes simpler in the
process, and does not appear to be flaky any more (the test was
skipped).

Release note: None
  • Loading branch information
andreimatei committed Jun 8, 2021
1 parent 183d38f commit 965bc61
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 380 deletions.
1 change: 1 addition & 0 deletions pkg/kv/kvserver/abortspan/abortspan.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ func (sc *AbortSpan) Put(
txnID uuid.UUID,
entry *roachpb.AbortSpanEntry,
) error {
log.VEventf(ctx, 2, "writing abort span entry for %s", txnID.Short())
key := keys.AbortSpanKey(sc.rangeID, txnID)
return storage.MVCCPutProto(ctx, readWriter, ms, key, hlc.Timestamp{}, nil /* txn */, entry)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_end_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ func RunCommitTrigger(
// timestamp was bumped after it acquired latches.
if txn.WriteTimestamp.Synthetic && rec.Clock().Now().Less(txn.WriteTimestamp) {
return result.Result{}, errors.AssertionFailedf("txn %s with %s commit trigger needs "+
"commit wait. Was its timestamp bumped after acquiring latches?", txn, errors.Safe(ct.Kind()))
"commit wait. Was its timestamp bumped after acquiring latches?", txn, ct.Kind())
}

// Stage the commit trigger's side-effects so that they will go into effect on
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_push_txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func PushTxn(
if err != nil {
return result.Result{}, err
} else if !ok {
log.VEventf(ctx, 2, "pushee txn record not found")
log.VEventf(ctx, 2, "pushee txn record not found (pushee: %s)", args.PusheeTxn.Short())
// There are three cases in which there is no transaction record:
//
// * the pushee is still active but its transaction record has not
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4960,7 +4960,7 @@ func setupClusterWithSubsumedRange(
errCh := make(chan error)
blocker := filter.BlockNextMerge()
go func() {
errCh <- mergeTxn(ctx, store, *lhsDesc)
errCh <- mergeWithRightNeighbor(ctx, store, *lhsDesc)
}()
defer func() {
// Ensure that the request doesn't stay blocked if we fail.
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_relocate_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func setupReplicaRemovalTest(
require.NoError(t, err)
repl, err := tc.GetFirstStoreFromServer(t, 0).GetReplica(rangeDesc.RangeID)
require.NoError(t, err)
err = tc.MoveRangeLeaseNonCooperatively(rangeDesc, tc.Target(1), manual)
_, err = tc.MoveRangeLeaseNonCooperatively(ctx, rangeDesc, tc.Target(1), manual)
require.NoError(t, err)

// Remove first store from raft group.
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_replica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3492,7 +3492,7 @@ func TestDiscoverIntentAcrossLeaseTransferAwayAndBack(t *testing.T) {
// Transfer the lease to Server 1. Do so non-cooperatively instead of using
// a lease transfer, because the cooperative lease transfer would get stuck
// acquiring latches, which are held by txn2.
err = tc.MoveRangeLeaseNonCooperatively(rangeDesc, tc.Target(1), manual)
_, err = tc.MoveRangeLeaseNonCooperatively(ctx, rangeDesc, tc.Target(1), manual)
require.NoError(t, err)

// Send an arbitrary request to the range to update the range descriptor
Expand Down
Loading

0 comments on commit 965bc61

Please sign in to comment.