git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4228817)
Get heap page max offset with buffer lock held.
2020年12月31日 01:21:42 +0000 (17:21 -0800)
2020年12月31日 01:21:42 +0000 (17:21 -0800)
On further reflection it seems better to call PageGetMaxOffsetNumber()
after acquiring a buffer lock on the page. This shouldn't really
matter, but doing it this way is cleaner.

Follow-up to commit 42288174.

Backpatch: 12-, just like commit 42288174


diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index da27903cb4c9276b1e0734e6ed43d6bd603e0f11..26c2006f23c0bbd8b969072f6bfe4ec1026b5836 100644 (file)
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7075,10 +7075,10 @@ heap_compute_xid_horizon_for_tuples(Relation rel,
xid_horizon_prefetch_buffer(rel, &prefetch_state, 1);
#endif
+ LockBuffer(buf, BUFFER_LOCK_SHARE);
+
page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page);
-
- LockBuffer(buf, BUFFER_LOCK_SHARE);
}
/*
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /