From: | "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com> |
---|---|
To: | "Gregory Stark" <stark(at)enterprisedb(dot)com> |
Cc: | Jan Urbański <j(dot)urbanski(at)students(dot)mimuw(dot)edu(dot)pl>, "Postgres - Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: deadlock while doing VACUUM and DROP |
Date: | 2008-05-16 08:53:09 |
Message-ID: | 2e78013d0805160153v6c540d7dsb6ebfd3050f93587@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, May 16, 2008 at 1:17 PM, Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
>
>
> Surely we should be locking the relation before even doing the dependency scan
> or else someone else can come along and add more dependencies after we've
> started the scan?
>
Yeah, that's indeed possible. I could make that happen the following way:
Session 1:
- CREATE TABLE test (a int);
- Attach the session to gdb
- Put a break at dependency.c:727 (just before doDeletion() call)
- DROP TABLE test;
Session 2:
- CREATE INDEX testindx ON test(a);
The CREATE INDEX in session 2 succeeds. But DROP TABLE at this point
has already scanned all the dependencies and fails to recognize the
newly added dependency. As a result, the table gets dropped but the
index remains.
Session 1:
- continue from the breakpoint
- DROP TABLE succeeds.
- But the index remains
postgres=# SELECT relname, relfilenode from pg_class WHERE relname
like '%test%';
relname | relfilenode
-----------+-------------
testindx | 16391
(1 row)
You can't even drop the index now.
postgres=# DROP INDEX testindx;
ERROR: could not open relation with OID 16388
If I remember correctly, we had seen a similar bug report few days
back. May be we now know the cause.
>> Also I am not sure if the issue is big enough to demand the change.
>
> I think it is, effectively what we have now is "your DDL could fail randomly
> for reasons that are out of your control" :(
>
Yeah. I think we better fix this, especially given the above mentioned scenario.
Thanks,
Pavan
--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2008-05-16 10:00:22 | Re: Arbitary file size limit in twophase.c |
Previous Message | Gregory Stark | 2008-05-16 07:47:57 | Re: deadlock while doing VACUUM and DROP |