pgsql: Convert Sharedsort's worker counters to atomic variables. - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Convert Sharedsort's worker counters to atomic variables.
Date
Msg-id E1x95aJ-00000000oE4-2Oyy@gemulon.postgresql.org
Whole thread
List pgsql-committers
Convert Sharedsort's worker counters to atomic variables.

Currently, currentWorker and workersFinished are ints protected by
a spinlock.  By converting them to atomic variables, we can remove
the spinlock.  Note that the spinlock also covered the write of
each worker's tape metadata.  Removing it is still okay: each
worker writes only its own slot, and the atomic increment that
follows is a full barrier.  Furthermore, the leader doesn't read
the slot values until all workers have finished.

Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Tested-by: solai v <solai.cdac@gmail.com>
Discussion: https://postgr.es/m/alAJeRRzehDjLaF1%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ee97eef695e8be9153595131f8b63e4b1b3e8196

Modified Files
--------------
src/backend/utils/sort/tuplesort.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)


pgsql-committers by date:

Previous
From: Nathan Bossart
Date:
Subject: pgsql: Convert PROC_HDR->startupBufferPinWaitBuf to an atomic variable.
Next
From: Nathan Bossart
Date:
Subject: pgsql: Convert SharedFileSet->refcnt to an atomic variable.