diff options
author | Peter Geoghegan <pg@bowt.ie> | 2020-12-30 17:21:41 -0800 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2020-12-30 17:21:41 -0800 |
commit | 55e5352266b1edc943a2a57a5d349aac73bac1a2 (patch) | |
tree | 62cf5fd5d19a08d950f7a6974119d3fdac6e73e5 /src/backend/access | |
parent | 7a57960ba6a7ae74d0830d0c766c275c288ed51a (diff) | |
download | postgresql-55e5352266b1edc943a2a57a5d349aac73bac1a2.tar.gz postgresql-55e5352266b1edc943a2a57a5d349aac73bac1a2.zip |
Get heap page max offset with buffer lock held.
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
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/heapam.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 4e25622b4a3..6bd49d00252 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -7042,10 +7042,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); } /* |