Re: Minor lmgr code cleanup

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Minor lmgr code cleanup
Date: 2003-09-09 17:53:26
Message-ID: 200309091753.h89HrQN06533@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


This has been saved for the 7.5 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Manfred Koizar wrote:
> On Mon, 8 Sep 2003 13:02:11 -0400 (EDT), Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> >
> >Manfred, can I get a description for this patch? Thanks.
>
> Try to reduce confusion about what is a lock method identifier, a lock
> method control structure, or a table of control structures.
>
> . Use type LOCKMASK where an int is not a counter.
>
> . Get rid of INVALID_TABLEID, use INVALID_LOCKMETHOD instead.
>
> . Use INVALID_LOCKMETHOD instead of (LOCKMETHOD) NULL, because
> LOCKMETHOD is not a pointer.
>
> . Define and use macro LockMethodIsValid.
>
> . Rename LOCKMETHOD to LOCKMETHODID.
>
> . Remove global variable LongTermTableId in lmgr.c, because it is
> never used.
>
> . Make LockTableId static in lmgr.c, because it is used nowhere else.
> Why not remove it and use DEFAULT_LOCKMETHOD?
>
> . Rename the lock method control structure from LOCKMETHODTABLE to
> LockMethodData. Introduce a pointer type named LockMethod.
>
> . Remove elog(FATAL) after InitLockTable() call in
> CreateSharedMemoryAndSemaphores(), because if something goes wrong,
> there is elog(FATAL) in LockMethodTableInit(), and if this doesn't
> help, an elog(ERROR) in InitLockTable() is promoted to FATAL.
>
> . Make InitLockTable() void, because its only caller does not use its
> return value any more.
>
> . Rename variables in lock.c to avoid statements like
> LockMethodTable[NumLockMethods] = lockMethodTable;
> lockMethodTable = LockMethodTable[lockmethod];
>
> . Change LOCKMETHODID type to uint16 to fit into struct LOCKTAG.
>
> . Remove static variables BITS_OFF and BITS_ON from lock.c, because
> I agree to this doubt:
> * XXX is a fetch from a static array really faster than a shift?
>
> . Define and use macros LOCKBIT_ON/OFF.
>
> ======================
> All 93 tests passed.
> ======================
>
> Servus
> Manfred
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-09-10 00:33:11 Re: about contrib/dbase/dbf.c (fwd): conversion of non-ascii
Previous Message Andrew Dunstan 2003-09-09 15:33:03 Re: [PATCHES] mcxt.c