Re: [PATCH] pg_isready (was: [WIP] pg_ping utility)
От | Phil Sorber |
---|---|
Тема | Re: [PATCH] pg_isready (was: [WIP] pg_ping utility) |
Дата | |
Msg-id | CADAkt-hM5e1VCjCm3R2rH=h2v9XrL8LWr5AScFCbeMFqmj-whQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] pg_isready (was: [WIP] pg_ping utility) (Craig Ringer <craig@2ndQuadrant.com>) |
Ответы |
Re: [PATCH] pg_isready (was: [WIP] pg_ping utility)
|
Список | pgsql-hackers |
<p>On Jan 26, 2013 6:56 PM, "Craig Ringer" <<a href="mailto:craig@2ndquadrant.com">craig@2ndquadrant.com</a>> wrote:<br/> ><br /> > On 01/27/2013 06:20 AM, Phil Sorber wrote:<br /> > > On Sat, Jan 26, 2013 at 4:37 PM, PavelStehule <<a href="mailto:pavel.stehule@gmail.com">pavel.stehule@gmail.com</a>> wrote:<br /> > >> 2013/1/26Phil Sorber <<a href="mailto:phil@omniti.com">phil@omniti.com</a>>:<br /> > >>> On Sat, Jan 26,2013 at 12:39 PM, Pavel Stehule <<a href="mailto:pavel.stehule@gmail.com">pavel.stehule@gmail.com</a>> wrote:<br/> > >>>> 2013/1/26 Phil Sorber <<a href="mailto:phil@omniti.com">phil@omniti.com</a>>:<br/> > >>>>> On Sat, Jan 26, 2013 at 11:53 AM, PavelStehule <<a href="mailto:pavel.stehule@gmail.com">pavel.stehule@gmail.com</a>> wrote:<br /> > >>>>>>2013/1/26 Phil Sorber <<a href="mailto:phil@omniti.com">phil@omniti.com</a>>:<br /> > >>>>>>>On Sat, Jan 26, 2013 at 4:02 AM, Pavel Stehule <<a href="mailto:pavel.stehule@gmail.com">pavel.stehule@gmail.com</a>>wrote:<br /> > >>>>>>>> Hello<br/> > >>>>>>>><br /> > >>>>>>>> We now haw to solve small puppetissue, because our puppets try to<br /> > >>>>>>>> start server too early, when old instancelive still.<br /> > >>>>>>>><br /> > >>>>>>>> Maybe some newparameter - is_done can be useful.<br /> > >>>>>>>><br /> > >>>>>>>What about something like:<br /> > >>>>>>> pg_isready; while [ $? -ne2 ]; do sleep 1; pg_isready; done<br /> > >>>>>> it is not enough - server is done in a moment, wherecan be started<br /> > >>>>>> again - or when we can do safe copy of database data directory.<br/> > >>>>>><br /> > >>>>> I guess i am not completely understanding thecase you are trying to<br /> > >>>>> solve. Can you explain a bit further?<br /> > >>>>We use puppets and due some simplification we cannot to use reload<br /> > >>>> when configurationis changed. Our puppets has not enough intelligence<br /> > >>>> to understand when is reloadenough and when is restart necessary. So<br /> > >>>> any change to configuration require restartingpostgres. I don't know<br /> > >>>> why "service restart" are not used. I believe so our puppetguru know<br /> > >>>> it. It just do sequence STOP:START Now puppets are "smart" and able<br /> >>>>> to wait for time, when server is ready. But there are missing simple<br /> > >>>> testif server is really done and I see a error messages related to<br /> > >>>> too early try to start. Sosome important feature can be verification<br /> > >>>> so server is really done.<br /> > >>>><br/> > >>>> We can do it with test on pid file now - and probably we will use it.<br /> >>>>> But I see so this is similar use case (in opposite direction)<br /> > >>>><br /> >>>> I guess I am still not clear why you can't do:<br /> > >>><br /> > >>> stop_pg_via_puppet<br/> > >>> pg_isready<br /> > >>> while [ $? -ne 2 ]<br /> > >>> do<br /> > >>> sleep 1<br /> > >>> pg_isready<br /> > >>> done<br /> >>>> do_post_stop_things<br /> > >>> start_pg_via_puppet<br /> > >>><br /> > >>because ! pg_isready <> pg_isdone<br /> > >><br /> > > So you are proposing a different utility?Sorry, I thought you were<br /> > > proposing a new option to pg_isready. What would pg_isdone be testing<br/> > > for specifically? Is this something that would block until it has<br /> > > confirmed a shutdown?<br/> ><br /> > That's what it sounds like - confirming that PostgreSQL is really fully<br /> > shut down.<br/> ><br /> > I'm not sure how you could do that over a protocol connection, myself.<br /> > I'd just readthe postmaster pid from the pidfile on disk and then `kill<br /> > -0` it in a delay loop until the `kill` commandreturns failure. This<br /> > could be a useful convenience utility but I'm not convinced it should be<br /> >added to pg_isready because it requires local and possibly privileged<br /> > execution, unlike pg_isready's networkbased operation. Privileges could<br /> > be avoided by using an aliveness test other than `kill -0`, but you<br/> > absolutely have to be local to verify that the postmaster has fully<br /> > terminated - and it wouldn'tmake sense for a non-local process to care<br /> > about this anyway.<br /> ><p>Maybe something to add to pg_ctl?<p>>--<br /> > Craig Ringer <a href="http://www.2ndQuadrant.com/">http://www.2ndQuadrant.com/</a><br/> > PostgreSQL Development, 24x7 Support, Training& Services<br /> ><br />
В списке pgsql-hackers по дате отправления: