Thread: Re: 7.3b2 initdb fails with a semaphore error (solved)

Re: 7.3b2 initdb fails with a semaphore error (solved)

From
Lalo Castro
Date:
You could also recompile postgres with
./configure --with-maxbackends=N
Where N equals however many backends you want.


On Tue, 1 Oct 2002, Tom Lane wrote:

 > Mark Stosberg <mark@summersault.com> writes:
 > > I think the bug here is that this message advertises that I can change
 > > the "max_connections" parameter to address this, but there does not
 > > appear to be a way to do this.  The max_connections option is located
 > > on my system at /usr/local/share/postgresql/postgresql.conf.sample
 > > (prior to initdb)
 >
 > Hmm ... actually, I don't think the max_connections parameter is used
 > during standalone operation.  It looks like the code uses a hardwired
 > value of "16".  We could reduce that (there's probably no good reason
 > why it's not "1"), but I suspect your SEMMAX parameter is so small
 > it will fail anyway :-(
 >
 > Would you try changing "16" to "1" in InitCommunication() in
 > src/backend/utils/init/postinit.c, and see if that helps on your
 > setup?

Tom,

I tried this change, and was able to successfully "initdb" after that,
and then run "psql" after that. I'm running this installation on a home
machine for light use, so I may not need 16 backends anyway.

If you're correct that there is no need to have more than 1 backend
during "initdb", then perhaps this could be turned into a patch. My
simple patch is below:

  -mark

http://mark.stosberg.com/

################################

--- postinit.c.orig     Wed Oct  2 12:56:13 2002
+++ postinit.c  Wed Oct  2 12:56:42 2002
@@ -176,7 +176,7 @@
                  * postmaster.  Create private "shmem" and semaphores.
  Setting
                  * MaxBackends = 16 is arbitrary.
                  */
-               CreateSharedMemoryAndSemaphores(true, 16, 0);
+               CreateSharedMemoryAndSemaphores(true, 1, 0);
         }
  }








--
Lalo Castro
Programmer/Analyst
McHenry Library
(831) 459-5208

Re: 7.3b2 initdb fails with a semaphore error (solved)

From
Bruce Momjian
Date:
This has been done already and will appear in 7.3 final.

---------------------------------------------------------------------------

Lalo Castro wrote:
> You could also recompile postgres with
> ./configure --with-maxbackends=N
> Where N equals however many backends you want.
>
>
> On Tue, 1 Oct 2002, Tom Lane wrote:
>
>  > Mark Stosberg <mark@summersault.com> writes:
>  > > I think the bug here is that this message advertises that I can change
>  > > the "max_connections" parameter to address this, but there does not
>  > > appear to be a way to do this.  The max_connections option is located
>  > > on my system at /usr/local/share/postgresql/postgresql.conf.sample
>  > > (prior to initdb)
>  >
>  > Hmm ... actually, I don't think the max_connections parameter is used
>  > during standalone operation.  It looks like the code uses a hardwired
>  > value of "16".  We could reduce that (there's probably no good reason
>  > why it's not "1"), but I suspect your SEMMAX parameter is so small
>  > it will fail anyway :-(
>  >
>  > Would you try changing "16" to "1" in InitCommunication() in
>  > src/backend/utils/init/postinit.c, and see if that helps on your
>  > setup?
>
> Tom,
>
> I tried this change, and was able to successfully "initdb" after that,
> and then run "psql" after that. I'm running this installation on a home
> machine for light use, so I may not need 16 backends anyway.
>
> If you're correct that there is no need to have more than 1 backend
> during "initdb", then perhaps this could be turned into a patch. My
> simple patch is below:
>
>   -mark
>
> http://mark.stosberg.com/
>
> ################################
>
> --- postinit.c.orig     Wed Oct  2 12:56:13 2002
> +++ postinit.c  Wed Oct  2 12:56:42 2002
> @@ -176,7 +176,7 @@
>                   * postmaster.  Create private "shmem" and semaphores.
>   Setting
>                   * MaxBackends = 16 is arbitrary.
>                   */
> -               CreateSharedMemoryAndSemaphores(true, 16, 0);
> +               CreateSharedMemoryAndSemaphores(true, 1, 0);
>          }
>   }
>
>
>
>
>
>
>
>
> --
> Lalo Castro
> Programmer/Analyst
> McHenry Library
> (831) 459-5208
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073