diff options
author | dan <dan@noemail.net> | 2016-05-24 16:20:51 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-05-24 16:20:51 +0000 |
commit | fe912510ea1f383574f06919047884617e2d517c (patch) | |
tree | 71401af5d8a740c42921c3466784d750fae6296d /src/test6.c | |
parent | abecc0b883a6afb48a14a0299dd76f39deff60f3 (diff) | |
download | sqlite-fe912510ea1f383574f06919047884617e2d517c.tar.gz sqlite-fe912510ea1f383574f06919047884617e2d517c.zip |
Fix an obscure problem with transactions written in "PRAGMA synchronous=full" mode on systems that do not support POWERSAFE_OVERWRITE causing an xSync() call to be omitted if the last frame written by a transaction is aligned to a sector boundary. This means that if a power failure or OS crash occurs very soon after such a transaction is committed, it may be lost following system recovery.
FossilOrigin-Name: 37de3eab67f12ae1ce5bc8d5e541c64fc6b1fd80
Diffstat (limited to 'src/test6.c')
-rw-r--r-- | src/test6.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/test6.c b/src/test6.c index 2a09122c6..24fe725f7 100644 --- a/src/test6.c +++ b/src/test6.c @@ -215,7 +215,9 @@ static int writeListSync(CrashFile *pFile, int isCrash){ } #ifdef TRACE_CRASHTEST - printf("Sync %s (is %s crash)\n", pFile->zName, (isCrash?"a":"not a")); + if( pFile ){ + printf("Sync %s (is %s crash)\n", pFile->zName, (isCrash?"a":"not a")); + } #endif ppPtr = &g.pWriteList; @@ -800,6 +802,27 @@ static int processDevSymArgs( } /* +** tclcmd: sqlite3_crash_now +** +** Simulate a crash immediately. This function does not return +** (writeListSync() calls exit(-1)). +*/ +static int crashNowCmd( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + if( objc!=1 ){ + Tcl_WrongNumArgs(interp, 1, objv, ""); + return TCL_ERROR; + } + writeListSync(0, 1); + assert( 0 ); + return TCL_OK; +} + +/* ** tclcmd: sqlite_crash_enable ENABLE ** ** Parameter ENABLE must be a boolean value. If true, then the "crash" @@ -1034,6 +1057,7 @@ int Sqlitetest6_Init(Tcl_Interp *interp){ #ifndef SQLITE_OMIT_DISKIO Tcl_CreateObjCommand(interp, "sqlite3_crash_enable", crashEnableCmd, 0, 0); Tcl_CreateObjCommand(interp, "sqlite3_crashparams", crashParamsObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "sqlite3_crash_now", crashNowCmd, 0, 0); Tcl_CreateObjCommand(interp, "sqlite3_simulate_device", devSymObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "unregister_devsim", dsUnregisterObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "register_jt_vfs", jtObjCmd, 0, 0); |