pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DROP TABLE does not drop a table completely
3+ messages / 2 participants
[nested] [flat]

* DROP TABLE does not drop a table completely
@ 1999-05-17 02:30 Hiroshi Inoue <Inoue@tpf.co.jp>
  1999-05-17 07:01 ` Re: [HACKERS] DROP TABLE does not drop a table completely Vadim Mikheev <vadim@krasnet.ru>
  0 siblings, 1 reply; 3+ messages in thread

From: Hiroshi Inoue @ 1999-05-17 02:30 UTC (permalink / raw)
  To: pgsql-hackers <pgsql-hackers@postgreSQL.org>

Hi all,
This mail is about the original cause of [HACKERS] spinlock freeze ?(Re:
INSERT/UPDATE waiting (another example)).

> -----Original Message-----
> From: owner-pgsql-hackers@postgreSQL.org
> [mailto:owner-pgsql-hackers@postgreSQL.org]On Behalf Of Hiroshi Inoue
> Sent: Thursday, May 13, 1999 7:29 PM
> To: Tom Lane; Wayne Piekarski
> Cc: pgsql-hackers@postgreSQL.org
> Subject: [HACKERS] spinlock freeze ?(Re: INSERT/UPDATE waiting (another
> example))
>
>

[snip]

> >
> > Then another one after restarting everything:
> >
> > 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.

Comments ?

Hiroshi Inoue
Inoue@tpf.co.jp




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [HACKERS] DROP TABLE does not drop a table completely
  1999-05-17 02:30 DROP TABLE does not drop a table completely Hiroshi Inoue <Inoue@tpf.co.jp>
@ 1999-05-17 07:01 ` Vadim Mikheev <vadim@krasnet.ru>
  1999-05-17 07:40   ` RE: [HACKERS] DROP TABLE does not drop a table completely Hiroshi Inoue <Inoue@tpf.co.jp>
  0 siblings, 1 reply; 3+ messages in thread

From: Vadim Mikheev @ 1999-05-17 07:01 UTC (permalink / raw)
  To: Hiroshi Inoue <Inoue@tpf.co.jp>; +Cc: pgsql-hackers <pgsql-hackers@postgresql.org>

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* RE: [HACKERS] DROP TABLE does not drop a table completely
  1999-05-17 02:30 DROP TABLE does not drop a table completely Hiroshi Inoue <Inoue@tpf.co.jp>
  1999-05-17 07:01 ` Re: [HACKERS] DROP TABLE does not drop a table completely Vadim Mikheev <vadim@krasnet.ru>
@ 1999-05-17 07:40   ` Hiroshi Inoue <Inoue@tpf.co.jp>
  0 siblings, 0 replies; 3+ messages in thread

From: Hiroshi Inoue @ 1999-05-17 07:40 UTC (permalink / raw)
  To: Vadim Mikheev <vadim@krasnet.ru>; +Cc: pgsql-hackers <pgsql-hackers@postgresql.org>



> -----Original Message-----
> From: root@sunpine.krs.ru [mailto:root@sunpine.krs.ru]On Behalf Of Vadim
> Mikheev
> Sent: Monday, May 17, 1999 4:01 PM
> To: Hiroshi Inoue
> Cc: pgsql-hackers
> Subject: Re: [HACKERS] DROP TABLE does not drop a table completely
> 
> 
> 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?

Unlocking dropped relation before commit enables other transactions 
proceed and the transactions regard the relation as still alive before the
						   ^^^^^^^^^ 
commit of DROP TABLE command(It's right,I think). As a result,those 
transactions behave strangely,though I don't know more about the 
reason.

Thanks.

Hiroshi Inoue
Inoue@tpf.co.jp



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1999-05-17 07:40 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-05-17 02:30 DROP TABLE does not drop a table completely Hiroshi Inoue <Inoue@tpf.co.jp>
1999-05-17 07:01 ` Vadim Mikheev <vadim@krasnet.ru>
1999-05-17 07:40   ` Hiroshi Inoue <Inoue@tpf.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox