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

Commitf7102b0

Browse files
committed
Extend dsm API with a new function dsm_unpin_mapping.
This reassociates a dynamic shared memory handle previous passed todsm_pin_mapping with the current resource owner, so that it will becleaned up at the end of the current query.Patch by me. Review of the function name by Andres Freund, AmitKapila, Jim Nasby, Petr Jelinek, and Álvaro Herrera.
1 parentfd0f651 commitf7102b0

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎src/backend/storage/ipc/dsm.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,24 @@ dsm_pin_mapping(dsm_segment *seg)
795795
}
796796
}
797797

798+
/*
799+
* Arrange to remove a dynamic shared memory mapping at cleanup time.
800+
*
801+
* dsm_pin_mapping() can be used to preserve a mapping for the entire
802+
* lifetime of a process; this function reverses that decision, making
803+
* the segment owned by the current resource owner. This may be useful
804+
* just before performing some operation that will invalidate the segment
805+
* for future use by this backend.
806+
*/
807+
void
808+
dsm_unpin_mapping(dsm_segment*seg)
809+
{
810+
Assert(seg->resowner==NULL);
811+
ResourceOwnerEnlargeDSMs(CurrentResourceOwner);
812+
seg->resowner=CurrentResourceOwner;
813+
ResourceOwnerRememberDSM(seg->resowner,seg);
814+
}
815+
798816
/*
799817
* Keep a dynamic shared memory segment until postmaster shutdown.
800818
*

‎src/include/storage/dsm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern void dsm_detach(dsm_segment *seg);
3737

3838
/* Resource management functions. */
3939
externvoiddsm_pin_mapping(dsm_segment*seg);
40+
externvoiddsm_unpin_mapping(dsm_segment*seg);
4041
externvoiddsm_pin_segment(dsm_segment*seg);
4142
externdsm_segment*dsm_find_mapping(dsm_handleh);
4243

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp