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

Commitda7c364

Browse files
committed
Use GetCurrentTimestamp instead of instr_time in GlobalSnapshotGenerate.
CLOCK_MONOTONIC is not ok because it is time since server start, which meansvalues between nodes are totally uncorrelated. So resort to use usual real timeclock GetCurrentTimestamp (gettimeofday); we should now ensure monotonicity onour own, but this was done previously anyway.Ideally, we should use clock_gettime with CLOCK_REALTIME which might providenanosecond resolution.
1 parent3de100c commitda7c364

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎src/backend/access/transam/global_snapshot.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,23 +368,22 @@ GlobalSnapshotToXmin(GlobalCSN snapshot_global_csn)
368368
* GlobalSnapshotGenerate
369369
*
370370
* Generate GlobalCSN which is actually a local time. Also we are forcing
371-
* this time to be always increasing. Since now it is not uncommon to have
372-
* millions of read transactions per second we are trying to use nanoseconds
371+
* this time to be always increasing.
372+
* XXX since now it is not uncommon to have
373+
* millions of read transactions per second should use nanoseconds
373374
* if such time resolution is available.
374375
*/
375376
GlobalCSN
376377
GlobalSnapshotGenerate(boollocked)
377378
{
378-
instr_timecurrent_time;
379379
GlobalCSNglobal_csn;
380380

381381
Assert(track_global_snapshots||global_snapshot_defer_time>0);
382382

383383
/*
384384
* TODO: create some macro that add small random shift to current time.
385385
*/
386-
INSTR_TIME_SET_CURRENT(current_time);
387-
global_csn= (GlobalCSN)INSTR_TIME_GET_NANOSEC(current_time);
386+
global_csn=GetCurrentTimestamp()*1000;/* nsec per usec */
388387

389388
/* TODO: change to atomics? */
390389
if (!locked)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp