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

Commit80c79ab

Browse files
committed
pgstattuple: Use SnapshotDirty, not SnapshotNow.
Tuples belonging to uncommitted transactions should not becounted as dead.This is arguably a bug fix that should be back-patched, butas no one ever noticed until it came time to try to get ridof SnapshotNow, I'm only doing this in master for now.
1 parent3483f43 commit80c79ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎contrib/pgstattuple/pgstattuple.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,11 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
278278
Bufferbuffer;
279279
pgstattuple_typestat= {0};
280280
BufferAccessStrategybstrategy;
281+
SnapshotDataSnapshotDirty;
281282

282283
/* Disable syncscan because we assume we scan from block zero upwards */
283284
scan=heap_beginscan_strat(rel,SnapshotAny,0,NULL, true, false);
285+
InitDirtySnapshot(SnapshotDirty);
284286

285287
nblocks=scan->rs_nblocks;/* # blocks to be scanned */
286288

@@ -296,7 +298,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
296298
/* must hold a buffer lock to call HeapTupleSatisfiesVisibility */
297299
LockBuffer(scan->rs_cbuf,BUFFER_LOCK_SHARE);
298300

299-
if (HeapTupleSatisfiesVisibility(tuple,SnapshotNow,scan->rs_cbuf))
301+
if (HeapTupleSatisfiesVisibility(tuple,&SnapshotDirty,scan->rs_cbuf))
300302
{
301303
stat.tuple_len+=tuple->t_len;
302304
stat.tuple_count++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp