Re: Why is LockClassinfoForUpdate()'s mark4update a good idea? - Mailing list pgsql-hackers

From Hiroshi Inoue
Subject Re: Why is LockClassinfoForUpdate()'s mark4update a good idea?
Date
Msg-id 3A63BC55.28B5D7A3@tpf.co.jp
Whole thread Raw
In response to Why is LockClassinfoForUpdate()'s mark4update a good idea?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 
> Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> > I like neither unexpected errors nor doing the wrong
> > thing by handling tuples which aren't guaranteed to
> > be up-to-date. After mark4update, the tuple is
> > guaranteed to be up-to-date and heap_update won't
> > fail even though some commands etc neglect to lock
> > the correspoding relation. Isn't it proper to guard
> > myself as much as possible ?
> 
> If one piece of the system "guards itself" and others do not, what have
> you gained?  Not much. 

??? The system guarding itself won't gain bad result at least.
If one piece of system "guards others" and others do not, both
may gain bad results. Locking a class info by locking the
corrsponding relation is such a mechanism.

However I don't think we could introduce this mechanism to all
system catalogs. I implemented LockClassinfoForUpdate()  by the
following reason.

1) pg_class is the most significant relation.
2) LockClassinfoForUpdate() adds few new conflicts   by locking the pg_class tuple because locking the  corresponding
relationlocks the pg_class entity  implicitly unless some stuff neglects to lock  corresponding relation.
 

Regards.
Hiroshi Inoue


pgsql-hackers by date:

Previous
From: Lamar Owen
Date:
Subject: 7.1beta3-2 RPMset uploading.
Next
From: Thomas Lockhart
Date:
Subject: Re: MS Access vs IS NULL (was Re: [BUGS] Bug in SQL functions that use a NULL parameter directly)