Skip to content

Commit 7e25ccd

Browse files
committed
Actually use the 'private rows' parameter in transfers test.
1 parent 57f620d commit 7e25ccd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

contrib/pg_dtm/tests/transfers.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,20 @@ func writer(id int, cCommits chan int, cAborts chan int, wg *sync.WaitGroup) {
275275
start := time.Now()
276276
for myCommits < cfg.Writers.Updates {
277277
amount := 1
278+
278279
from_acc := rand.Intn(cfg.Accounts.Num)
279280
to_acc := rand.Intn(cfg.Accounts.Num)
280281

281-
if (from_acc == to_acc) {
282-
to_acc = (from_acc + 1) % cfg.Accounts.Num
282+
if cfg.Writers.PrivateRows {
283+
from_acc += id - (from_acc % cfg.Writers.Num)
284+
to_acc += id - (to_acc % cfg.Writers.Num)
285+
if (from_acc == to_acc) {
286+
to_acc = (from_acc + cfg.Writers.Num) % cfg.Accounts.Num
287+
}
288+
} else {
289+
if (from_acc == to_acc) {
290+
to_acc = (from_acc + 1) % cfg.Accounts.Num
291+
}
283292
}
284293

285294
if (from_acc > to_acc) {

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