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

Commite2050fa

Browse files
committed
Imporove sleep statistic reporting
1 parent5c4cded commite2050fa

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

‎pg_dtm.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,21 @@ TransactionId DtmGetOldestXmin(Relation rel, bool ignoreVacuum)
438438

439439
boolDtmXidInMVCCSnapshot(TransactionIdxid,Snapshotsnapshot)
440440
{
441+
#ifTRACE_SLEEP_TIME
442+
statictimestamp_tfirstReportTime;
443+
statictimestamp_tprevReportTime;
444+
statictimestamp_ttotalSleepTime;
445+
#endif
441446
timestamp_tdelay=MIN_WAIT_TIMEOUT;
442447
Assert(xid!=InvalidTransactionId);
443448

444449
SpinLockAcquire(&local->lock);
445450

451+
#ifTRACE_SLEEP_TIME
452+
if (firstReportTime==0) {
453+
firstReportTime=dtm_get_current_time();
454+
}
455+
#endif
446456
while (true)
447457
{
448458
DtmTransStatus*ts= (DtmTransStatus*)hash_search(xid2status,&xid,HASH_FIND,NULL);
@@ -461,14 +471,11 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
461471
#ifTRACE_SLEEP_TIME
462472
{
463473
timestamp_tnow=dtm_get_current_time();
464-
statictimestamp_tfirstReportTime;
465-
statictimestamp_tprevReportTime;
466-
statictimestamp_ttotalSleepTime;
467474
#endif
468475
dtm_sleep(delay);
469476
#ifTRACE_SLEEP_TIME
470477
totalSleepTime+=dtm_get_current_time()-now;
471-
if (now>prevReportTime+USEC*10) {
478+
if (now>prevReportTime+USEC*1) {
472479
prevReportTime=now;
473480
if (firstReportTime==0) {
474481
firstReportTime=now;

‎tests/deploy/cluster.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
pg_destroy_and_init:true
1212
pg_datadir:./postgrespro-data
1313
pg_config_role:
14-
-line:"dtm.vacuum_delay=60"
14+
-line:"dtm.vacuum_delay=1000"
1515

1616
tasks:
1717

‎tests/run.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
./dtmbench \
22
-c"dbname=postgres host=localhost user=knizhnik port=5432 sslmode=disable" \
33
-c"dbname=postgres host=localhost user=knizhnik port=5433 sslmode=disable" \
4-
-c"dbname=postgres host=localhost user=knizhnik port=5434 sslmode=disable" \
5-
-n 1000 -a 1000 -w 10 -r 1$*
4+
-n 10000 -a 1000 -w 10 -r 1$*

‎tests/transfers.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ const (
1818

1919

2020
varcfg1= pgx.ConnConfig{
21-
Host:"astro9",
22-
Port:15432,
21+
Host:"127.0.0.1",
22+
Port:5432,
2323
Database:"postgres",
2424
}
2525

2626
varcfg2= pgx.ConnConfig{
27-
Host:"astro9",
28-
Port:15433,
27+
Host:"127.0.0.1",
28+
Port:5433,
2929
Database:"postgres",
3030
}
3131

@@ -109,8 +109,8 @@ func transfer(id int, wg *sync.WaitGroup) {
109109

110110
gtid:=strconv.Itoa(id)+"."+strconv.Itoa(i)
111111
amount:=2*rand.Intn(2)-1
112-
account1:=2*id+1
113-
account2:=2*id+2
112+
account1:=rand.Intn(N_ACCOUNTS)
113+
account2:=rand.Intn(N_ACCOUNTS)
114114

115115
exec(conn1,"begin transaction")
116116
exec(conn2,"begin transaction")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp