Jan Otto <as...@me.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