Hi Richard, You are right about the purpose of unlink but it is out of context. There are a transaction in progress and hot journal on disk. If journal can't be deleted by the end of transaction, the transaction can't be considered to be successfully finished. But current implementation of Sqlite considers this transaction as successfully committed!
The problem with file system going down during a transaction is a real problem that occurred to our customers. For them it was absolutely a disaster because they lost data they had successfully saved. I guess unixDelete must propagate ENOENT error when it runs in the context of transaction. For applications it will be like "transaction failed due to IO error". For a test I tried to remove "errno != ENOENT" unconditionally from unixDelete but immediately encountered a problem. When I tried to execute any command on an empty database e.g. "create table a (a1 text)" I got I/O error. This is because Sqlite tried to remove non-existsing "-wal" file with this stack trace: unixDelete, FP=7fff44f133e0 sqlite3OsDelete, FP=7fff44f13420 pagerOpenWalIfPresent, FP=7fff44f13460 sqlite3PagerSharedLock, FP=7fff44f13520 lockBtree, FP=7fff44f135d0 sqlite3BtreeBeginTrans, FP=7fff44f13650 sqlite3InitOne, FP=7fff44f13770 sqlite3Init, FP=7fff44f137b0 sqlite3ReadSchema, FP=7fff44f137e0 sqlite3StartTable, FP=7fff44f13980 yy_reduce, FP=7fff44f140f0 sqlite3Parser, FP=7fff44f14170 sqlite3RunParser, FP=7fff44f14220 sqlite3Prepare, FP=7fff44f14300 sqlite3LockAndPrepare, FP=7fff44f143a0 sqlite3_prepare, FP=7fff44f14410 sqlite3_exec, FP=7fff44f14520 Thanks, Efim Dyadkin -------------------------------------------------------------------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users