Re: [HACKERS] DROP TABLE does not drop a table completely

From: Vadim Mikheev <vadim(at)krasnet(dot)ru>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] DROP TABLE does not drop a table completely
Date: 1999-05-17 07:01:19
Message-ID: 373FBEBF.C09E99B@krasnet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Hiroshi Inoue wrote:
>
> > >
> > > ERROR: cannot open segment 1 of relation sessions_done_id_index
> > >
> >
> > I got the same error in my test cases.
> > I don't understand the cause of this error.
> >
>
> I got this error message by dropping a table while concurrent transactions
> inserting rows to the same table.
>
> I think other transactions should abort with message "Table does not
> exist". But in most cases the result is not so.
>
> It seems that other transactions could proceed before DROP TABLE
> command is completed.
>
> AFAIC heap_destroy_with_catalog() acquires AccessExclusiveLock and
> releases the lock inside the function.
>
> I think that heap_destroy_with_catalog() (or upper level function) should
> not
> release the lock.

You're right - this should be done keeping in mind that DROP is allowed
inside BEGIN/END (long transactions), but I'm not sure that this
will help generally: does it matter when unlock dropped relation -
in heap_destroy_with_catalog() or in commit? The real problem is
that heap/index_open open file _before_ acquiring any locks and
doesn't check t_xmax of relation/index tuple. I believe that
this is old problem. There are another ones, sure.
Catalog cache code must be re-designed.

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-05-17 07:40:56 RE: [HACKERS] DROP TABLE does not drop a table completely
Previous Message Bruce Momjian 1999-05-17 06:39:48 Re: [HACKERS] Open 6.5 items

Browse pgsql-sql by date

  From Date Subject
Next Message Hiroshi Inoue 1999-05-17 07:40:56 RE: [HACKERS] DROP TABLE does not drop a table completely
Previous Message Hiroshi Inoue 1999-05-17 02:30:45 DROP TABLE does not drop a table completely