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

Commit46a2d24

Browse files
committed
dsm: allow use in single user mode.
It might seem pointless to allow use of dsm in single user mode, but otherwisesubsystems might need dedicated single user mode code paths.Besides changing the assert, all that's needed is to make some windows codeassuming the presence of postmaster conditional.Author: Andres Freund <andres@anarazel.de>Reviewed-By: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com
1 parente99546f commit46a2d24

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ static void
397397
dsm_backend_startup(void)
398398
{
399399
#ifdefEXEC_BACKEND
400+
if (IsUnderPostmaster)
400401
{
401402
void*control_address=NULL;
402403

@@ -496,8 +497,12 @@ dsm_create(Size size, int flags)
496497
FreePageManager*dsm_main_space_fpm=dsm_main_space_begin;
497498
boolusing_main_dsm_region= false;
498499

499-
/* Unsafe in postmaster (and pointless in a stand-alone backend). */
500-
Assert(IsUnderPostmaster);
500+
/*
501+
* Unsafe in postmaster. It might seem pointless to allow use of dsm in
502+
* single user mode, but otherwise some subsystems will need dedicated
503+
* single user mode code paths.
504+
*/
505+
Assert(IsUnderPostmaster|| !IsPostmasterEnvironment);
501506

502507
if (!dsm_init_done)
503508
dsm_backend_startup();

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ dsm_impl_pin_segment(dsm_handle handle, void *impl_private,
959959
{
960960
#ifdefUSE_DSM_WINDOWS
961961
caseDSM_IMPL_WINDOWS:
962+
if (IsUnderPostmaster)
962963
{
963964
HANDLEhmap;
964965

@@ -984,8 +985,8 @@ dsm_impl_pin_segment(dsm_handle handle, void *impl_private,
984985
* is unpinned, dsm_impl_unpin_segment can close it.
985986
*/
986987
*impl_private_pm_handle=hmap;
987-
break;
988988
}
989+
break;
989990
#endif
990991
default:
991992
break;
@@ -1008,6 +1009,7 @@ dsm_impl_unpin_segment(dsm_handle handle, void **impl_private)
10081009
{
10091010
#ifdefUSE_DSM_WINDOWS
10101011
caseDSM_IMPL_WINDOWS:
1012+
if (IsUnderPostmaster)
10111013
{
10121014
if (*impl_private&&
10131015
!DuplicateHandle(PostmasterHandle,*impl_private,
@@ -1025,8 +1027,8 @@ dsm_impl_unpin_segment(dsm_handle handle, void **impl_private)
10251027
}
10261028

10271029
*impl_private=NULL;
1028-
break;
10291030
}
1031+
break;
10301032
#endif
10311033
default:
10321034
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp