Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc2f8668

Browse files
committed
Add final commit/abort statistic
1 parentcae87f3 commitc2f8668

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎contrib/pg_xtm/tests/transfers-fdw.go‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const (
1212
TRANSFER_CONNECTIONS=8
1313
INIT_AMOUNT=10000
1414
N_ITERATIONS=10000
15-
N_ACCOUNTS=TRANSFER_CONNECTIONS//100000
15+
N_ACCOUNTS=100000//TRANSFER_CONNECTIONS
1616
ISOLATION_LEVEL="repeatable read"
1717
//ISOLATION_LEVEL = "read committed"
1818
)
@@ -70,7 +70,7 @@ func prepare_db() {
7070
exec(conn2,"commit")
7171
}
7272

73-
funcprogress(totalint,cCommitschanint,cAbortschanint) {
73+
funcprogress(totalint,cCommitschanint,cAbortschanint,wg*sync.WaitGroup) {
7474
commits:=0
7575
aborts:=0
7676
start:=time.Now()
@@ -86,6 +86,8 @@ func progress(total int, cCommits chan int, cAborts chan int) {
8686
start=time.Now()
8787
}
8888
}
89+
fmt.Printf("Done: %d commits, %d aborts\n",commits,aborts)
90+
wg.Done()
8991
}
9092

9193
functransfer(idint,cCommitschanint,cAbortschanint,wg*sync.WaitGroup) {
@@ -164,12 +166,14 @@ func inspect(wg *sync.WaitGroup) {
164166
funcmain() {
165167
vartransferWg sync.WaitGroup
166168
varinspectWg sync.WaitGroup
169+
varprogressWg sync.WaitGroup
167170

168171
prepare_db()
169172

170173
cCommits:=make(chanint)
171174
cAborts:=make(chanint)
172-
goprogress(TRANSFER_CONNECTIONS*N_ITERATIONS,cCommits,cAborts)
175+
progressWg.Add(1)
176+
goprogress(TRANSFER_CONNECTIONS*N_ITERATIONS,cCommits,cAborts,&progressWg)
173177

174178
transferWg.Add(TRANSFER_CONNECTIONS)
175179
fori:=0;i<TRANSFER_CONNECTIONS;i++ {
@@ -183,7 +187,8 @@ func main() {
183187
running=false
184188
inspectWg.Wait()
185189

186-
fmt.Printf("done\n")
190+
close(cCommits)
191+
progressWg.Wait()
187192
}
188193

189194
funcexec(conn*pgx.Conn,stmtstring,arguments...interface{}) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp