> If Commit returns with SQLITE_OK, then YES, it is handed off to the disk > with some caveats, namely: > > A - We are assuming the Python sqlite3 wrapper you use doesn't do > obfuscation of any sort and directly calls the sqlite3 API and returns the > direct result from those calls. If you haven't yet, consider using (or at > least trying) the APSW wrapper.
Some inspection of the Python wrapper would reveal that. The important thing you note is that this condition can be distinguished from the C API. > B - When SQLite reports back SQLITE_OK after a commit, it means that SQLite > has handed off the fsync() to the OS. Some OSes may lie about this having > been effected yet (in the interest of speed) and also, perhaps even > unbeknown to the OS, the hardware itself may lie about having actually > committed those bits to platters/NVRam/etc. Implementing a good database > system is as much about making the hardware comply as making the software > work. That said, data failures/corruption due to this B caveat is extremely > improbable and only ever happens in the weirdest of circumstances. The hardware and the OS are pretty much a fixed combination, since this will be used in an in-house hosted solution with Linux and some chosen enterprise-level storage. > [1] What I am not seeing in your code is conn.startTransaction() (or however > that will be named for you). How does the connection know you have meant for > a transaction to start so as to commit it later? I'm also not seeing you > testing any return value from those conn.commit() calls, but that might just > be for brevity of the post. They can however return a failure code, in which > case the commit didn't happen. Yes, the code is purely illustrative and lacks any error handling for brevity. > Again, if the first Commit returned with SQLITE_OK (with noting the above > caveats again), then no, that state is forever captured and part of the DB > now, and any new transaction will have its own atomicity. That's a very good thing which renders our potential solution viable. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users