Skip to content

Commit

Permalink
storage: address TODO in TestPushTxnHeartbeatTimeout
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
nvanbenschoten committed Jul 30, 2019
1 parent 69f874d commit aa97806
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
15 changes: 6 additions & 9 deletions pkg/storage/replica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5159,15 +5159,12 @@ func TestPushTxnHeartbeatTimeout(t *testing.T) {
t.Fatalf("%d: %s", i, pErr)
}
case roachpb.STAGING:
// TODO(nvanbenschoten): Avoid writing directly to the engine once
// there's a way to create a STAGING transaction record.
txnKey := keys.TransactionKey(pushee.Key, pushee.ID)
txnRecord := pushee.AsRecord()
txnRecord.Status = roachpb.STAGING
if err := engine.MVCCPutProto(
context.Background(), tc.repl.store.Engine(), nil, txnKey, hlc.Timestamp{}, nil, &txnRecord,
); err != nil {
t.Fatal(err)
et, etH := endTxnArgs(pushee, true)
et.InFlightWrites = []roachpb.SequencedWrite{
{Key: key, Sequence: 1},
}
if _, pErr := client.SendWrappedWith(context.Background(), tc.Sender(), etH, &et); pErr != nil {
t.Fatalf("%d: %s", i, pErr)
}
default:
t.Fatalf("unexpected status: %v", test.status)
Expand Down
4 changes: 2 additions & 2 deletions pkg/storage/txn_recovery_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func TestTxnRecoveryFromStaging(t *testing.T) {
// state. Include both writes as the EndTransaction's in-flight writes.
et, etH := endTxnArgs(txn, true)
et.InFlightWrites = []roachpb.SequencedWrite{
{Key: keyA, Sequence: 0},
{Key: keyB, Sequence: 1},
{Key: keyA, Sequence: 1},
{Key: keyB, Sequence: 2},
}
etReply, pErr := client.SendWrappedWith(ctx, store.TestSender(), etH, &et)
if pErr != nil {
Expand Down

0 comments on commit aa97806

Please sign in to comment.