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

Commited93feb

Browse files
committed
Change currtid functions to use an MVCC snapshot, not SnapshotNow.
This has a slight performance cost, but the only known consumersof these functions, known at the SQL level as currtid and currtid2,is pgsql-odbc; whose usage, we hope, is not sufficiently intensiveto make this a problem.Per discussion.
1 parent80c79ab commited93feb

File tree

1 file changed

+10
-2
lines changed
  • src/backend/utils/adt

1 file changed

+10
-2
lines changed

‎src/backend/utils/adt/tid.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include"utils/acl.h"
3131
#include"utils/builtins.h"
3232
#include"utils/rel.h"
33+
#include"utils/snapmgr.h"
3334
#include"utils/tqual.h"
3435

3536

@@ -332,6 +333,7 @@ currtid_byreloid(PG_FUNCTION_ARGS)
332333
ItemPointerresult;
333334
Relationrel;
334335
AclResultaclresult;
336+
Snapshotsnapshot;
335337

336338
result= (ItemPointer)palloc(sizeof(ItemPointerData));
337339
if (!reloid)
@@ -352,7 +354,10 @@ currtid_byreloid(PG_FUNCTION_ARGS)
352354
returncurrtid_for_view(rel,tid);
353355

354356
ItemPointerCopy(tid,result);
355-
heap_get_latest_tid(rel,SnapshotNow,result);
357+
358+
snapshot=RegisterSnapshot(GetLatestSnapshot());
359+
heap_get_latest_tid(rel,snapshot,result);
360+
UnregisterSnapshot(snapshot);
356361

357362
heap_close(rel,AccessShareLock);
358363

@@ -368,6 +373,7 @@ currtid_byrelname(PG_FUNCTION_ARGS)
368373
RangeVar*relrv;
369374
Relationrel;
370375
AclResultaclresult;
376+
Snapshotsnapshot;
371377

372378
relrv=makeRangeVarFromNameList(textToQualifiedNameList(relname));
373379
rel=heap_openrv(relrv,AccessShareLock);
@@ -384,7 +390,9 @@ currtid_byrelname(PG_FUNCTION_ARGS)
384390
result= (ItemPointer)palloc(sizeof(ItemPointerData));
385391
ItemPointerCopy(tid,result);
386392

387-
heap_get_latest_tid(rel,SnapshotNow,result);
393+
snapshot=RegisterSnapshot(GetLatestSnapshot());
394+
heap_get_latest_tid(rel,snapshot,result);
395+
UnregisterSnapshot(snapshot);
388396

389397
heap_close(rel,AccessShareLock);
390398

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp