Re: Reduce ProcArrayLock contention

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reduce ProcArrayLock contention
Date: 2015-08-05 12:30:53
Message-ID: CABOikdMsjTiUodj42rq6ZFczNVwmyaakRd5gaNR+wq5ME9GEhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 4, 2015 at 8:59 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

>
>
> I spent some time looking at this patch today and found that a good
> deal of cleanup work seemed to be needed. Attached is a cleaned-up
> version which makes a number of changes:
>
>
> I'm not entirely happy with the name "nextClearXidElem" but apart from
> that I'm fairly happy with this version.

Can we just call it "nextAtomicListElem" and the one in PROC_HDR
"headAtomicList" or something like that? Basically we can use the same list
later at other places requiring similar treatment. I don't see them
anything specific to clearXid stuff. Rather it is just some sort of atomic
list of PGPROC

I actually even thought if we can define some macros or functions to work
on atomic list of PGPROCs. What we need is:

- Atomic operation to add a PGPROC to list list and return the head of the
list at the time of addition
- Atomic operation to delink a list from the head and return the head of
the list at that time
- Atomic operation to remove a PGPROC from the list and return next element
in the list
- An iterator to work on the list.

This will avoid code duplication when this infrastructure is used at other
places. Any mistake in the sequence of read/write/cas can lead to a hard to
find bug.

Having said that, it might be ok if we go with the current approach and
then revisit this if and when other parts require similar logic.

Thanks,
Pavan

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-08-05 12:31:41 Re: Doubt about AccessExclusiveLock in ALTER TABLE .. SET ( .. );
Previous Message Robert Haas 2015-08-05 12:09:27 Re: RFC: replace pg_stat_activity.waiting with something more descriptive