@@ -164,7 +164,7 @@ static cid_t dtm_sync(cid_t global_cid)
164
164
dtm_sleep (global_cid - local_cid );
165
165
#if TRACE_SLEEP_TIME
166
166
totalSleepTime += dtm_get_current_time () - now ;
167
- if (now > prevReportTime + USEC * 10 ) {
167
+ if (now > prevReportTime + USEC ) {
168
168
prevReportTime = now ;
169
169
if (firstReportTime == 0 ) {
170
170
firstReportTime = now ;
@@ -445,17 +445,20 @@ static TransactionId DtmAdjustOldestXid(TransactionId xid)
445
445
{
446
446
if (TransactionIdIsValid (xid )) {
447
447
DtmTransStatus * ts , * prev = NULL ;
448
- timestamp_t cutoff_time = dtm_get_current_time () - DtmVacuumDelay * USEC ;
448
+ timestamp_t now = dtm_get_current_time ();
449
+ timestamp_t cutoff_time = now - DtmVacuumDelay * USEC ;
449
450
SpinLockAcquire (& local -> lock );
450
451
ts = (DtmTransStatus * )hash_search (xid2status , & xid , HASH_FIND , NULL );
451
452
if (ts != NULL ) {
452
453
cutoff_time = ts -> cid - DtmVacuumDelay * USEC ;
453
- }
454
- for (ts = local -> trans_list_head ; ts != NULL && ts -> cid < cutoff_time ; prev = ts , ts = ts -> next ) {
455
- if (prev != NULL ) {
456
- hash_search (xid2status , & prev -> xid , HASH_REMOVE , NULL );
457
- }
458
- }
454
+
455
+ for (ts = local -> trans_list_head ; ts != NULL && ts -> cid < cutoff_time ; prev = ts , ts = ts -> next ) {
456
+ if (prev != NULL ) {
457
+ /* intf(stderr, "Remove xid %d from hash at %lu\n", prev->xid, now); */
458
+ hash_search (xid2status , & prev -> xid , HASH_REMOVE , NULL );
459
+ }
460
+ }
461
+ }
459
462
if (prev != NULL ) {
460
463
local -> trans_list_head = prev ;
461
464
xid = prev -> xid ;
@@ -487,7 +490,7 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
487
490
static timestamp_t firstReportTime ;
488
491
static timestamp_t prevReportTime ;
489
492
static timestamp_t totalSleepTime ;
490
- static timestamp_t maxSleepTime ;
493
+ static timestamp_t mnxSleepTime ;
491
494
#endif
492
495
timestamp_t delay = MIN_WAIT_TIMEOUT ;
493
496
Assert (xid != InvalidTransactionId );
0 commit comments