Skip to content

Commit ae07620

Browse files
committed
Merge branch 'master' of github.com:postgrespro/pg_tsdtm
2 parents 062a09c + a7f9674 commit ae07620

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pg_dtm.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ static HTAB* xid2status;
7474
static HTAB* gtid2xid;
7575
static DtmNodeState* local;
7676
static DtmTransState dtm_tx;
77-
static timestamp_t firstReportTime;
78-
static timestamp_t prevReportTime;
79-
static timestamp_t totalSleepTime;
8077
static uint64 totalSleepInterrupts;
8178
static int DtmVacuumDelay;
8279

@@ -144,6 +141,9 @@ static cid_t dtm_sync(cid_t global_cid)
144141
#if TRACE_SLEEP_TIME
145142
{
146143
timestamp_t now = dtm_get_current_time();
144+
static timestamp_t firstReportTime;
145+
static timestamp_t prevReportTime;
146+
static timestamp_t totalSleepTime;
147147
#endif
148148
dtm_sleep(global_cid - local_cid);
149149
#if TRACE_SLEEP_TIME
@@ -153,7 +153,7 @@ static cid_t dtm_sync(cid_t global_cid)
153153
if (firstReportTime == 0) {
154154
firstReportTime = now;
155155
} else {
156-
fprintf(stderr, "Sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime));
156+
fprintf(stderr, "Sync sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime));
157157
}
158158
}
159159
}
@@ -405,8 +405,9 @@ static TransactionId DtmAdjustOldestXid(TransactionId xid)
405405
}
406406
}
407407
if (prev != NULL) {
408+
*(int*)0 = 0;
408409
local->trans_list_head = prev;
409-
xid = prev->xid;
410+
xid = prev->xid;
410411
} else {
411412
xid = FirstNormalTransactionId;
412413
}
@@ -454,6 +455,9 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
454455
#if TRACE_SLEEP_TIME
455456
{
456457
timestamp_t now = dtm_get_current_time();
458+
static timestamp_t firstReportTime;
459+
static timestamp_t prevReportTime;
460+
static timestamp_t totalSleepTime;
457461
#endif
458462
dtm_sleep(delay);
459463
#if TRACE_SLEEP_TIME
@@ -463,7 +467,7 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
463467
if (firstReportTime == 0) {
464468
firstReportTime = now;
465469
} else {
466-
fprintf(stderr, "Sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime));
470+
fprintf(stderr, "Snapshot sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime*100.0/(now - firstReportTime));
467471
}
468472
}
469473
}

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