On 11 Sep 2012, at 7:21am, Keith Chew <keith.c...@gmail.com> wrote: > In my ext3 file system, I have set barrier=1, disables write cache, > and also set commit=1 for per second disk sync from the kernel. In > your opinion, if I used NORMAL, would it mean: > (1) The most number of transactions I can lose in the WAL file is 1 > second's worth? > (2) If the WAL contained say 10 seconds worth of transactions (1 > transaction per second) before the power failure, and the 11th second > the transaction failed to make it, ie stuck between your step 1 and 2, > will the first 10 seconds worth of transactions still make it? I > presume yes, since you have checksums in the WAL file? > (3) If there is a power failure anywhere between steps 2, 3, and 4, I > presume that will be OK, since the recovery will be done on next > startup. > > If the answer is true for the above 3 questions, then I think WAL with > NORMAL is an extremely attractive option to use.
I'm posting this only because your questions suggest you need to know the actual way your system will perform in real life. Dan has answered this in terms of how SQLite3 works, but I wanted to stress that SQLite3 isn't the only link in the chain. SQLite3 working correctly depends on the SQLite3 calls writing directly to the disk, with the disk physically part of the computer that's executing the SQLite3 calls. If you're mounting the disk using NFS or any other network FS, the answers are different. Very few network setups correctly support fsync(). Also, your hard disk must support ACID, and must be in ACID support mode (probably jumper settings) which it probably isn't because that's almost never done except for hard disks used for servers. It's more likely to be set up to do out-of-order saves, and say "That's saved." first but actually save things after the call has returned. A good test is running an interactive program like Word or GIMP on that computer, or a 3D game. If those apps run acceptably fast, then your hard disk isn't doing ACID. This is the correct way to set up a non-server computer if you want it to feel nice and fast in use. I have, as a demonstration, bought components and set up a computer in ACID mode, but then loaded mundane Windows XT and Office on it. It was unusable, with Office pausing every 50 or so keystrokes for over a second so it could write temporary savefiles. Even messing about with Windows Explorer, opening folders and moving and copying files was annoyingly slow. Booted instead into a version of RedHat (I forget which version) every time Linux tried to add a line to a log file (which Unix does constantly) the GUI would freeze for a quarter second. Not what a geek would want from his or her home computer. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users