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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy