Hi!
On 01-Dec-99 Bruce Momjian wrote:
>> > postmaster forks() and does not do an exec().
>>
>> >From postmaster log:
>>
>> FindExec: found "/usr/comset/dbase/bin/postgres" using argv[0]
>>
>> ps ax|grep pos
>>
>> 10665 ? R 0:01 /usr/comset/dbase/bin/postgres main.comset.com polithit
>> pol
>> 13329 ? S 0:24 /usr/comset/dbase/bin/postmaster -i
>> -D/usr/comset/dbase/dat
>>
>> These samples push me thinking it was fork/exec... :-(
>
> We re-exec the postmaster so it has an absolute path, which is sometimes
> needed for dynamic loading. We also need 5 paramaters to we can do ps
> display if forked backends.
But you know several ways to send parameters to child process...
So, You have:
1. Shared memory
2. Fifo file like /tmp/.s.PGSQL.ctl.pid-of-backend
3. Additional unnamed pipe opened for child
4. Signals like SIGUSR1 etc to force fetch parameters from somewhere.
So, in addition I found thet there is not nessesary to create a dynamic list of
child pool. You have static/dynamic linear array of backend running ;-). Waw!
Possible to add some additional info to this structure about pooled backend (I
offer before) to manage pool.
I hope I dig postgresql code this weekend to have ideas offer for developers
more constructively.
I think p.3 shown before is preferable. The main() of backend should gentle
read this pipe. Pipes in Unix have more that 1024 bytes buffer...
while (readCommand(....)) { initBackend(...); // Same as parse args... doQuery(..); finishBackend(...);
}
readCommand() should use select() with timeout for check pipe. Then signal
received it set flag on and select() loop may finish on it with 0 returned.
SKiller
--------------------------
Sergei Keler
WebMaster of "ComSet"
E-Mail: skiller@comset.net
http://www.comset.net
--------------------------