Skip to content

Commit 1510bd2

Browse files
committed
Add ISOALTION_LEVEL parameter top transfer.go test
1 parent 99ea999 commit 1510bd2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

contrib/pg_xtm/tests/transfers.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const (
1212
INIT_AMOUNT = 10000
1313
N_ITERATIONS = 10000
1414
N_ACCOUNTS = TRANSFER_CONNECTIONS//100000
15+
ISOLATION_LEVEL = "repeatable read"
16+
//ISOLATION_LEVEL = "read committed"
1517
)
1618

1719

@@ -27,6 +29,7 @@ var cfg2 = pgx.ConnConfig{
2729
Database: "postgres",
2830
}
2931

32+
3033
var running = false
3134
var nodes []int32 = []int32{0,1}
3235

@@ -68,8 +71,8 @@ func prepare_db() {
6871
exec(conn2, "select dtm_join_transaction(xid))
6972

7073
// strt transaction
71-
exec(conn1, "begin transaction isolation level repeatable read")
72-
exec(conn2, "begin transaction isolation level repeatable read")
74+
exec(conn1, "begin transaction isolation level " + ISOLATION_LEVEL)
75+
exec(conn2, "begin transaction isolation level " + ISOLATION_LEVEL)
7376

7477
for i := 0; i < N_ACCOUNTS; i++ {
7578
exec(conn1, "insert into t values($1, $2)", i, INIT_AMOUNT)
@@ -109,8 +112,8 @@ func transfer(id int, wg *sync.WaitGroup) {
109112
exec(conn2, "select dtm_join_transaction(xid))
110113

111114
// start transaction
112-
exec(conn1, "begin transaction isolation level repeatable read")
113-
exec(conn2, "begin transaction isolation level repeatable read")
115+
exec(conn1, "begin transaction isolation level " + ISOLATION_LEVEL)
116+
exec(conn2, "begin transaction isolation level " + ISOLATION_LEVEL)
114117

115118
if !execUpdate(conn1, "update t set v = v + $1 where u=$2", amount, account1) ||
116119
!execUpdate(conn2, "update t set v = v - $1 where u=$2", amount, account2) {
@@ -144,8 +147,8 @@ func inspect(wg *sync.WaitGroup) {
144147
xid = execQuery(conn1, "select dtm_begin_transaction(2))
145148
exec(conn2, "select dtm_join_transaction(xid))
146149

147-
exec(conn1, "begin transaction isolation level repeatable read")
148-
exec(conn2, "begin transaction isolation level repeatable read")
150+
exec(conn1, "begin transaction isolation level " + ISOLATION_LEVEL)
151+
exec(conn2, "begin transaction isolation level " + ISOLATION_LEVEL)
149152

150153
sum1 = execQuery(conn1, "select sum(v) from t")
151154
sum2 = execQuery(conn2, "select sum(v) from t")

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