Re: pg_group_name_index corrupt? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_group_name_index corrupt?
Date
Msg-id 5086.957502370@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_group_name_index corrupt?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> After further looking, I notice that users.c is one of the few places
>> that will drop AccessExclusiveLock at heap_close time rather than
>> holding it till xact commit.  I wonder whether this is a bug...
>> it could allow another backend to get in and start vacuuming the file
>> before our updates have committed.  I am not sure that vacuum would do
>> the wrong thing in that case, but maybe so.  Comments anyone (Vadim?)
>> 
>> I also notice that there definitely is a glaring bug there:
>> write_password_file() leaks one kernel file descriptor each time it runs
>> (note the creat() call).  Alter enough pg_shadow entries in one session
>> and your backend stops working.  I think this is a "must fix" problem
>> --- any objections?

> Please fix both, I think.

I fixed the file descriptor leak, which was pretty simple and easily
checked.  After looking at VACUUM I think it will behave reasonably
with a not-yet-committed tuple, so I left that issue alone for now.

My current thought on releasing locks at heap_close time is that it's
probably best to release the lock if and only if your use of the table
was strictly read-only.  If you modified the table then your lock
should be held till xact commit.  I'm not sure about that rule however.
Any comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_group_name_index corrupt?
Next
From: Bruce Momjian
Date:
Subject: Re: pg_group_name_index corrupt?