Re: drop tablespace error: invalid argument

From: Jan Otto <asche(at)me(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: drop tablespace error: invalid argument
Date: 2009-08-30 10:35:58
Message-ID: A7100E92-9E7F-438C-B4A4-17927C56D142@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> Jan Otto <asche(at)me(dot)com> writes:
>>> ERROR: could not read directory "pg_tblspc/16464": Invalid argument
>>> STATEMENT: DROP TABLESPACE testspace;
>
> I have digged a bit around in the source code of postgresql to build a
> self contained test-case for Apple and found that the implementation
> of Apples readdir() is buggy. readdir() fails under some
> circumstances.
> So i have build a patch against current pgsql's HEAD to work around
> the issue. If the bug in readdir() goes into the final release snow
> leopard
> we have a solution.
>
> This patch basically frees dirdesc and rereads the tablespace location
> in case a subdirectory was deleted from the tablespace. this is the
> place
> where snow leopard fails to read the next entry with readdir().

The bug in readdir() appeared in the final snow leopard too. Anybody
with Snow Leopard installed can check this, with simply doing the
regression
tests (make check). The tablespace regression test is failing.

The patch i sent in works around the issue. if it is not acceptable to
reread
the tablespace-directory after every delete i can rewrite the
workaround.
Probably it is preferred that we write all entries of the directory
into an array
and looping through that array after that instead of looping with
ReadDir()?

regards, jan otto

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2009-08-30 11:21:04 Re: clang's static checker report.
Previous Message Stefan Kaltenbrunner 2009-08-30 09:48:47 Re: LWLock Queue Jumping