@@ -169,42 +169,10 @@ static cid_t
169
169
dtm_sync (cid_t global_cid )
170
170
{
171
171
cid_t local_cid ;
172
- #if 1
173
172
while ((local_cid = dtm_get_cid ()) < global_cid )
174
173
{
175
174
local -> time_shift += global_cid - local_cid ;
176
175
}
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
208
176
return local_cid ;
209
177
}
210
178
@@ -507,13 +475,7 @@ DtmAdjustOldestXid(TransactionId xid)
507
475
for (ts = local -> trans_list_head ; ts != NULL && ts -> cid < cutoff_time ; prev = ts , ts = ts -> next )
508
476
{
509
477
if (prev != NULL )
510
- {
511
- /*
512
- * intf(stderr, "Remove xid %d from hash at %lu\n",
513
- * prev->xid, now);
514
- */
515
478
hash_search (xid2status , & prev -> xid , HASH_REMOVE , NULL );
516
- }
517
479
}
518
480
}
519
481
if (prev != NULL )
@@ -550,24 +512,12 @@ DtmGetOldestXmin(Relation rel, bool ignoreVacuum)
550
512
bool
551
513
DtmXidInMVCCSnapshot (TransactionId xid , Snapshot snapshot )
552
514
{
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
559
515
timestamp_t delay = MIN_WAIT_TIMEOUT ;
560
516
561
517
Assert (xid != InvalidTransactionId );
562
518
563
519
SpinLockAcquire (& local -> lock );
564
520
565
- #if TRACE_SLEEP_TIME
566
- if (firstReportTime == 0 )
567
- {
568
- firstReportTime = dtm_get_current_time ();
569
- }
570
- #endif
571
521
while (true)
572
522
{
573
523
DtmTransStatus * ts = (DtmTransStatus * ) hash_search (xid2status , & xid , HASH_FIND , NULL );
@@ -585,37 +535,11 @@ DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
585
535
{
586
536
DTM_TRACE ((stderr , "%d: wait for in-doubt transaction %u in snapshot %lu\n" , getpid (), xid , dtm_tx .snapshot ));
587
537
SpinLockRelease (& local -> lock );
588
- #if TRACE_SLEEP_TIME
589
- {
590
- timestamp_t delta ,
591
- now = dtm_get_current_time ();
592
- #endif
538
+
593
539
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
+
615
541
if (delay * 2 <= MAX_WAIT_TIMEOUT )
616
- {
617
542
delay *= 2 ;
618
- }
619
543
SpinLockAcquire (& local -> lock );
620
544
}
621
545
else
0 commit comments