Details
-
Improvement
-
Resolution: Cannot Reproduce
-
Minor - P4
-
None
-
None
-
None
-
Linux (Ubuntu Maverick x86_64).
-
Storage Execution
Description
It appears that at least under some versions of Linux, if the file system disappears out from under mongod, the server will continue to operate to some degree, with the consequence that data might get written to the wrong locations and so probably lost later. Probably the server ought to abort in these cases, if it's possible to detect them.
Reproduction case:
–
#!/bin/sh
set -e
set -u
p=30000
d="`mktemp -d`"
l="`mktemp`"
pf="`mktemp`"
u=localhost:$p/test
c1='db.c.insert(
); db.c.find().forEach(printjson)'
c2='db.c.insert(
); db.c.find().forEach(printjson)'
sudo mount -t tmpfs -o size=512M tmpfs "$d"
trap "(set +e; sudo umount -lf \"$d\")" 0
mongod --pidfilepath "$pf" --port $p --logpath "$l" --dbpath "$d" --fork
trap "(set +e; kill -TERM `cat \"$pf\"`; sudo umount -lf \"$d\")" 0
echo "Inserting some data and doing a db.c.find():"
mongo --quiet --eval "$c1" $u
echo -n "Unmounting file system under mongod... "
sudo umount -lf "$d"
trap "(set +e; kill -TERM `cat \"$pf\"`
" 0
echo "done."
echo "Testing consequences of another insert:"
mongo --quiet --eval "$c2" $u
- Uncomment for cleanup.
- rm -r "$l" "$d"
–