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

Commit9af2b34

Browse files
radixtree: Fix crash when non-creator begins iteration over shared tree.
Previously, if a backend that attached to a shared tree attempted tostart iteration, it resulted in a crash. This commit resolves theissue by ensuring iter_context is created in RT_ATTACH().This fix applies only to v17, where radixtree.h was introduced. In themaster branch, this issue was separately resolved by960013f, whicheliminated the iter_context entirely.Reviewed-by: John NaylorDiscussion:https://postgr.es/m/CAD21AoBB2U47V=F+wQRB1bERov_of5=BOZGaybjaV8FLQyqG3Q@mail.gmail.com
1 parent32770ea commit9af2b34

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/include/lib/radixtree.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,7 @@ RT_ATTACH(dsa_area *dsa, RT_HANDLE handle)
19021902
dsa_pointercontrol;
19031903

19041904
tree= (RT_RADIX_TREE*)palloc0(sizeof(RT_RADIX_TREE));
1905+
tree->context=CurrentMemoryContext;
19051906

19061907
/* Find the control object in shared memory */
19071908
control=handle;
@@ -1910,13 +1911,22 @@ RT_ATTACH(dsa_area *dsa, RT_HANDLE handle)
19101911
tree->ctl= (RT_RADIX_TREE_CONTROL*)dsa_get_address(dsa,control);
19111912
Assert(tree->ctl->magic==RT_RADIX_TREE_MAGIC);
19121913

1914+
/*
1915+
* Create the iteration context so that the attached backend also can
1916+
* begin the iteration.
1917+
*/
1918+
tree->iter_context=AllocSetContextCreate(CurrentMemoryContext,
1919+
RT_STR(RT_PREFIX)"_radix_tree iter context",
1920+
ALLOCSET_SMALL_SIZES);
1921+
19131922
returntree;
19141923
}
19151924

19161925
RT_SCOPEvoid
19171926
RT_DETACH(RT_RADIX_TREE*tree)
19181927
{
19191928
Assert(tree->ctl->magic==RT_RADIX_TREE_MAGIC);
1929+
MemoryContextDelete(tree->iter_context);
19201930
pfree(tree);
19211931
}
19221932

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp