Skip to content

Commit f31add2

Browse files
committed
Initialize the neon storage manager later at backend startup
This way MyProc is available in the initialization function. This is for v14 only; on later Postgres versions smgrinit() is called after InitProcess().
1 parent 2155cb1 commit f31add2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/backend/storage/lmgr/proc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,16 @@ InitProcess(void)
470470
*/
471471
InitLWLockAccess();
472472
InitDeadLockChecking();
473+
474+
/*
475+
* NEON: Initialize the neon storage manager. In vanilla Postgres, this is
476+
* called from BaseInit(), which runs earlier. But we want to have MyProc
477+
* available, so we run it here instead.
478+
*
479+
* In later Postgres versions, smgrinit() is called later, and this change
480+
* is no longer required.
481+
*/
482+
smgrinit();
473483
}
474484

475485
/*
@@ -624,6 +634,9 @@ InitAuxiliaryProcess(void)
624634
* Arrange to clean up at process exit.
625635
*/
626636
on_shmem_exit(AuxiliaryProcKill, Int32GetDatum(proctype));
637+
638+
/* NEON: see InitProcess */
639+
smgrinit();
627640
}
628641

629642
/*

src/backend/utils/init/postinit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ BaseInit(void)
549549
/* Do local initialization of file, storage and buffer managers */
550550
InitFileAccess();
551551
InitSync();
552-
smgrinit();
552+
/* NEON: This is done later, in InitProcess() */
553+
/* smgrinit(); */
553554
InitBufferPoolAccess();
554555
}
555556

0 commit comments

Comments
 (0)