8.2 Partition lock changes and resource queuing.

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: 8.2 Partition lock changes and resource queuing.
Date: 2006-12-10 23:47:10
Message-ID: 457C9C7E.7010803@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've been working on a DSS query resource management module for Bizgres
[1], which is currently in the code and working (Bizgres is based on 8.1.x).

...and therein lies my new problem - updating to the 8.2 codebase. The
issue is that I have used the LockMgrLock [2] to:

1/ Manage the (resource) locks that provide the query queuing functionality.
2/ Protect shared memory structures (the queues and portal/statement
hashes) that provide the modified conflict routines and data for the queues.

However in 8.2 the partition lock changes break this design. So I'm
thinking of the following;

1/ Use the partition lock for the (resource) locks - as they live in the
lock hash table along with the standard and advisory locks.
2/ Protect shared memory structures (the queues and portal/statement
hashes) with a new lwlock (ResLockMgrLock).

This complicates the code somewhat, with what looks like a lot more
lwlock/unlock oprations - but may actually be better for concurrency as
we have less contention for an single lock (I think).

The other approach I wondered about was arranging for the resource locks
and related data structures to all use an *additional* partition lock -
which would mean faking a LOCKTAG that always hashed to
NUM_LOCK_PARTITIONS, and using that everywhere in the resource code...

Comments welcome - as I'm scratching my head somewhat about this :-)!

Cheers

Mark

[1] http://archives.postgresql.org/pgsql-hackers/2006-07/msg00133.php
[2] The main reason that a new lwlock was not used was that we need to
be able to do deadlock checking between resource and standard locks.
~

~

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-12-11 01:12:14 Re: psql display of Unicode combining characters in 8.2
Previous Message Mark Kirkwood 2006-12-10 23:40:17 Re: EXPLAIN ANALYZE