Lock structures
Can someone explain why LockMethodCtl is in shared memory while
LockMethodTable is in postmaster memory context?
I realize LockMethodCtl has a spinlock, so it has to be in shared
memory, but couldn't it all be put in shared memory?
Also, the code:
LockShmemSize(int maxBackends)
{
int size = 0;
size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
size += MAXALIGN(maxBackends * sizeof(PROC)); /* each MyProc*/
size += MAXALIGN(maxBackends * sizeof(LOCKMETHODCTL)); /* each
* lockMethodTable->ctl */
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Can someone explain why LockMethodCtl is in shared memory while
LockMethodTable is in postmaster memory context?
I realize LockMethodCtl has a spinlock, so it has to be in shared
memory, but couldn't it all be put in shared memory?
I think the original point was not to assume that the shared-memory
pointers would be the same in each backend. Right now we don't need
that, but I see no good reason to change the data structure.
size += MAXALIGN(maxBackends * sizeof(LOCKMETHODCTL)); /* each
* lockMethodTable->ctl */
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.
You're right, that line is erroneous; it should read
size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
Not a significant error but it should be changed for clarity ...
regards, tom lane
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.You're right, that line is erroneous; it should read
size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
Not a significant error but it should be changed for clarity ...
I assume the fix should be done in 7.2, not 7.1, right?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.You're right, that line is erroneous; it should read
size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
Not a significant error but it should be changed for clarity ...
I assume the fix should be done in 7.2, not 7.1, right?
I see no reason to put it off ...
regards, tom lane
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.You're right, that line is erroneous; it should read
size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
Not a significant error but it should be changed for clarity ...
I assume the fix should be done in 7.2, not 7.1, right?
I see no reason to put it off ...
Tom, what about the names? There is LOCKMETHODCTL, LOCKMETHODTABLE,
and LOCKMODES. How about LOCKSTYLESHARED, LOCKSTYLE, and leave
LOCKMODES unchanged?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Tom, what about the names? There is LOCKMETHODCTL, LOCKMETHODTABLE,
and LOCKMODES. How about LOCKSTYLESHARED, LOCKSTYLE, and leave
LOCKMODES unchanged?
I think both of those names are worse (less descriptive) than what
we have ...
regards, tom lane
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Is there one LOCKMETHODCTL for every backend? I thought there was only
one of them.You're right, that line is erroneous; it should read
size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODCTL));
Not a significant error but it should be changed for clarity ...
I assume the fix should be done in 7.2, not 7.1, right?
I see no reason to put it off ...
Thanks. Fix applied.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026