Here some information useful for people coming from the Windows world to Linux or MacOsX
Under Linux or MacosX you can do the following (but of course don't do
this on a production database) :
Connect to a database
delete the database file
commit to the database
close the connection
and then, without any warning, of course, all the work you thought
that was
committed is lost, since you have no database anymore
or
Connect to a database
rename the database file
show database still show the old filename
commit some work
connect to the new database file
magic, all the commit work is in the new database file
And here (thanks Alex) the explanation :
On unix the following behavior was always documented.
There is a structure called i-node which exists for each
file on the disk. It has a number (1 as for the rule, but may be
more)links
from directories, each of them being a name of that file (i.e. one
filecan
have many names). You may try to
# echo ABC >file1# ln file1 file2# mkdir sub# ln file1 sub/file1
All names (file1 file2 sub/file1) are names of same file. Each
link increments
link count in inode by 1 (i.e. in our sample it will be 3). When we
do:
# rm file1
link count becomes 2. As soon as it becomes 0 file is physically
removed.
Now we proceed with the most interesting - opening each file each time
increments inode's link count by 1. And closing - decrements.
Thereforeas
soon as fbserver opens some DB file, it's link count becomes 2 instead
of 1,
and removing it sets link count to 1. But inode is alive and
OK! Therefore
you can insert, commit, do what you want - no error happens. But when
DB is
detached - link count becomes 0, and file is deleted.
Looks like bad feature, but it was designed to support temp files.
When temp
file is created, it may be removed at once, while it's descriptor
remaind
correct. And you need not care about removing temp files at program
exit (or,
moreover, if it exits die to some failure). This is documented
behavior, and
if you use unix - you should live with it.
PS thanks Alex for your help