List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:September 28 2007 11:46am
Subject:Re: Ouch! ibdata files deleted. Why no catastrophe?
View as plain text  
Hi !

Jerry Schwartz wrote:
> I don't know Linux that well, but I know that HP-UX lets you do most
> anything to an open file, including deleting it. The file will continue to
> exist as long as it is open by at least one process. 

Yes - that is standard Unix semantics; it should be that way on any 
variety of Unix including Linux, BSD, and the commercial ones.

You can use this for any file system object (including FIFOs) to get an 
automatic cleanup if your process(es) crash(es):
- Create the object (file, FIFO, ...),
- open it (from all processes that need it),
- delete it.
It will continue to exist as long as at least one process has it open, 
but cannot be accessed by its name any longer (so no additional "open()" 
call is possible).
It will still occupy space on disk, but will not be included in any "du" 
output (because it is not accessible from any directory).
If "du" on the root directory of some file system (done by the root 
user) reports less blocks than "df" on that file system, typically the 
difference are the blocks of such deleted but still open files.

>                                                      If I remember
> correctly, this is all about the inode use count vs. the directory entry, or
> something like that. The file will actually be safe so long as it is not
> closed by the last user.
> 
> Those files will go away as soon as they are closed, so the database should
> be dumped before shutting down mysqld.

Right on both items.

Regards,
Joerg

-- 
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com

Thread
Ouch! ibdata files deleted. Why no catastrophe?Daniel Kasak26 Sep
  • Re: Ouch! ibdata files deleted. Why no catastrophe?Gary Josack26 Sep
    • Re: Ouch! ibdata files deleted. Why no catastrophe?Daniel Kasak26 Sep
      • Re: Ouch! ibdata files deleted. Why no catastrophe?Gary Josack26 Sep
        • Re: Ouch! ibdata files deleted. Why no catastrophe?Daniel Kasak26 Sep
          • Re: Ouch! ibdata files deleted. Why no catastrophe?Gary Josack26 Sep
        • Re: Ouch! ibdata files deleted. Why no catastrophe?Baron Schwartz26 Sep
          • Re: Ouch! ibdata files deleted. Why no catastrophe?Ananda Kumar26 Sep
            • Re: Ouch! ibdata files deleted. Why no catastrophe?Baron Schwartz26 Sep
  • Re: Ouch! ibdata files deleted. Why no catastrophe?Martijn Tonies26 Sep
    • RE: Ouch! ibdata files deleted. Why no catastrophe?Jerry Schwartz26 Sep
      • RE: Ouch! ibdata files deleted. Why no catastrophe?Daniel Kasak27 Sep
      • Re: Ouch! ibdata files deleted. Why no catastrophe?Joerg Bruehe28 Sep
  • Re: Ouch! ibdata files deleted. Why no catastrophe?Martijn Tonies27 Sep