@@ -361,7 +361,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
361
361
Insecure : true ,
362
362
Knobs : base.TestingKnobs {
363
363
KVClient : & kvcoord.ClientTestingKnobs {
364
- TransportFactory : getInterceptingTransportFactory (roachpb . NodeID ( 1 ) ),
364
+ TransportFactory : getInterceptingTransportFactory (1 ),
365
365
},
366
366
Store : & kvserver.StoreTestingKnobs {
367
367
EvalKnobs : kvserverbase.BatchEvalTestingKnobs {
@@ -517,7 +517,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
517
517
execLeaseMover := func (t * testing.T , name string ) error {
518
518
desc , err := tc .LookupRange (keyB )
519
519
assert .NoError (t , err )
520
- t .Logf ("Transferring r%d lease to n%d" , desc .RangeID , tc . Target ( 0 ). NodeID )
520
+ t .Logf ("Transferring r%d lease to n%d" , desc .RangeID , 1 )
521
521
assert .NoError (t , tc .TransferRangeLease (desc , tc .Target (0 )))
522
522
return nil
523
523
}
@@ -585,7 +585,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
585
585
// 3. txn1->n1: Put(a), EndTxn(parallel commit) -- Puts txn1 in STAGING.
586
586
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning
587
587
// the response so we can inject network failure.
588
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
588
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
589
589
// Once we have seen the write on txn1 to n2 that we will fail, txn2
590
590
// can start.
591
591
close (txn2Ready )
@@ -607,7 +607,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
607
607
// <transfer b's lease to n1>
608
608
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
609
609
// return with error>
610
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
610
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
611
611
// Hold the operation open until we are ready to retry on the new
612
612
// replica, after which we will return the injected failure.
613
613
req .pauseUntil (t , leaseMoveComplete , cp )
@@ -774,7 +774,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
774
774
// 3. txn1->n1: Put(a), EndTxn(parallel commit) -- Puts txn1 in STAGING.
775
775
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning
776
776
// the response so we can inject network failure.
777
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
777
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
778
778
// Once we have seen the write on txn1 to n2 that we will fail, txn2
779
779
// can start.
780
780
close (txn2Ready )
@@ -796,7 +796,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
796
796
// <transfer b's lease to n1>
797
797
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
798
798
// return with error>
799
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
799
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
800
800
// Hold the operation open until we are ready to retry on the new
801
801
// replica, after which we will return the injected failure.
802
802
req .pauseUntil (t , leaseMoveComplete , cp )
@@ -937,7 +937,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
937
937
// 3. txn1->n1: Put(a), EndTxn(parallel commit) -- Puts txn1 in STAGING.
938
938
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning
939
939
// the response so we can inject network failure.
940
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
940
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
941
941
// Once we have seen the write on txn1 to n2 that we will fail, we can
942
942
// move the lease.
943
943
close (txn2Ready )
@@ -958,7 +958,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
958
958
// <transfer b's lease to n1>
959
959
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
960
960
// return with error>
961
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
961
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
962
962
// Hold the operation open until we are ready to retry on the new
963
963
// replica, after which we will return the injected failure.
964
964
req .pauseUntil (t , leaseMoveComplete , cp )
@@ -1073,7 +1073,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1073
1073
// 3. txn1->n1: Put(a), EndTxn(parallel commit) -- Puts txn1 in STAGING.
1074
1074
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning the
1075
1075
// response so we can inject network failure.
1076
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1076
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1077
1077
// Once we have seen the write on txn1 to n2 that we will fail, txn2/txn3 can start.
1078
1078
close (otherTxnsReady )
1079
1079
}
@@ -1095,7 +1095,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1095
1095
// <transfer b's lease to n1>
1096
1096
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
1097
1097
// return with error>
1098
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1098
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1099
1099
// Hold the operation open until we are ready to retry on the new
1100
1100
// replica, after which we will return the injected failure.
1101
1101
req .pauseUntil (t , leaseMoveComplete , cp )
@@ -1192,7 +1192,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1192
1192
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning the
1193
1193
// response so we can inject network failure.
1194
1194
// <transfer b's lease to n1>
1195
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1195
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1196
1196
close (leaseMoveReady )
1197
1197
req .pauseUntil (t , leaseMoveComplete , cp )
1198
1198
close (txn2Ready )
@@ -1210,7 +1210,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1210
1210
1211
1211
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
1212
1212
// return with error>
1213
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1213
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1214
1214
// Hold the operation open until we are ready to retry on the new
1215
1215
// replica, after which we will return the injected failure.
1216
1216
req .pauseUntil (t , recoverComplete , cp )
@@ -1295,7 +1295,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1295
1295
// 4. txn1->n2: Put(b) -- Send the request, but pause before returning the
1296
1296
// response so we can inject network failure.
1297
1297
// <transfer b's lease to n1>
1298
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1298
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1299
1299
close (leaseMoveReady )
1300
1300
req .pauseUntil (t , leaseMoveComplete , cp )
1301
1301
close (txn2Ready )
@@ -1317,7 +1317,7 @@ func TestTransactionUnexpectedlyCommitted(t *testing.T) {
1317
1317
1318
1318
// <inject a network failure and finally allow (4) txn1->n2: Put(b) to
1319
1319
// return with error>
1320
- if req .txnName == "txn1" && hasPut && req .toNodeID == tc . Server ( 1 ). NodeID () && cp == AfterSending {
1320
+ if req .txnName == "txn1" && hasPut && req .toNodeID == 2 && cp == AfterSending {
1321
1321
// Hold the operation open until we are ready to retry on the new
1322
1322
// replica, after which we will return the injected failure.
1323
1323
req .pauseUntil (t , txn2ETReady , cp )
0 commit comments