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

Commit7215efd

Browse files
committed
Fix rare dsa_allocate() failures due to freepage.c corruption.
In a corner case, a btree page was allocated during a clean-up operationthat could cause the tracking of the largest contiguous span of freespace to get out of whack. That was supposed to be prevented by the useof the "soft" flag to avoid allocating internal pages during incidentalclean-up work, but the flag was ignored in the case where the FPM waspromoted from singleton format to btree format. Repair.Remove an obsolete comment in passing.Back-patch to 10, where freepage.c arrived (as support for dsa.c).Author: Robert HaasDiagnosed-by: Thomas Munro and Robert HaasReported-by: Justin Pryzby, Rick Otten, Sand Stone, Arne Roland and othersDiscussion:https://postgr.es/m/CAMAYy4%2Bw3NTBM5JLWFi8twhWK4%3Dk_5L4nV5%2BbYDSPu8r4b97Zg%40mail.gmail.com
1 parent75c4614 commit7215efd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/utils/mmgr/freepage.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,9 +1470,7 @@ FreePageManagerGetInternal(FreePageManager *fpm, Size npages, Size *first_page)
14701470
* pages; if false, do it always. Returns 0 if the soft flag caused the
14711471
* insertion to be skipped, or otherwise the size of the contiguous span
14721472
* created by the insertion. This may be larger than npages if we're able
1473-
* to consolidate with an adjacent range. *internal_pages_used is set to
1474-
* true if the btree allocated pages for internal purposes, which might
1475-
* invalidate the current largest run requiring it to be recomputed.
1473+
* to consolidate with an adjacent range.
14761474
*/
14771475
staticSize
14781476
FreePageManagerPutInternal(FreePageManager*fpm,Sizefirst_page,Sizenpages,
@@ -1526,6 +1524,8 @@ FreePageManagerPutInternal(FreePageManager *fpm, Size first_page, Size npages,
15261524

15271525
if (!relptr_is_null(fpm->btree_recycle))
15281526
root=FreePageBtreeGetRecycled(fpm);
1527+
elseif (soft)
1528+
return0;/* Should not allocate if soft. */
15291529
elseif (FreePageManagerGetInternal(fpm,1,&root_page))
15301530
root= (FreePageBtree*)fpm_page_to_pointer(base,root_page);
15311531
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp