Re: shared memory message queues

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: shared memory message queues
Date: 2013-12-20 19:33:52
Message-ID: 20131220193352.GB15323@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-12-20 14:10:57 -0500, Robert Haas wrote:
> > Since you're embedding spinlocks in struct shm_toc, this module will be
> > in conflict with platforms that do --disable-spinlocks, since the number
> > of spinlocks essentially needs to be predetermined there. I personally
> > still think the solution to that is getting rid of --disable-spinlocks.
>
> Yep. We can either deprecate --disable-spinlocks, or we can add an
> API that is the reverse of S_INIT_LOCK().

How is that going to help? Even if we'd deallocate unused spinlocks -
which sure is a good idea when they require persistent resources like
the PGSemaphore based one - the maximum is still going to be there.

> > I vote for removing all the shm_toc_estimator() knowledge from the
> > header, there seems little reason to expose it that way. That just
> > exposes unneccessary details and makes fixes after releases harder
> > (requiring extensions to recompile). Function call costs hardly can
> > matter, right?
>
> Oh, you're saying to make it a function rather than a macro? Sure, I
> could do that.

Yea, keeping it private, as a function, seems like a good idea.

> > Do you assume that lookup speed isn't that important? I have a bit of a
> > hard time imagining that linear search over the keys isn't going to bite
> > us. At the least there should be a comment somewhere documenting that
> > the indented usecase is having a relatively few keys.
>
> Well, as previously noted, in the use cases I imagine for this, it'll
> be nworkers + somesmallconstant. I can add a comment to that effect.

I primarily was wondering because you have gone through a bit of effort
making it lockless. A comment would be good, yes.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-12-20 19:34:30 Re: Hot standby 9.2.6 -> 9.2.6 PANIC: WAL contains references to invalid pages
Previous Message Alvaro Herrera 2013-12-20 19:17:19 Re: preserving forensic information when we freeze