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

Commit39054f0

Browse files
committed
Merge branch 'master' of github.com:postgrespro/pg_tsdtm
2 parentsb0e05d0 +5c4cded commit39054f0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎pg_dtm.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ typedef struct DtmTransStatus
5454
typedefstruct
5555
{
5656
cid_tcid;
57+
longtime_shift;
5758
volatileslock_tlock;
5859
DtmTransStatus*trans_list_head;
5960
DtmTransStatus**trans_list_tail;
@@ -105,7 +106,7 @@ static timestamp_t dtm_get_current_time()
105106
{
106107
structtimevaltv;
107108
gettimeofday(&tv,NULL);
108-
return (timestamp_t)tv.tv_sec*USEC+tv.tv_usec;
109+
return (timestamp_t)tv.tv_sec*USEC+tv.tv_usec+local->time_shift;
109110
}
110111

111112
staticvoiddtm_sleep(timestamp_tinterval)
@@ -136,6 +137,11 @@ static cid_t dtm_get_cid()
136137
staticcid_tdtm_sync(cid_tglobal_cid)
137138
{
138139
cid_tlocal_cid;
140+
#if1
141+
while ((local_cid=dtm_get_cid())<global_cid) {
142+
local->time_shift+=global_cid-local_cid;
143+
}
144+
#else
139145
while ((local_cid=dtm_get_cid())<global_cid) {
140146
SpinLockRelease(&local->lock);
141147
#ifTRACE_SLEEP_TIME
@@ -160,6 +166,7 @@ static cid_t dtm_sync(cid_t global_cid)
160166
#endif
161167
SpinLockAcquire(&local->lock);
162168
}
169+
#endif
163170
returnglobal_cid;
164171
}
165172

@@ -525,6 +532,7 @@ void DtmInitialize()
525532
local= (DtmNodeState*)ShmemInitStruct("dtm",sizeof(DtmNodeState),&found);
526533
if (!found)
527534
{
535+
local->time_shift=0;
528536
local->cid=dtm_get_current_time();
529537
local->trans_list_head=NULL;
530538
local->trans_list_tail=&local->trans_list_head;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp