Update:

After finding a reference to problems with BSDI and the realpath() system
call in the mailing list archives, I tried rebuilding MySQL with the
HAVE_BROKEN_REALPATH flag defined.  That seemed to clear up the problem, at
least with the testing that I performed.  YMMV.

DSC
_________________________________________________________________________
Dan S. Camper                                         Borrowed Time, Inc.
Software Thaumaturge                                   http://www.bti.net


------ Forwarded Message
> From: Dan S. Camper <[EMAIL PROTECTED]>
> Date: Thu, 18 Apr 2002 12:41:31 -0500
> To: MySQL <[EMAIL PROTECTED]>
> Subject: BSD: Random unknown database error
> 
> All:
> 
> Recently I've run into a problem where I intermittently receive an "Unknown
> database" error while attempting to communicate with a local MySQL server.  I
> read through the mail list archives and discovered that others reported
> similar problems under BSD, but I didn't see any concrete solutions.  I may
> not be able to provide a solution, but I believe I can pinpoint the cause.
> 
> Let me apologize now for the length of this message.  I'm trying to explain
> enough so that someone else, more knowledgable about MySQL's internals, can
> either use it to solve the problem or refute my guess.
> 
> First, my environment:  MacOS X (10.1.4), MySQL 3.23.49, running on a G3
> PowerBook (Firewire), latest dev tools from Apple.  The MySQL server is
> running on that system as well as my own C++ code.
> 
> Before seeing the problem within MySQL I found a problem with my own
> multithreaded code.  Each thread is responsible for loading a file in one
> directory and then manipulating a couple of other files in a different
> directory, all referenced relatively to the application's directory.  When the
> load got high -- there were many concurrent threads -- I would intermittently
> receive an error from the OS telling me that one of the files I was trying to
> open could not be found.  Given that the file in question was one that was
> supposed to always be present, I grew suspicious.  After a bit of debugging,
> imagine my surprise when I discovered that the full pathname the OS was trying
> to use was wrong.  Example
> 
>   Source file:        foo/text.txt
>   Dest file:          data/index.txt
>   App directory:      /Users/lordgrey/Projects/myproject/
> 
> When the problem occurred while opening the dest file, referenced relatively,
> the OS was actually trying to open:
> 
>   /Users/lordgrey/Projects/myproject/foo/data/index.txt
> 
> instead of
> 
>   /Users/lordgrey/Projects/myproject/data/index.txt
> 
> Once I nailed down a variable with the current working directory at
> application launch time and used that to fully qualify my datafiles, all of my
> problems disappeared.
> 
> As further testing, I started cranking up the number of threads.  Now, in
> addition to dinking around with files, each thread has its own MySQL
> connection.  Increasing the number of threads started causing the "unknown
> database" error to appear, pretty much in direct proportion to the number
> threads.
> 
> The other problem reports in the archive noted that the "unknown database"
> problem seemed to occur when the system's load was high.  That would agree
> with what I found.
> 
> Anyway, it occurs to me that MySQL is failing to find a database -- which is a
> directory -- for the same reason that my code couldn't find its own data
> files.  Namely:  MySQL is using a relative path, BSD is mucking around with
> the concept of "current working directory" incorrectly and it's colliding with
> other concurrent threads also trying to use relative paths.
> 
> I haven't picked the MySQL source code apart to see if this is really the case
> or not, but it seems reasonable.  If it's true then the actual problem lies in
> BSD/MacOS/etc. but it can be worked around in the MySQL server.
> 
> Cheers,
> 
> DSC

------ End of Forwarded Message


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to