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

Commit248913f

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 parent7c595b2 commit248913f

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
@@ -369,23 +369,22 @@ GlobalSnapshotToXmin(GlobalCSN snapshot_global_csn)
369369
* GlobalSnapshotGenerate
370370
*
371371
* Generate GlobalCSN which is actually a local time. Also we are forcing
372-
* this time to be always increasing. Since now it is not uncommon to have
373-
* millions of read transactions per second we are trying to use nanoseconds
372+
* this time to be always increasing.
373+
* XXX since now it is not uncommon to have
374+
* millions of read transactions per second should use nanoseconds
374375
* if such time resolution is available.
375376
*/
376377
GlobalCSN
377378
GlobalSnapshotGenerate(boollocked)
378379
{
379-
instr_timecurrent_time;
380380
GlobalCSNglobal_csn;
381381

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

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp