@@ -63,8 +63,8 @@ typedef struct
63
63
} DtmTransId ;
64
64
65
65
66
- // #define DTM_TRACE(x)
67
- #define DTM_TRACE (x ) fprintf x
66
+ #define DTM_TRACE (x )
67
+ // #define DTM_TRACE(x) fprintf x
68
68
69
69
static shmem_startup_hook_type prev_shmem_startup_hook ;
70
70
static HTAB * xid2status ;
@@ -290,7 +290,7 @@ dtm_extend(PG_FUNCTION_ARGS)
290
290
{
291
291
GlobalTransactionId gtid = PG_GETARG_CSTRING (0 );
292
292
cid_t cid = DtmLocalExtend (& dtm_tx , gtid );
293
- DTM_TRACE ((stderr , "Backend %d extends transaction %u(%s) to global with cid=%llu \n" , getpid (), dtm_tx .xid , gtid , cid ));
293
+ DTM_TRACE ((stderr , "Backend %d extends transaction %u(%s) to global with cid=%lu \n" , getpid (), dtm_tx .xid , gtid , cid ));
294
294
PG_RETURN_INT64 (cid );
295
295
}
296
296
@@ -299,7 +299,7 @@ dtm_access(PG_FUNCTION_ARGS)
299
299
{
300
300
cid_t cid = PG_GETARG_INT64 (0 );
301
301
GlobalTransactionId gtid = PG_GETARG_CSTRING (1 );
302
- DTM_TRACE ((stderr , "Backend %d joins transaction %u(%s) with cid=%llu \n" , getpid (), dtm_tx .xid , gtid , cid ));
302
+ DTM_TRACE ((stderr , "Backend %d joins transaction %u(%s) with cid=%lu \n" , getpid (), dtm_tx .xid , gtid , cid ));
303
303
cid = DtmLocalAccess (& dtm_tx , gtid , cid );
304
304
PG_RETURN_INT64 (cid );
305
305
}
@@ -320,7 +320,7 @@ dtm_prepare(PG_FUNCTION_ARGS)
320
320
GlobalTransactionId gtid = PG_GETARG_CSTRING (0 );
321
321
cid_t cid = PG_GETARG_INT64 (1 );
322
322
cid = DtmLocalPrepare (gtid , cid );
323
- DTM_TRACE ((stderr , "Backend %d prepares transaction %s with cid=%llu \n" , getpid (), gtid , cid ));
323
+ DTM_TRACE ((stderr , "Backend %d prepares transaction %s with cid=%lu \n" , getpid (), gtid , cid ));
324
324
PG_RETURN_INT64 (cid );
325
325
}
326
326
@@ -329,7 +329,7 @@ dtm_end_prepare(PG_FUNCTION_ARGS)
329
329
{
330
330
GlobalTransactionId gtid = PG_GETARG_CSTRING (0 );
331
331
cid_t cid = PG_GETARG_INT64 (1 );
332
- DTM_TRACE ((stderr , "Backend %d ends prepare of transactions %s with cid=%llu \n" , getpid (), gtid , cid ));
332
+ DTM_TRACE ((stderr , "Backend %d ends prepare of transactions %s with cid=%lu \n" , getpid (), gtid , cid ));
333
333
DtmLocalEndPrepare (gtid , cid );
334
334
PG_RETURN_VOID ();
335
335
}
@@ -377,7 +377,8 @@ static TransactionId DtmAdjustOldestXid(TransactionId xid)
377
377
ts = (DtmTransStatus * )hash_search (xid2status , & xid , HASH_FIND , NULL );
378
378
if (ts == NULL || ts -> cid + DtmVacuumDelay * USEC > dtm_get_current_time ()) {
379
379
xid = DtmOldestXid ;
380
- } else if (ts -> cid > DtmOldestCid ) {
380
+ } else /*if (ts->cid > DtmOldestCid)*/ {
381
+ DTM_TRACE (("Set new oldest xid=%u csn=%lu now=%lu\n" , xid , ts -> cid , dtm_get_current_time ()));
381
382
DtmOldestXid = xid ;
382
383
DtmOldestCid = ts -> cid ;
383
384
}
@@ -421,7 +422,7 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
421
422
}
422
423
if (ts -> status == TRANSACTION_STATUS_IN_PROGRESS )
423
424
{
424
- DTM_TRACE ((stderr , "%d: wait for in-doubt transaction %u in snapshot %llu \n" , getpid (), xid , dtm_tx .snapshot ));
425
+ DTM_TRACE ((stderr , "%d: wait for in-doubt transaction %u in snapshot %lu \n" , getpid (), xid , dtm_tx .snapshot ));
425
426
SpinLockRelease (& local -> lock );
426
427
dtm_sleep (delay );
427
428
if (delay * 2 <= MAX_WAIT_TIMEOUT ) {
@@ -440,7 +441,7 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
440
441
}
441
442
else
442
443
{
443
- DTM_TRACE ((stderr , "%d: visibility check is skept for transaction %u in snapshot %llu \n" , getpid (), xid , dtm_tx .snapshot ));
444
+ DTM_TRACE ((stderr , "%d: visibility check is skept for transaction %u in snapshot %lu \n" , getpid (), xid , dtm_tx .snapshot ));
444
445
break ;
445
446
}
446
447
}
@@ -498,7 +499,7 @@ void DtmLocalBegin(DtmTransState* x)
498
499
x -> is_prepared = false;
499
500
x -> snapshot = dtm_get_cid ();
500
501
SpinLockRelease (& local -> lock );
501
- DTM_TRACE ((stderr , "DtmLocalBegin: transaction %u uses local snapshot %llu \n" , x -> xid , x -> snapshot ));
502
+ DTM_TRACE ((stderr , "DtmLocalBegin: transaction %u uses local snapshot %lu \n" , x -> xid , x -> snapshot ));
502
503
}
503
504
}
504
505
@@ -581,7 +582,7 @@ void DtmLocalEndPrepare(GlobalTransactionId gtid, cid_t cid)
581
582
582
583
dtm_sync (cid );
583
584
584
- DTM_TRACE ((stderr , "Prepare transaction %u(%s) with CSN %llu \n" , id -> xid , gtid , cid ));
585
+ DTM_TRACE ((stderr , "Prepare transaction %u(%s) with CSN %lu \n" , id -> xid , gtid , cid ));
585
586
}
586
587
SpinLockRelease (& local -> lock );
587
588
}
@@ -618,7 +619,7 @@ void DtmLocalCommit(DtmTransState* x)
618
619
}
619
620
x -> cid = ts -> cid ;
620
621
ts -> status = TRANSACTION_STATUS_COMMITTED ;
621
- DTM_TRACE ((stderr , "Local transaction %u is committed at %llu \n" , x -> xid , x -> cid ));
622
+ DTM_TRACE ((stderr , "Local transaction %u is committed at %lu \n" , x -> xid , x -> cid ));
622
623
}
623
624
SpinLockRelease (& local -> lock );
624
625
}
@@ -656,7 +657,7 @@ void DtmLocalAbort(DtmTransState* x)
656
657
}
657
658
x -> cid = ts -> cid ;
658
659
ts -> status = TRANSACTION_STATUS_ABORTED ;
659
- DTM_TRACE ((stderr , "Local transaction %u is aborted at %llu \n" , x -> xid , x -> cid ));
660
+ DTM_TRACE ((stderr , "Local transaction %u is aborted at %lu \n" , x -> xid , x -> cid ));
660
661
}
661
662
SpinLockRelease (& local -> lock );
662
663
}
0 commit comments