Re: Resetting PGPROC atomics in ProcessInit()
От | Andres Freund |
---|---|
Тема | Re: Resetting PGPROC atomics in ProcessInit() |
Дата | |
Msg-id | BE9D2F3D-AF7C-46A2-B515-B8F39DC45DAC@anarazel.de обсуждение исходный текст |
Ответ на | Re: Resetting PGPROC atomics in ProcessInit() (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: Resetting PGPROC atomics in ProcessInit()
|
Список | pgsql-hackers |
On October 27, 2018 3:36:45 PM GMT+01:00, Amit Kapila <amit.kapila16@gmail.com> wrote: >On Sat, Oct 27, 2018 at 4:11 PM Andres Freund <andres@anarazel.de> >wrote: >> >> Hi, >> >> I just noticed, while working on a patch adding things to PGPROC, >that >> the group clearning patches for the proc array and clog reset atomics >in >> InitProcess(). >> >> I'm not a big fan of that, because it means that it's not safe to >look >> at the atomics of backends that aren't currently in use. Is there >any >> reason to not instead initialize them in InitProcGlobal() and just >> assert in InitProcess() that they're 0? >> > >It seems the code written has followed a natural practice i.e PGPROC >members are initialized in InitProcess and ProcGlobal members (like >procArrayGroupFirst) are initialized in InitProcGlobal. For your use >case, can't you look at procArrayGroupFirst? If not, then I think we >can do what you are saying as I don't see a problem in initializing >them in InitProcGlobal. In my opinion that's an argument for resetting the contents with pg_atomic_write, but not reinitializing the atomic (whichcould reset the spinlock inside while somebody else holds it). It's not really a problem for me, but I think the code is pretty much wrong like this... Andres -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
В списке pgsql-hackers по дате отправления: