Skip to content

Commit cd00a9e

Browse files
committed
remove ifdefs
1 parent be47745 commit cd00a9e

File tree

1 file changed

+2
-78
lines changed

1 file changed

+2
-78
lines changed

contrib/pg_tsdtm/pg_dtm.c

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -169,42 +169,10 @@ static cid_t
169169
dtm_sync(cid_t global_cid)
170170
{
171171
cid_t local_cid;
172-
#if 1
173172
while ((local_cid = dtm_get_cid()) < global_cid)
174173
{
175174
local->time_shift += global_cid - local_cid;
176175
}
177-
#else
178-
while ((local_cid = dtm_get_cid()) < global_cid)
179-
{
180-
SpinLockRelease(&local->lock);
181-
#if TRACE_SLEEP_TIME
182-
{
183-
timestamp_t now = dtm_get_current_time();
184-
static timestamp_t firstReportTime;
185-
static timestamp_t prevReportTime;
186-
static timestamp_t totalSleepTime;
187-
#endif
188-
dtm_sleep(global_cid - local_cid);
189-
#if TRACE_SLEEP_TIME
190-
totalSleepTime += dtm_get_current_time() - now;
191-
if (now > prevReportTime + USEC)
192-
{
193-
prevReportTime = now;
194-
if (firstReportTime == 0)
195-
{
196-
firstReportTime = now;
197-
}
198-
else
199-
{
200-
fprintf(stderr, "Sync sleep %lu of %lu usec (%f%%)\n", totalSleepTime, now - firstReportTime, totalSleepTime * 100.0 / (now - firstReportTime));
201-
}
202-
}
203-
}
204-
#endif
205-
SpinLockAcquire(&local->lock);
206-
}
207-
#endif
208176
return local_cid;
209177
}
210178

@@ -507,13 +475,7 @@ DtmAdjustOldestXid(TransactionId xid)
507475
for (ts = local->trans_list_head; ts != NULL && ts->cid < cutoff_time; prev = ts, ts = ts->next)
508476
{
509477
if (prev != NULL)
510-
{
511-
/*
512-
* intf(stderr, "Remove xid %d from hash at %lu\n",
513-
* prev->xid, now);
514-
*/
515478
hash_search(xid2status, &prev->xid, HASH_REMOVE, NULL);
516-
}
517479
}
518480
}
519481
if (prev != NULL)
@@ -550,24 +512,12 @@ DtmGetOldestXmin(Relation rel, bool ignoreVacuum)
550512
bool
551513
DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
552514
{
553-
#if TRACE_SLEEP_TIME
554-
static timestamp_t firstReportTime;
555-
static timestamp_t prevReportTime;
556-
static timestamp_t totalSleepTime;
557-
static timestamp_t maxSleepTime;
558-
#endif
559515
timestamp_t delay = MIN_WAIT_TIMEOUT;
560516

561517
Assert(xid != InvalidTransactionId);
562518

563519
SpinLockAcquire(&local->lock);
564520

565-
#if TRACE_SLEEP_TIME
566-
if (firstReportTime == 0)
567-
{
568-
firstReportTime = dtm_get_current_time();
569-
}
570-
#endif
571521
while (true)
572522
{
573523
DtmTransStatus *ts = (DtmTransStatus *) hash_search(xid2status, &xid, HASH_FIND, NULL);
@@ -585,37 +535,11 @@ DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
585535
{
586536
DTM_TRACE((stderr, "%d: wait for in-doubt transaction %u in snapshot %lu\n", getpid(), xid, dtm_tx.snapshot));
587537
SpinLockRelease(&local->lock);
588-
#if TRACE_SLEEP_TIME
589-
{
590-
timestamp_t delta,
591-
now = dtm_get_current_time();
592-
#endif
538+
593539
dtm_sleep(delay);
594-
#if TRACE_SLEEP_TIME
595-
delta = dtm_get_current_time() - now;
596-
totalSleepTime += delta;
597-
if (delta > maxSleepTime)
598-
{
599-
maxSleepTime = delta;
600-
}
601-
if (now > prevReportTime + USEC * 10)
602-
{
603-
prevReportTime = now;
604-
if (firstReportTime == 0)
605-
{
606-
firstReportTime = now;
607-
}
608-
else
609-
{
610-
fprintf(stderr, "Snapshot sleep %lu of %lu usec (%f%%), maximum=%lu\n", totalSleepTime, now - firstReportTime, totalSleepTime * 100.0 / (now - firstReportTime), maxSleepTime);
611-
}
612-
}
613-
}
614-
#endif
540+
615541
if (delay * 2 <= MAX_WAIT_TIMEOUT)
616-
{
617542
delay *= 2;
618-
}
619543
SpinLockAcquire(&local->lock);
620544
}
621545
else

0 commit comments

Comments
 (0)