Skip to content

Commit a1fdefa

Browse files
committed
Test for local transactions in tsDTM
1 parent b54929c commit a1fdefa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

contrib/pg_tsdtm/tests/transfers.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ func transfer(id int, wg *sync.WaitGroup) {
127127
amount := 1
128128
account1 := rand.Intn(N_ACCOUNTS)
129129
account2 := rand.Intn(N_ACCOUNTS)
130+
131+
if account1 > account2 {
132+
tmp := account1
133+
account1 = account2
134+
account2 = tmp
135+
}
130136

131137
exec(src, "update t set v = v - $1 where u=$2", amount, account1)
132138
exec(dst, "update t set v = v + $1 where u=$2", amount, account2)
@@ -152,7 +158,7 @@ func transfer(id int, wg *sync.WaitGroup) {
152158
}
153159
}
154160

155-
fmt.Println("Test completed, performed %d global transactions", nGlobalTrans)
161+
fmt.Printf("Test completed, performed %d global transactions\n", nGlobalTrans)
156162
wg.Done()
157163
}
158164

0 commit comments

Comments
 (0)