8000 Fix a deadlock in the transfers test caused by random connection order. · postgrespro/postgres_cluster@a033f69 · GitHub
[go: up one dir, main page]

Skip to content

Commit a033f69

Browse files
committed
Fix a deadlock in the transfers test caused by random connection order.
1 parent dee9a9a commit a033f69

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

contrib/pg_xtm/tests/transfers.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ func transfer(id int, cCommits chan int, cAborts chan int, wg *sync.WaitGroup) {
138138
continue
139139
}
140140

141-
src := conn[rand.Intn(2)]
142-
dst := conn[rand.Intn(2)]
141+
srci := rand.Intn(2)
142+
dsti := rand.Intn(2)
143+
if (srci > dsti) {
144+
continue
145+
}
146+
147+
src := conn[srci]
148+
dst := conn[dsti]
143149

144150
if src == dst {
145151
// local update

0 commit comments

Comments
 (0)
0