Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a1937d

Browse files
committed
Fix calculation of cutoff interval
1 parent663c650 commit3a1937d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎contrib/pg_tsdtm/pg_dtm.c‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static cid_t dtm_sync(cid_t global_cid)
164164
dtm_sleep(global_cid-local_cid);
165165
#ifTRACE_SLEEP_TIME
166166
totalSleepTime+=dtm_get_current_time()-now;
167-
if (now>prevReportTime+USEC*10) {
167+
if (now>prevReportTime+USEC) {
168168
prevReportTime=now;
169169
if (firstReportTime==0) {
170170
firstReportTime=now;
@@ -445,17 +445,20 @@ static TransactionId DtmAdjustOldestXid(TransactionId xid)
445445
{
446446
if (TransactionIdIsValid(xid)) {
447447
DtmTransStatus*ts,*prev=NULL;
448-
timestamp_tcutoff_time=dtm_get_current_time()-DtmVacuumDelay*USEC;
448+
timestamp_tnow=dtm_get_current_time();
449+
timestamp_tcutoff_time=now-DtmVacuumDelay*USEC;
449450
SpinLockAcquire(&local->lock);
450451
ts= (DtmTransStatus*)hash_search(xid2status,&xid,HASH_FIND,NULL);
451452
if (ts!=NULL) {
452453
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+
}
459462
if (prev!=NULL) {
460463
local->trans_list_head=prev;
461464
xid=prev->xid;
@@ -487,7 +490,7 @@ bool DtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
487490
statictimestamp_tfirstReportTime;
488491
statictimestamp_tprevReportTime;
489492
statictimestamp_ttotalSleepTime;
490-
statictimestamp_tmaxSleepTime;
493+
statictimestamp_tmnxSleepTime;
491494
#endif
492495
timestamp_tdelay=MIN_WAIT_TIMEOUT;
493496
Assert(xid!=InvalidTransactionId);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp