From 52564d7002c4f2f64735dfc2d93cdfa827145fb1 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jul 2011 11:04:18 +0000 Subject: [PATCH 01/41] Update the anti-virus retry logic for DeleteFile(). Invoke sqlite3_log() for each anti-virus retry. Make the retry delay configurable at compile-time. FossilOrigin-Name: 89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 44 ++++++++++++++++++-------------------------- test/wal6.test | 13 ++----------- 4 files changed, 28 insertions(+), 45 deletions(-) diff --git a/manifest b/manifest index e631fa3a74..7953e79169 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sTCL\scommands\sfor\ssetting\swindows\smanditory\slocks.\nAdd\stest\scases\sfor\smanditory\slock\sdelays\sunder\swindows. -D 2011-07-11T23:45:44.051 +C Update\sthe\santi-virus\sretry\slogic\sfor\sDeleteFile().\s\sInvoke\ssqlite3_log()\nfor\seach\santi-virus\sretry.\s\sMake\sthe\sretry\sdelay\sconfigurable\sat\ncompile-time. +D 2011-07-12T11:04:18.838 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d -F src/os_win.c 6ba8a531bdc739b23143e8f1d26222ead4d0bdb0 +F src/os_win.c 4cea89f0a6c98b6a7f4fb3895544af8a07d7807d F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -882,7 +882,7 @@ F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782 F test/wal3.test 5c396cc22497244d627306f4c1d360167353f8dd F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 F test/wal5.test f06a0427e06db00347e32eb9fa99d6a5c0f2d088 -F test/wal6.test 07aa31ca8892d0527f2c5c5a9a2a87aa421dfaa8 +F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe F test/walbak.test 4df1c7369da0301caeb9a48fa45997fd592380e4 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P c20aca06610407c197ea50ea77c2591aacf2252a -R 4c1b031b9c10734fc2cbb78ed1f104dd +P 03af4c175c6ba303ec0a5be25fd42771e38f7347 +R b94301e8087eadceda58922babc3618f U drh -Z 4f5517f8772eb0c19d9bc59edbaff4cc +Z 71facc3c10c90f54a5e699820f127261 diff --git a/manifest.uuid b/manifest.uuid index 688cc99f9e..ccdb128bfa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -03af4c175c6ba303ec0a5be25fd42771e38f7347 \ No newline at end of file +89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 59baeebb5f..f0cef15359 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -403,11 +403,16 @@ static int winLogErrorAtLine( } /* -** The number of times that a ReadFile() or WriteFile() will be retried -** following a locking error. +** The number of times that a ReadFile(), WriteFile(), and DeleteFile() +** will be retried following a locking error - probably caused by +** antivirus software. Also the initial delay before the first retry. +** The delay increases linearly with each retry. */ #ifndef SQLITE_WIN32_IOERR_RETRY -# define SQLITE_WIN32_IOERR_RETRY 5 +# define SQLITE_WIN32_IOERR_RETRY 10 +#endif +#ifndef SQLITE_WIN32_IOERR_RETRY_DELAY +# define SQLITE_WIN32_IOERR_RETRY_DELAY 25 #endif /* @@ -422,7 +427,10 @@ static int retryIoerr(int *pnRetry){ } e = GetLastError(); if( e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ - Sleep(50 + 50*(*pnRetry)); + int delay = SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry); + sqlite3_log(SQLITE_IOERR, "delay %dms for lock/sharing violation - " + "probably due to antivirus software", delay); + Sleep(delay); ++*pnRetry; return 1; } @@ -2351,15 +2359,13 @@ static int winOpen( ** to MX_DELETION_ATTEMPTs deletion attempts are run before giving ** up and returning an error. */ -#define MX_DELETION_ATTEMPTS 5 static int winDelete( sqlite3_vfs *pVfs, /* Not used on win32 */ const char *zFilename, /* Name of file to delete */ int syncDir /* Not used on win32 */ ){ int cnt = 0; - DWORD rc; - DWORD error = 0; + int rc; void *zConverted; UNUSED_PARAMETER(pVfs); UNUSED_PARAMETER(syncDir); @@ -2370,34 +2376,20 @@ static int winDelete( return SQLITE_NOMEM; } if( isNT() ){ - do{ - DeleteFileW(zConverted); - }while( ( ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES) - || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) - && (++cnt < MX_DELETION_ATTEMPTS) - && (Sleep(100), 1) ); + while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. ** Since the ASCII version of these Windows API do not exist for WINCE, ** it's important to not reference them for WINCE builds. */ #if SQLITE_OS_WINCE==0 }else{ - do{ - DeleteFileA(zConverted); - }while( ( ((rc = GetFileAttributesA(zConverted)) != INVALID_FILE_ATTRIBUTES) - || ((error = GetLastError()) == ERROR_ACCESS_DENIED)) - && (++cnt < MX_DELETION_ATTEMPTS) - && (Sleep(100), 1) ); + while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} #endif } + if( rc ) rc = winLogError(SQLITE_IOERR_DELETE, "winDelete", zFilename); free(zConverted); - OSTRACE(("DELETE \"%s\" %s\n", zFilename, - ( (rc==INVALID_FILE_ATTRIBUTES) && (error==ERROR_FILE_NOT_FOUND)) ? - "ok" : "failed" )); - - return ( (rc == INVALID_FILE_ATTRIBUTES) - && (error == ERROR_FILE_NOT_FOUND)) ? SQLITE_OK : - winLogError(SQLITE_IOERR_DELETE, "winDelete", zFilename); + OSTRACE(("DELETE \"%s\" %s\n", zFilename, (rc ? "failed" : "ok" ))); + return rc; } /* diff --git a/test/wal6.test b/test/wal6.test index 6fae48e9ea..ec31bb8b0f 100644 --- a/test/wal6.test +++ b/test/wal6.test @@ -43,19 +43,11 @@ foreach jmode $all_journal_modes { } {1 2} # Under Windows, you'll get an error trying to delete -# a file this is already opened. For now, make sure -# we get that error, then close the first connection +# a file this is already opened. Close the first connection # so the other tests work. if {$tcl_platform(platform)=="windows"} { if {$jmode=="persist" || $jmode=="truncate"} { - do_test wal6-1.2.$jmode.win { - sqlite3 db2 test.db - catchsql { - PRAGMA journal_mode=WAL; - } db2 - } {1 {disk I/O error}} - db2 close - db close + db close } } @@ -87,4 +79,3 @@ if {$tcl_platform(platform)=="windows"} { } finish_test - From a32ad8434e99b1412b2df9a45b7f5b6b7122bdf8 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 12 Jul 2011 13:51:05 +0000 Subject: [PATCH 02/41] Improvements to the logging that occurs on an antivirus I/O retry. FossilOrigin-Name: ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 28 ++++++++++++++++++++++------ test/win32lock.test | 19 ++++++++++++++++++- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 7953e79169..8789521b05 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\santi-virus\sretry\slogic\sfor\sDeleteFile().\s\sInvoke\ssqlite3_log()\nfor\seach\santi-virus\sretry.\s\sMake\sthe\sretry\sdelay\sconfigurable\sat\ncompile-time. -D 2011-07-12T11:04:18.838 +C Improvements\sto\sthe\slogging\sthat\soccurs\son\san\santivirus\sI/O\sretry. +D 2011-07-12T13:51:05.210 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d -F src/os_win.c 4cea89f0a6c98b6a7f4fb3895544af8a07d7807d +F src/os_win.c 07050df9e4956f8a8bb8983788b2523fd6e7db87 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -911,7 +911,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test 7fa3287dccc836fcaa8e0d1e77aa017de5889231 +F test/win32lock.test 58d2505e035a8175c2db524e58e7c5c9bf1a926c F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 03af4c175c6ba303ec0a5be25fd42771e38f7347 -R b94301e8087eadceda58922babc3618f +P 89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 +R 060b096970846ad68ec6f99f0023cc33 U drh -Z 71facc3c10c90f54a5e699820f127261 +Z 9da4b869d45a82433907baf19d8c1435 diff --git a/manifest.uuid b/manifest.uuid index ccdb128bfa..2d27522bef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 \ No newline at end of file +ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index f0cef15359..cf2d572682 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -427,16 +427,25 @@ static int retryIoerr(int *pnRetry){ } e = GetLastError(); if( e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ - int delay = SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry); - sqlite3_log(SQLITE_IOERR, "delay %dms for lock/sharing violation - " - "probably due to antivirus software", delay); - Sleep(delay); + Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry)); ++*pnRetry; return 1; } return 0; } +/* +** Log a I/O error retry episode. +*/ +static void logIoerr(int nRetry){ + if( nRetry ){ + sqlite3_log(SQLITE_IOERR, + "delayed %dms for lock/sharing conflict", + SQLITE_WIN32_IOERR_RETRY_DELAY*nRetry*(nRetry+1)/2 + ); + } +} + #if SQLITE_OS_WINCE /************************************************************************* ** This section contains code for WinCE only. @@ -869,6 +878,7 @@ static int winRead( pFile->lastErrno = GetLastError(); return winLogError(SQLITE_IOERR_READ, "winRead", pFile->zPath); } + logIoerr(nRetry); if( nRead<(DWORD)amt ){ /* Unread parts of the buffer must be zero-filled */ memset(&((char*)pBuf)[nRead], 0, amt-nRead); @@ -890,6 +900,7 @@ static int winWrite( ){ int rc; /* True if error has occured, else false */ winFile *pFile = (winFile*)id; /* File handle */ + int nRetry = 0; /* Number of retries */ assert( amt>0 ); assert( pFile ); @@ -903,7 +914,6 @@ static int winWrite( u8 *aRem = (u8 *)pBuf; /* Data yet to be written */ int nRem = amt; /* Number of bytes yet to be written */ DWORD nWrite; /* Bytes written by each WriteFile() call */ - int nRetry = 0; /* Number of retries */ while( nRem>0 ){ if( !WriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){ @@ -926,6 +936,8 @@ static int winWrite( return SQLITE_FULL; } return winLogError(SQLITE_IOERR_WRITE, "winWrite", pFile->zPath); + }else{ + logIoerr(nRetry); } return SQLITE_OK; } @@ -2386,7 +2398,11 @@ static int winDelete( while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} #endif } - if( rc ) rc = winLogError(SQLITE_IOERR_DELETE, "winDelete", zFilename); + if( rc ){ + rc = winLogError(SQLITE_IOERR_DELETE, "winDelete", zFilename); + }else{ + logIoerr(cnt); + } free(zConverted); OSTRACE(("DELETE \"%s\" %s\n", zFilename, (rc ? "failed" : "ok" ))); return rc; diff --git a/test/win32lock.test b/test/win32lock.test index a45712d173..0fc88eb3f7 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -20,6 +20,14 @@ source $testdir/tester.tcl set testprefix win32lock +db close +sqlite3_shutdown +test_sqlite3_log xLog +proc xLog {error_code msg} { + lappend ::log $msg +} +sqlite3 db test.db + do_test win32lock-1.1 { db eval { PRAGMA cache_size=10; @@ -49,9 +57,18 @@ while {1} { do_test win32lock-1.2-$delay1 { set ::msg } {1 100000 2 50000 3 25000 4 12500} + if {$::log!=""} { + do_test win32lock-1.2-$delay1-log1 { + regsub {\d+} $::log # x + set x + } {{delayed #ms for lock/sharing conflict}} + } incr delay1 50 } + set ::log {} } sqlite3_test_control_pending_byte $old_pending_byte - +sqlite3_shutdown +test_sqlite3_log +sqlite3_initialize finish_test From dc9e9587c6ca4fb22256e7855bc23216b09c3dec Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 12 Jul 2011 14:02:47 +0000 Subject: [PATCH 03/41] Revise logic in winDelete to check the file prior to attempting to delete it. FossilOrigin-Name: 36f11acc531a524407e03c797a6a1bcf88bad809 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 14 +++++++++++--- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 8789521b05..12792f6e0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\sthe\slogging\sthat\soccurs\son\san\santivirus\sI/O\sretry. -D 2011-07-12T13:51:05.210 +C Revise\slogic\sin\swinDelete\sto\scheck\sthe\sfile\sprior\sto\sattempting\sto\sdelete\sit. +D 2011-07-12T14:02:47.638 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d -F src/os_win.c 07050df9e4956f8a8bb8983788b2523fd6e7db87 +F src/os_win.c 57778b70d209f30070dc70e0e9f8e4adba0de5bc F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 -R 060b096970846ad68ec6f99f0023cc33 -U drh -Z 9da4b869d45a82433907baf19d8c1435 +P ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb +R 15ec97d6baeea0684b5deea8be1be88e +U mistachkin +Z 94bbfee187493f0fa246b9c95f6c61dc diff --git a/manifest.uuid b/manifest.uuid index 2d27522bef..1b53d3ad80 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb \ No newline at end of file +36f11acc531a524407e03c797a6a1bcf88bad809 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index cf2d572682..7a1713a610 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -426,7 +426,9 @@ static int retryIoerr(int *pnRetry){ return 0; } e = GetLastError(); - if( e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ + if( e==ERROR_ACCESS_DENIED || + e==ERROR_LOCK_VIOLATION || + e==ERROR_SHARING_VIOLATION ){ Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry)); ++*pnRetry; return 1; @@ -2388,14 +2390,20 @@ static int winDelete( return SQLITE_NOMEM; } if( isNT() ){ - while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} + rc = 1; + while( GetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES && + (rc = DeleteFileW(zConverted))==0 && retryIoerr(&cnt) ){} + rc = rc ? SQLITE_OK : SQLITE_ERROR; /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. ** Since the ASCII version of these Windows API do not exist for WINCE, ** it's important to not reference them for WINCE builds. */ #if SQLITE_OS_WINCE==0 }else{ - while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} + rc = 1; + while( GetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES && + (rc = DeleteFileA(zConverted))==0 && retryIoerr(&cnt) ){} + rc = rc ? SQLITE_OK : SQLITE_ERROR; #endif } if( rc ){ From d0cdf012a2cfb309a57c1d3bf26f7045c7ce853f Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Jul 2011 16:03:46 +0000 Subject: [PATCH 04/41] Added the SQLITE_FCNTL_WIN32_AV_RETRY file control for configuring the retry counts and delays in the windows VFS. FossilOrigin-Name: 7aaf0a6ae1238129e07eb191ca3f043df445e27a --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/os_win.c | 22 +++++++++++++++++++--- src/sqlite.h.in | 19 ++++++++++++++++++- src/test1.c | 39 +++++++++++++++++++++++++++++++++++++-- test/win32lock.test | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 118 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 00a73b3bc9..8568405a64 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\simproved\santi-virus\sdefenses\sinto\sthe\strunk. -D 2011-07-12T14:38:25.733 +C Added\sthe\sSQLITE_FCNTL_WIN32_AV_RETRY\sfile\scontrol\sfor\sconfiguring\sthe\nretry\scounts\sand\sdelays\sin\sthe\swindows\sVFS. +D 2011-07-13T16:03:46.096 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d -F src/os_win.c 57778b70d209f30070dc70e0e9f8e4adba0de5bc +F src/os_win.c c5eadb2c0fc11347296a660f77b9844090265c0c F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -181,14 +181,14 @@ F src/resolve.c 36368f44569208fa074e61f4dd0b6c4fb60ca2b4 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d219c4b68d603cc734b6f9b1e2780fee12a1fa0d F src/shell.c bbe7818ff5bc8614105ceb81ad67b8bdc0b671dd -F src/sqlite.h.in 4b7255c10d39c5faf089dbd29cde7c367ff39f1f +F src/sqlite.h.in badc4f56b9b57a8731475c2ddbccd8198ce33b9b F src/sqlite3ext.h 1a1a4f784aa9c3b00edd287940197de52487cd93 F src/sqliteInt.h ba4a6d6288efb25b84bc0d7d0aaf80f9b42523ba F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c c355b33803fb756dc09297ec84d19604301fa622 -F src/test1.c 6623e003ce840ed4a303918dbbc124f9e222974c +F src/test1.c 693d9a63dfe2c68b167080c99cab82f267f5a38e F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -911,7 +911,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test 58d2505e035a8175c2db524e58e7c5c9bf1a926c +F test/win32lock.test 0a16a7df4a51575bda27529ac992a5a94e4a38bd F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 03af4c175c6ba303ec0a5be25fd42771e38f7347 36f11acc531a524407e03c797a6a1bcf88bad809 -R 15ec97d6baeea0684b5deea8be1be88e +P 0207fd9b0c0f6baa3c2cb8ba588ad585507848b3 +R c10af965bd436aa363363314cb7d7b89 U drh -Z 2176be5b1a19aaddd13f35903c55d94b +Z 2357d1ef0784887fd664a2ba2dbc9797 diff --git a/manifest.uuid b/manifest.uuid index 21872bd981..b78982fe75 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0207fd9b0c0f6baa3c2cb8ba588ad585507848b3 \ No newline at end of file +7aaf0a6ae1238129e07eb191ca3f043df445e27a \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 7a1713a610..2d4f0adad2 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -414,6 +414,8 @@ static int winLogErrorAtLine( #ifndef SQLITE_WIN32_IOERR_RETRY_DELAY # define SQLITE_WIN32_IOERR_RETRY_DELAY 25 #endif +static int win32IoerrRetry = SQLITE_WIN32_IOERR_RETRY; +static int win32IoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY; /* ** If a ReadFile() or WriteFile() error occurs, invoke this routine @@ -422,14 +424,14 @@ static int winLogErrorAtLine( */ static int retryIoerr(int *pnRetry){ DWORD e; - if( *pnRetry>=SQLITE_WIN32_IOERR_RETRY ){ + if( *pnRetry>=win32IoerrRetry ){ return 0; } e = GetLastError(); if( e==ERROR_ACCESS_DENIED || e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ - Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry)); + Sleep(win32IoerrRetryDelay*(1+*pnRetry)); ++*pnRetry; return 1; } @@ -443,7 +445,7 @@ static void logIoerr(int nRetry){ if( nRetry ){ sqlite3_log(SQLITE_IOERR, "delayed %dms for lock/sharing conflict", - SQLITE_WIN32_IOERR_RETRY_DELAY*nRetry*(nRetry+1)/2 + win32IoerrRetryDelay*nRetry*(nRetry+1)/2 ); } } @@ -1356,6 +1358,20 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ case SQLITE_FCNTL_SYNC_OMITTED: { return SQLITE_OK; } + case SQLITE_FCNTL_WIN32_AV_RETRY: { + int *a = (int*)pArg; + if( a[0]>0 ){ + win32IoerrRetry = a[0]; + }else{ + a[0] = win32IoerrRetry; + } + if( a[1]>0 ){ + win32IoerrRetryDelay = a[1]; + }else{ + a[1] = win32IoerrRetryDelay; + } + return SQLITE_OK; + } } return SQLITE_NOTFOUND; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 2e6ca2b74a..b8e8bfbc46 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -736,6 +736,23 @@ struct sqlite3_io_methods { ** Applications should not call [sqlite3_file_control()] with this ** opcode as doing so may disrupt the operation of the specialized VFSes ** that do require it. +** +** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic +** retry counts and intervals for certain disk I/O operations for the +** windows [VFS] in order to work to provide robustness against +** anti-virus programs. By default, the windows VFS will retry file read, +** file write, and file delete opertions up to 10 times, with a delay +** of 25 milliseconds before the first retry and with the delay increasing +** by an additional 25 milliseconds with each subsequent retry. This +** opcode allows those to values (10 retries and 25 milliseconds of delay) +** to be adjusted. The values are changed for all database connections +** within the same process. The argument is a pointer to an array of two +** integers where the first integer i the new retry count and the second +** integer is the delay. If either integer is negative, then the setting +** is not changed but instead the prior value of that setting is written +** into the array entry, allowing the current retry settings to be +** interrogated. The zDbName parameter is ignored. +** */ #define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_GET_LOCKPROXYFILE 2 @@ -745,7 +762,7 @@ struct sqlite3_io_methods { #define SQLITE_FCNTL_CHUNK_SIZE 6 #define SQLITE_FCNTL_FILE_POINTER 7 #define SQLITE_FCNTL_SYNC_OMITTED 8 - +#define SQLITE_FCNTL_WIN32_AV_RETRY 9 /* ** CAPI3REF: Mutex Handle diff --git a/src/test1.c b/src/test1.c index 91bb1b4998..3301ab7403 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5096,6 +5096,39 @@ static int file_control_lockproxy_test( return TCL_OK; } +/* +** tclcmd: file_control_win32_av_retry DB NRETRY DELAY +** +** This TCL command runs the sqlite3_file_control interface with +** the SQLITE_FCNTL_WIN32_AV_RETRY opcode. +*/ +static int file_control_win32_av_retry( + ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3 *db; + int rc; + int a[2]; + char z[100]; + + if( objc!=4 ){ + Tcl_AppendResult(interp, "wrong # args: should be \"", + Tcl_GetStringFromObj(objv[0], 0), " DB NRETRY DELAY", 0); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){ + return TCL_ERROR; + } + if( Tcl_GetIntFromObj(interp, objv[2], &a[0]) ) return TCL_ERROR; + if( Tcl_GetIntFromObj(interp, objv[3], &a[1]) ) return TCL_ERROR; + rc = sqlite3_file_control(db, NULL, SQLITE_FCNTL_WIN32_AV_RETRY, (void*)a); + sqlite3_snprintf(sizeof(z), z, "%d %d %d", rc, a[0], a[1]); + Tcl_AppendResult(interp, z, (char*)0); + return TCL_OK; +} + /* ** tclcmd: sqlite3_vfs_list @@ -5638,7 +5671,7 @@ static int win32_file_lock( Tcl_AppendResult(interp, zBuf, (char*)0); return TCL_OK; } - while( x.h && retry<10 ){ + while( x.h && retry<30 ){ retry++; Sleep(100); } @@ -5662,6 +5695,7 @@ static int win32_file_lock( } #endif + /* ** optimization_control DB OPT BOOLEAN ** @@ -5892,7 +5926,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "file_control_lasterrno_test", file_control_lasterrno_test, 0 }, { "file_control_lockproxy_test", file_control_lockproxy_test, 0 }, { "file_control_chunksize_test", file_control_chunksize_test, 0 }, - { "file_control_sizehint_test", file_control_sizehint_test, 0 }, + { "file_control_sizehint_test", file_control_sizehint_test, 0 }, + { "file_control_win32_av_retry", file_control_win32_av_retry, 0 }, { "sqlite3_vfs_list", vfs_list, 0 }, { "sqlite3_create_function_v2", test_create_function_v2, 0 }, diff --git a/test/win32lock.test b/test/win32lock.test index 0fc88eb3f7..802ea27d16 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -67,6 +67,40 @@ while {1} { } set ::log {} } + +do_test win32lock-2.0 { + file_control_win32_av_retry db -1 -1 +} {0 10 25} +do_test win32lock-2.1 { + file_control_win32_av_retry db 1 1 +} {0 1 1} + +set delay1 50 +while {1} { + sqlite3_sleep 10 + lock_win32_file test.db 0 $::delay1 + set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg] + if {$rc} { + do_test win32lock-2.2-$delay1-fin { + set ::msg + } {disk I/O error} + break + } else { + do_test win32lock-2.2-$delay1 { + set ::msg + } {1 100000 2 50000 3 25000 4 12500} + if {$::log!=""} { + do_test win32lock-2.2-$delay1-log1 { + regsub {\d+} $::log # x + set x + } {{delayed #ms for lock/sharing conflict}} + } + incr delay1 50 + } + set ::log {} +} + +file_control_win32_av_retry db 10 25 sqlite3_test_control_pending_byte $old_pending_byte sqlite3_shutdown test_sqlite3_log From bf4ec555fa99ce2968f8a309dab38e239bab6abc Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 13 Jul 2011 18:31:10 +0000 Subject: [PATCH 05/41] Do not try to use STAT2 to refine the row estimate of a query that uses a unique or nearly-unique index. FossilOrigin-Name: efffc49baf38698ed3de05d16b4261bf405d42d7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 8568405a64..fab7ca4d78 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Added\sthe\sSQLITE_FCNTL_WIN32_AV_RETRY\sfile\scontrol\sfor\sconfiguring\sthe\nretry\scounts\sand\sdelays\sin\sthe\swindows\sVFS. -D 2011-07-13T16:03:46.096 +C Do\snot\stry\sto\suse\sSTAT2\sto\srefine\sthe\srow\sestimate\sof\sa\squery\sthat\nuses\sa\sunique\sor\snearly-unique\sindex. +D 2011-07-13T18:31:10.999 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -250,7 +250,7 @@ F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 0c70ad7b1cac6005fa5e2cbefd23ee05e391c290 F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c ce7cce80c5cb07ba40e9bf38a33ef806c61f55f2 +F src/where.c 106cd9ab3eb410dfa7d0598194c277664bb2e9a3 F test/8_3_names.test b93687beebd17f6ebf812405a6833bae5d1f4199 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 0207fd9b0c0f6baa3c2cb8ba588ad585507848b3 -R c10af965bd436aa363363314cb7d7b89 +P 7aaf0a6ae1238129e07eb191ca3f043df445e27a +R 86cf02b90f1b613c4a5037d43837eb94 U drh -Z 2357d1ef0784887fd664a2ba2dbc9797 +Z 59e834e53ef42b78107149fbc0ea32b5 diff --git a/manifest.uuid b/manifest.uuid index b78982fe75..307dd6ff67 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7aaf0a6ae1238129e07eb191ca3f043df445e27a \ No newline at end of file +efffc49baf38698ed3de05d16b4261bf405d42d7 \ No newline at end of file diff --git a/src/where.c b/src/where.c index bb3bee357c..d312232868 100644 --- a/src/where.c +++ b/src/where.c @@ -3111,12 +3111,13 @@ static void bestBtreeIndex( } #ifdef SQLITE_ENABLE_STAT2 - /* If the constraint is of the form x=VALUE and histogram + /* If the constraint is of the form x=VALUE or x IN (E1,E2,...) + ** and we do not think that values of x are unique and if histogram ** data is available for column x, then it might be possible ** to get a better estimate on the number of rows based on ** VALUE and how common that value is according to the histogram. */ - if( nRow>(double)1 && nEq==1 && pFirstTerm!=0 ){ + if( nRow>(double)1 && nEq==1 && pFirstTerm!=0 && aiRowEst[1]>1 ){ if( pFirstTerm->eOperator & (WO_EQ|WO_ISNULL) ){ testcase( pFirstTerm->eOperator==WO_EQ ); testcase( pFirstTerm->eOperator==WO_ISNULL ); From 33067e7393cd2272e1afb2fea2a8d7f8ae4dea89 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 15 Jul 2011 13:43:34 +0000 Subject: [PATCH 06/41] In os_unix.c, check if the ESTALE macro is defined before using it. FossilOrigin-Name: 87017410f2fc3f2ae15ef06714563ba9ad4350c7 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index fab7ca4d78..461b5baf23 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\stry\sto\suse\sSTAT2\sto\srefine\sthe\srow\sestimate\sof\sa\squery\sthat\nuses\sa\sunique\sor\snearly-unique\sindex. -D 2011-07-13T18:31:10.999 +C In\sos_unix.c,\scheck\sif\sthe\sESTALE\smacro\sis\sdefined\sbefore\susing\sit. +D 2011-07-15T13:43:34.523 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d +F src/os_unix.c dcd6d5782dd30e918dc3d111cdcb1883bfb95345 F src/os_win.c c5eadb2c0fc11347296a660f77b9844090265c0c F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 7aaf0a6ae1238129e07eb191ca3f043df445e27a -R 86cf02b90f1b613c4a5037d43837eb94 -U drh -Z 59e834e53ef42b78107149fbc0ea32b5 +P efffc49baf38698ed3de05d16b4261bf405d42d7 +R a0a001d9a4f1e78d5a5b15dec2791e15 +U dan +Z e14888b321d90cd480e1dbf5240f97b2 diff --git a/manifest.uuid b/manifest.uuid index 307dd6ff67..a687671df4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -efffc49baf38698ed3de05d16b4261bf405d42d7 \ No newline at end of file +87017410f2fc3f2ae15ef06714563ba9ad4350c7 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index f9a12a2fb9..b2956c1647 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -677,7 +677,9 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) { case ENODEV: case ENXIO: case ENOENT: +#ifdef ESTALE /* ESTALE is not defined on Interix systems */ case ESTALE: +#endif case ENOSYS: /* these should force the client to close the file and reconnect */ From c4e384beb86742cc5f3f662809726cb2c1f8ae0f Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 19 Jul 2011 15:27:59 +0000 Subject: [PATCH 07/41] Increase the version number to 3.7.8. FossilOrigin-Name: 4355bf2908b923e844907c1e3c09be3bf469f833 --- VERSION | 2 +- configure | 18 +++++++++--------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index d2577d9756..a0fc9e07cb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.7.7 +3.7.8 diff --git a/configure b/configure index e0985011af..14b71c67b1 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for sqlite 3.7.7. +# Generated by GNU Autoconf 2.62 for sqlite 3.7.8. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.7.7' -PACKAGE_STRING='sqlite 3.7.7' +PACKAGE_VERSION='3.7.8' +PACKAGE_STRING='sqlite 3.7.8' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. @@ -1485,7 +1485,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.7.7 to adapt to many kinds of systems. +\`configure' configures sqlite 3.7.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1550,7 +1550,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.7.7:";; + short | recursive ) echo "Configuration of sqlite 3.7.8:";; esac cat <<\_ACEOF @@ -1666,7 +1666,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.7.7 +sqlite configure 3.7.8 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1680,7 +1680,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.7.7, which was +It was created by sqlite $as_me 3.7.8, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -14030,7 +14030,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.7.7, which was +This file was extended by sqlite $as_me 3.7.8, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14083,7 +14083,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -sqlite config.status 3.7.7 +sqlite config.status 3.7.8 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/manifest b/manifest index 461b5baf23..cb88bfa144 100644 --- a/manifest +++ b/manifest @@ -1,12 +1,12 @@ -C In\sos_unix.c,\scheck\sif\sthe\sESTALE\smacro\sis\sdefined\sbefore\susing\sit. -D 2011-07-15T13:43:34.523 +C Increase\sthe\sversion\snumber\sto\s3.7.8. +D 2011-07-19T15:27:59.774 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc 9c76731c20561a33ce1257c70be3f029cedb62a6 F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 -F VERSION 3fcdd7fbe3eb282df3978fe77288544543767961 +F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531 F art/2005osaward.gif 0d1851b2a7c1c9d0ccce545f3e14bca42d7fd248 @@ -23,7 +23,7 @@ F art/src_logo.gif 9341ef09f0e53cd44c0c9b6fc3c16f7f3d6c2ad9 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 405a958bdb3af382a809dccb08a44694923ddd61 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure f9e97ee7cdc9848e2f3f5ef015fdf861f46fb1bf x +F configure 93e7e695581fa7bef4949161453d9845c5592ad0 x F configure.ac 298a759c086e72c013da459c2aec02a104f4224f F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P efffc49baf38698ed3de05d16b4261bf405d42d7 -R a0a001d9a4f1e78d5a5b15dec2791e15 -U dan -Z e14888b321d90cd480e1dbf5240f97b2 +P 87017410f2fc3f2ae15ef06714563ba9ad4350c7 +R 6dbb7226fc6df92a6d1fc7b30a91d1b6 +U drh +Z 6ea6097405e5ac181fe822d84336e434 diff --git a/manifest.uuid b/manifest.uuid index a687671df4..ee31564b14 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -87017410f2fc3f2ae15ef06714563ba9ad4350c7 \ No newline at end of file +4355bf2908b923e844907c1e3c09be3bf469f833 \ No newline at end of file From 8efdb732569807ea0995a08079cbbfdf3005aa45 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 19 Jul 2011 18:29:00 +0000 Subject: [PATCH 08/41] Formatting changes on the multiplexor code - make sure no lines exceed 80 characters. No logical changes. FossilOrigin-Name: ed5f0aad6b21066bacd01521e82c22e96991f400 --- manifest | 12 +++---- manifest.uuid | 2 +- src/test_multiplex.c | 74 +++++++++++++++++++++++++++++++------------- 3 files changed, 60 insertions(+), 28 deletions(-) diff --git a/manifest b/manifest index cb88bfa144..dc0a0982a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sversion\snumber\sto\s3.7.8. -D 2011-07-19T15:27:59.774 +C Formatting\schanges\son\sthe\smultiplexor\scode\s-\smake\ssure\sno\slines\sexceed\s80\ncharacters.\s\sNo\slogical\schanges. +D 2011-07-19T18:29:00.027 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6 -F src/test_multiplex.c 0585bb12a98521795344f67d17d77e258ea7b57f +F src/test_multiplex.c d1b43de1209bd1bc207b694a738fdb84a162f65b F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 87017410f2fc3f2ae15ef06714563ba9ad4350c7 -R 6dbb7226fc6df92a6d1fc7b30a91d1b6 +P 4355bf2908b923e844907c1e3c09be3bf469f833 +R 33ae39ed3129fdb3c8dbf2c830ddcfd5 U drh -Z 6ea6097405e5ac181fe822d84336e434 +Z 60f009445613def050e13415b0c93faf diff --git a/manifest.uuid b/manifest.uuid index ee31564b14..a91085ca7c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4355bf2908b923e844907c1e3c09be3bf469f833 \ No newline at end of file +ed5f0aad6b21066bacd01521e82c22e96991f400 \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 60ccbcc35f..2203c60b54 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -272,7 +272,8 @@ static int multiplexGetTempname(sqlite3_vfs *pOrigVfs, int nBuf, char *zBuf){ attempts++; sqlite3_randomness(8, &zBuf[j]); for(i=0; i<8; i++){ - zBuf[j+i] = (char)zChars[ ((unsigned char)zBuf[j+i])%(sizeof(zChars)-1) ]; + unsigned char uc = (unsigned char)zBuf[j+i]; + zBuf[j+i] = (char)zChars[uc%(sizeof(zChars)-1)]; } memcpy(&zBuf[j+i], ".tmp", 5); rc = pOrigVfs->xAccess(pOrigVfs, zBuf, SQLITE_ACCESS_EXISTS, &exists); @@ -289,21 +290,31 @@ static int multiplexGetTempname(sqlite3_vfs *pOrigVfs, int nBuf, char *zBuf){ /* Translate an sqlite3_file* that is really a multiplexGroup* into ** the sqlite3_file* for the underlying original VFS. */ -static sqlite3_file *multiplexSubOpen(multiplexConn *pConn, int iChunk, int *rc, int *pOutFlags){ +static sqlite3_file *multiplexSubOpen( + multiplexConn *pConn, + int iChunk, + int *rc, + int *pOutFlags +){ multiplexGroup *pGroup = pConn->pGroup; sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ if( iChunknMaxChunks ){ - sqlite3_file *pSubOpen = pGroup->pReal[iChunk]; /* Real file descriptor */ + sqlite3_file *pSubOpen = pGroup->pReal[iChunk]; /* Real file descriptor */ if( !pGroup->bOpen[iChunk] ){ memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1); if( iChunk ){ #ifdef SQLITE_MULTIPLEX_EXT_OVWR - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, SQLITE_MULTIPLEX_EXT_FMT, iChunk); + sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, + gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, + SQLITE_MULTIPLEX_EXT_FMT, iChunk); #else - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, gMultiplex.zName+pGroup->nName, SQLITE_MULTIPLEX_EXT_FMT, iChunk); + sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, + gMultiplex.zName+pGroup->nName, + SQLITE_MULTIPLEX_EXT_FMT, iChunk); #endif } - *rc = pOrigVfs->xOpen(pOrigVfs, gMultiplex.zName, pSubOpen, pGroup->flags, pOutFlags); + *rc = pOrigVfs->xOpen(pOrigVfs, gMultiplex.zName, pSubOpen, + pGroup->flags, pOutFlags); if( *rc==SQLITE_OK ){ pGroup->bOpen[iChunk] = -1; return pSubOpen; @@ -389,9 +400,9 @@ static int multiplexOpen( int flags, /* Flags to control the opening */ int *pOutFlags /* Flags showing results of opening */ ){ - int rc = SQLITE_OK; /* Result code */ - multiplexConn *pMultiplexOpen; /* The new multiplex file descriptor */ - multiplexGroup *pGroup; /* Corresponding multiplexGroup object */ + int rc = SQLITE_OK; /* Result code */ + multiplexConn *pMultiplexOpen; /* The new multiplex file descriptor */ + multiplexGroup *pGroup; /* Corresponding multiplexGroup object */ sqlite3_file *pSubOpen; /* Real file descriptor */ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ int nName; @@ -419,7 +430,7 @@ static int multiplexOpen( if( rc==SQLITE_OK ){ /* allocate space for group */ nName = multiplexStrlen30(zName); - sz = sizeof(multiplexGroup) /* multiplexGroup */ + sz = sizeof(multiplexGroup) /* multiplexGroup */ + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */ + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */ + SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */ @@ -624,16 +635,22 @@ static int multiplexRead( multiplexEnter(); if( !pGroup->bEnabled ){ sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); - rc = ( !pSubOpen ) ? SQLITE_IOERR_READ : pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst); + if( !pSubOpen ){ + rc = SQLITE_IOERR_READ; + }else{ + rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst); + } }else{ while( iAmt > 0 ){ int i = (int)(iOfst / pGroup->nChunkSize); sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL); if( pSubOpen ){ - int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize; + int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - + pGroup->nChunkSize; if( extra<0 ) extra = 0; iAmt -= extra; - rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst % pGroup->nChunkSize); + rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, + iOfst % pGroup->nChunkSize); if( rc!=SQLITE_OK ) break; pBuf = (char *)pBuf + iAmt; iOfst += iAmt; @@ -664,16 +681,22 @@ static int multiplexWrite( multiplexEnter(); if( !pGroup->bEnabled ){ sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); - rc = ( !pSubOpen ) ? SQLITE_IOERR_WRITE : pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst); + if( pSubOpen==0 ){ + rc = SQLITE_IOERR_WRITE; + }else{ + rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst); + } }else{ while( iAmt > 0 ){ int i = (int)(iOfst / pGroup->nChunkSize); sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL); if( pSubOpen ){ - int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize; + int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - + pGroup->nChunkSize; if( extra<0 ) extra = 0; iAmt -= extra; - rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, iOfst % pGroup->nChunkSize); + rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, + iOfst % pGroup->nChunkSize); if( rc!=SQLITE_OK ) break; pBuf = (char *)pBuf + iAmt; iOfst += iAmt; @@ -699,7 +722,11 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){ multiplexEnter(); if( !pGroup->bEnabled ){ sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); - rc = ( !pSubOpen ) ? SQLITE_IOERR_TRUNCATE : pSubOpen->pMethods->xTruncate(pSubOpen, size); + if( pSubOpen==0 ){ + rc = SQLITE_IOERR_TRUNCATE; + }else{ + rc = pSubOpen->pMethods->xTruncate(pSubOpen, size); + } }else{ int rc2; int i; @@ -727,7 +754,7 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){ rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0); if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE; } - pSubOpen = multiplexSubOpen(p, (int)(size / pGroup->nChunkSize), &rc2, NULL); + pSubOpen = multiplexSubOpen(p, (int)(size/pGroup->nChunkSize), &rc2, NULL); if( pSubOpen ){ rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->nChunkSize); if( rc2!=SQLITE_OK ) rc = rc2; @@ -771,7 +798,11 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ multiplexEnter(); if( !pGroup->bEnabled ){ sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); - rc = ( !pSubOpen ) ? SQLITE_IOERR_FSTAT : pSubOpen->pMethods->xFileSize(pSubOpen, pSize); + if( pSubOpen==0 ){ + rc = SQLITE_IOERR_FSTAT; + }else{ + rc = pSubOpen->pMethods->xFileSize(pSubOpen, pSize); + } }else{ *pSize = 0; for(i=0; inMaxChunks; i++){ @@ -955,7 +986,7 @@ static int multiplexShmMap( int rc; sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); if( pSubOpen ){ - return pSubOpen->pMethods->xShmMap(pSubOpen, iRegion, szRegion, bExtend, pp); + return pSubOpen->pMethods->xShmMap(pSubOpen, iRegion, szRegion, bExtend,pp); } return SQLITE_IOERR; } @@ -1060,7 +1091,8 @@ int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault){ gMultiplex.sIoMethodsV1.xCheckReservedLock = multiplexCheckReservedLock; gMultiplex.sIoMethodsV1.xFileControl = multiplexFileControl; gMultiplex.sIoMethodsV1.xSectorSize = multiplexSectorSize; - gMultiplex.sIoMethodsV1.xDeviceCharacteristics = multiplexDeviceCharacteristics; + gMultiplex.sIoMethodsV1.xDeviceCharacteristics = + multiplexDeviceCharacteristics; gMultiplex.sIoMethodsV2 = gMultiplex.sIoMethodsV1; gMultiplex.sIoMethodsV2.iVersion = 2; gMultiplex.sIoMethodsV2.xShmMap = multiplexShmMap; From f3717af48d856fc95c8ef34646300d7567d17eaf Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 20 Jul 2011 16:35:31 +0000 Subject: [PATCH 09/41] When the multiplexor opens an auxiliary file, it now persists the name of that file until it is closed, as it should. Remove the limit on the number of auxiliary files used by the multiplexor. FossilOrigin-Name: 1ffa542bf913200a18ef77447aec4fc3ca1ed618 --- manifest | 14 +- manifest.uuid | 2 +- src/test_multiplex.c | 351 ++++++++++++++++++------------------------- test/multiplex.test | 81 +++------- 4 files changed, 177 insertions(+), 271 deletions(-) diff --git a/manifest b/manifest index dc0a0982a2..c0583658f0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Formatting\schanges\son\sthe\smultiplexor\scode\s-\smake\ssure\sno\slines\sexceed\s80\ncharacters.\s\sNo\slogical\schanges. -D 2011-07-19T18:29:00.027 +C When\sthe\smultiplexor\sopens\san\sauxiliary\sfile,\sit\snow\spersists\sthe\sname\sof\sthat\nfile\suntil\sit\sis\sclosed,\sas\sit\sshould.\s\sRemove\sthe\slimit\son\sthe\snumber\sof\nauxiliary\sfiles\sused\sby\sthe\smultiplexor. +D 2011-07-20T16:35:31.624 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6 -F src/test_multiplex.c d1b43de1209bd1bc207b694a738fdb84a162f65b +F src/test_multiplex.c 282f315fd035c8d8342a4cc59748c60216b61fef F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec @@ -595,7 +595,7 @@ F test/misc5.test 9f9338f8211c7f5d1cbe16331fa65d019501aa50 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3 F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 -F test/multiplex.test 555080c87abfc72ba68e2f3df01d4a9a7a4fdf58 +F test/multiplex.test 2256e90e8780de6eeafc07d4084427c3a97d3bcb F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test dc212a22b36109fd1ae37154292444ef249c5ec2 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 4355bf2908b923e844907c1e3c09be3bf469f833 -R 33ae39ed3129fdb3c8dbf2c830ddcfd5 +P ed5f0aad6b21066bacd01521e82c22e96991f400 +R e63c3d9c3ff7ac85b18419c4f45127d4 U drh -Z 60f009445613def050e13415b0c93faf +Z 1541751b97b37082064c8e76500e9b76 diff --git a/manifest.uuid b/manifest.uuid index a91085ca7c..04e86b35f3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed5f0aad6b21066bacd01521e82c22e96991f400 \ No newline at end of file +1ffa542bf913200a18ef77447aec4fc3ca1ed618 \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 2203c60b54..b6fe9e8b63 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -126,13 +126,15 @@ typedef struct multiplexConn multiplexConn; ** group. */ struct multiplexGroup { - sqlite3_file **pReal; /* Handles to each chunk */ - char *bOpen; /* array of bools - 0 if chunk not opened */ + struct multiplexReal { /* For each chunk */ + sqlite3_file *p; /* Handle for the chunk */ + char *z; /* Name of this chunk */ + } *aReal; /* list of all chunks */ + int nReal; /* Number of chunks */ char *zName; /* Base filename of this group */ int nName; /* Length of base filename */ int flags; /* Flags used for original opening */ int nChunkSize; /* Chunk size used for this group */ - int nMaxChunks; /* Max number of chunks for this group */ int bEnabled; /* TRUE to use Multiplex VFS for this file */ multiplexGroup *pNext, *pPrev; /* Doubly linked list of all group objects */ }; @@ -191,12 +193,6 @@ static struct { /* List of multiplexGroup objects. */ multiplexGroup *pGroups; - - /* Storage for temp file names. Allocated during - ** initialization to the max pathname of the underlying VFS. - */ - char *zName; - } gMultiplex; /************************* Utility Routines *********************************/ @@ -287,45 +283,69 @@ static int multiplexGetTempname(sqlite3_vfs *pOrigVfs, int nBuf, char *zBuf){ return rc; } +/* Compute the filename for the iChunk-th chunk +*/ +static int multiplexSubFilename(multiplexGroup *pGroup, int iChunk){ + if( iChunk>=pGroup->nReal ){ + struct multiplexReal *p; + p = sqlite3_realloc(pGroup->aReal, (iChunk+1)*sizeof(*p)); + if( p==0 ){ + return SQLITE_NOMEM; + } + memset(&p[pGroup->nReal], 0, sizeof(p[0])*(iChunk+1-pGroup->nReal)); + pGroup->aReal = p; + pGroup->nReal = iChunk+1; + } + if( pGroup->aReal[iChunk].z==0 ){ + char *z; + int n = pGroup->nName; + pGroup->aReal[iChunk].z = z = sqlite3_malloc( n+3 ); + if( z==0 ){ + return SQLITE_NOMEM; + } + memcpy(z, pGroup->zName, n+1); + if( iChunk>0 ){ +#ifdef SQLITE_ENABLE_8_3_NAMES + if( n>3 && z[n-3]=='.' ){ + n--; + }else if( n>4 && z[n-4]=='.' ){ + n -= 2; + } +#endif + sqlite3_snprintf(3,&z[n],"%02d",iChunk); + } + } + return SQLITE_OK; +} + /* Translate an sqlite3_file* that is really a multiplexGroup* into ** the sqlite3_file* for the underlying original VFS. */ static sqlite3_file *multiplexSubOpen( - multiplexConn *pConn, + multiplexGroup *pGroup, int iChunk, int *rc, int *pOutFlags ){ - multiplexGroup *pGroup = pConn->pGroup; + sqlite3_file *pSubOpen = 0; sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ - if( iChunknMaxChunks ){ - sqlite3_file *pSubOpen = pGroup->pReal[iChunk]; /* Real file descriptor */ - if( !pGroup->bOpen[iChunk] ){ - memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1); - if( iChunk ){ -#ifdef SQLITE_MULTIPLEX_EXT_OVWR - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, - SQLITE_MULTIPLEX_EXT_FMT, iChunk); -#else - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName, - SQLITE_MULTIPLEX_EXT_FMT, iChunk); -#endif - } - *rc = pOrigVfs->xOpen(pOrigVfs, gMultiplex.zName, pSubOpen, - pGroup->flags, pOutFlags); - if( *rc==SQLITE_OK ){ - pGroup->bOpen[iChunk] = -1; - return pSubOpen; - } - return NULL; + *rc = multiplexSubFilename(pGroup, iChunk); + if( (*rc)==SQLITE_OK && (pSubOpen = pGroup->aReal[iChunk].p)==0 ){ + pSubOpen = sqlite3_malloc( pOrigVfs->szOsFile ); + if( pSubOpen==0 ){ + *rc = SQLITE_NOMEM; + return 0; + } + pGroup->aReal[iChunk].p = pSubOpen; + *rc = pOrigVfs->xOpen(pOrigVfs, pGroup->aReal[iChunk].z, pSubOpen, + pGroup->flags, pOutFlags); + if( *rc!=SQLITE_OK ){ + sqlite3_free(pSubOpen); + pGroup->aReal[iChunk].p = 0; + return 0; } - *rc = SQLITE_OK; - return pSubOpen; } - *rc = SQLITE_FULL; - return NULL; + return pSubOpen; } /* @@ -384,6 +404,36 @@ static int multiplexFuncInit( return rc; } +/* +** Close a single sub-file in the connection group. +*/ +static void multiplexSubClose( + multiplexGroup *pGroup, + int iChunk, + sqlite3_vfs *pOrigVfs +){ + sqlite3_file *pSubOpen = pGroup->aReal[iChunk].p; + if( pSubOpen ){ + if( pOrigVfs ) pOrigVfs->xDelete(pOrigVfs, pGroup->aReal[iChunk].z, 0); + pSubOpen->pMethods->xClose(pSubOpen); + sqlite3_free(pGroup->aReal[iChunk].p); + } + sqlite3_free(pGroup->aReal[iChunk].z); + memset(&pGroup->aReal[iChunk], 0, sizeof(pGroup->aReal[iChunk])); +} + +/* +** Deallocate memory held by a multiplexGroup +*/ +static void multiplexFreeComponents(multiplexGroup *pGroup){ + int i; + for(i=0; inReal; i++){ multiplexSubClose(pGroup, i, 0); } + sqlite3_free(pGroup->aReal); + pGroup->aReal = 0; + pGroup->nReal = 0; +} + + /************************* VFS Method Wrappers *****************************/ /* @@ -406,10 +456,11 @@ static int multiplexOpen( sqlite3_file *pSubOpen; /* Real file descriptor */ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ int nName; - int i; int sz; + char *zToFree = 0; UNUSED_PARAMETER(pVfs); + memset(pConn, 0, pVfs->szOsFile); /* We need to create a group structure and manage ** access to this group of files. @@ -423,28 +474,22 @@ static int multiplexOpen( ** it. */ if( !zName ){ - rc = multiplexGetTempname(pOrigVfs, pOrigVfs->mxPathname, gMultiplex.zName); - zName = gMultiplex.zName; + zName = zToFree = sqlite3_malloc( pOrigVfs->mxPathname + 10 ); + if( zName==0 ){ + rc = SQLITE_NOMEM; + }else{ + rc = multiplexGetTempname(pOrigVfs, pOrigVfs->mxPathname, zToFree); + } } if( rc==SQLITE_OK ){ /* allocate space for group */ nName = multiplexStrlen30(zName); sz = sizeof(multiplexGroup) /* multiplexGroup */ - + (sizeof(sqlite3_file *)*SQLITE_MULTIPLEX_MAX_CHUNKS) /* pReal[] */ - + (pOrigVfs->szOsFile*SQLITE_MULTIPLEX_MAX_CHUNKS) /* *pReal */ - + SQLITE_MULTIPLEX_MAX_CHUNKS /* bOpen[] */ - + nName + 1; /* zName */ -#ifndef SQLITE_MULTIPLEX_EXT_OVWR - sz += SQLITE_MULTIPLEX_EXT_SZ; - assert(nName+SQLITE_MULTIPLEX_EXT_SZ < pOrigVfs->mxPathname); -#else - assert(nName >= SQLITE_MULTIPLEX_EXT_SZ); - assert(nName < pOrigVfs->mxPathname); -#endif + + nName + 1; /* zName */ pGroup = sqlite3_malloc( sz ); if( pGroup==0 ){ - rc=SQLITE_NOMEM; + rc = SQLITE_NOMEM; } } @@ -456,27 +501,19 @@ static int multiplexOpen( memset(pGroup, 0, sz); pGroup->bEnabled = -1; pGroup->nChunkSize = SQLITE_MULTIPLEX_CHUNK_SIZE; - zChunkSize = sqlite3_uri_parameter(zName, "chunksize"); - if( zChunkSize ){ - int n = atoi(zChunkSize); - if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff; + if( flags & SQLITE_OPEN_URI ){ + zChunkSize = sqlite3_uri_parameter(zName, "chunksize"); + if( zChunkSize ){ + int n = atoi(zChunkSize); + if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff; + } } - pGroup->nMaxChunks = SQLITE_MULTIPLEX_MAX_CHUNKS; - pGroup->pReal = (sqlite3_file **)p; - p += (sizeof(sqlite3_file *)*pGroup->nMaxChunks); - for(i=0; inMaxChunks; i++){ - pGroup->pReal[i] = (sqlite3_file *)p; - p += pOrigVfs->szOsFile; - } - /* bOpen[] vals should all be zero from memset above */ - pGroup->bOpen = p; - p += pGroup->nMaxChunks; pGroup->zName = p; /* save off base filename, name length, and original open flags */ memcpy(pGroup->zName, zName, nName+1); pGroup->nName = nName; pGroup->flags = flags; - pSubOpen = multiplexSubOpen(pMultiplexOpen, 0, &rc, pOutFlags); + pSubOpen = multiplexSubOpen(pGroup, 0, &rc, pOutFlags); if( pSubOpen ){ /* if this file is already larger than chunk size, disable ** the multiplex feature. @@ -496,17 +533,18 @@ static int multiplexOpen( if( gMultiplex.pGroups ) gMultiplex.pGroups->pPrev = pGroup; gMultiplex.pGroups = pGroup; }else{ + multiplexFreeComponents(pGroup); sqlite3_free(pGroup); } } multiplexLeave(); + sqlite3_free(zToFree); return rc; } /* ** This is the xDelete method used for the "multiplex" VFS. -** It attempts to delete the filename specified, as well -** as additional files with the SQLITE_MULTIPLEX_EXT_FMT extension. +** It attempts to delete the filename specified. */ static int multiplexDelete( sqlite3_vfs *pVfs, /* The multiplex VFS */ @@ -514,41 +552,7 @@ static int multiplexDelete( int syncDir ){ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ - int rc = SQLITE_OK; - int nName = multiplexStrlen30(zName); - int i; - - UNUSED_PARAMETER(pVfs); - - multiplexEnter(); - memcpy(gMultiplex.zName, zName, nName+1); - for(i=0; ixAccess(pOrigVfs, gMultiplex.zName, - SQLITE_ACCESS_EXISTS, &exists); - if( rc2==SQLITE_OK && exists ){ - /* if it exists, delete it */ - rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, syncDir); - if( rc2!=SQLITE_OK ) rc = rc2; - }else{ - /* stop at first "gap" */ - break; - } - } - multiplexLeave(); - return rc; + return pOrigVfs->xDelete(pOrigVfs, zName, syncDir); } static int multiplexAccess(sqlite3_vfs *a, const char *b, int c, int *d){ @@ -596,17 +600,8 @@ static int multiplexClose(sqlite3_file *pConn){ multiplexConn *p = (multiplexConn*)pConn; multiplexGroup *pGroup = p->pGroup; int rc = SQLITE_OK; - int i; multiplexEnter(); - /* close any open handles */ - for(i=0; inMaxChunks; i++){ - if( pGroup->bOpen[i] ){ - sqlite3_file *pSubOpen = pGroup->pReal[i]; - int rc2 = pSubOpen->pMethods->xClose(pSubOpen); - if( rc2!=SQLITE_OK ) rc = rc2; - pGroup->bOpen[i] = 0; - } - } + multiplexFreeComponents(pGroup); /* remove from linked list */ if( pGroup->pNext ) pGroup->pNext->pPrev = pGroup->pPrev; if( pGroup->pPrev ){ @@ -634,8 +629,8 @@ static int multiplexRead( int rc = SQLITE_OK; multiplexEnter(); if( !pGroup->bEnabled ){ - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); - if( !pSubOpen ){ + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL); + if( pSubOpen==0 ){ rc = SQLITE_IOERR_READ; }else{ rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, iOfst); @@ -643,7 +638,7 @@ static int multiplexRead( }else{ while( iAmt > 0 ){ int i = (int)(iOfst / pGroup->nChunkSize); - sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL); if( pSubOpen ){ int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize; @@ -680,7 +675,7 @@ static int multiplexWrite( int rc = SQLITE_OK; multiplexEnter(); if( !pGroup->bEnabled ){ - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL); if( pSubOpen==0 ){ rc = SQLITE_IOERR_WRITE; }else{ @@ -689,7 +684,7 @@ static int multiplexWrite( }else{ while( iAmt > 0 ){ int i = (int)(iOfst / pGroup->nChunkSize); - sqlite3_file *pSubOpen = multiplexSubOpen(p, i, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL); if( pSubOpen ){ int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - pGroup->nChunkSize; @@ -721,7 +716,7 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){ int rc = SQLITE_OK; multiplexEnter(); if( !pGroup->bEnabled ){ - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL); if( pSubOpen==0 ){ rc = SQLITE_IOERR_TRUNCATE; }else{ @@ -732,29 +727,11 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){ int i; sqlite3_file *pSubOpen; sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ - memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1); /* delete the chunks above the truncate limit */ - for(i=(int)(size / pGroup->nChunkSize)+1; inMaxChunks; i++){ - /* close any open chunks before deleting them */ - if( pGroup->bOpen[i] ){ - pSubOpen = pGroup->pReal[i]; - rc2 = pSubOpen->pMethods->xClose(pSubOpen); - if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE; - pGroup->bOpen[i] = 0; - } -#ifdef SQLITE_MULTIPLEX_EXT_OVWR - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, - SQLITE_MULTIPLEX_EXT_FMT, i); -#else - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName, - SQLITE_MULTIPLEX_EXT_FMT, i); -#endif - rc2 = pOrigVfs->xDelete(pOrigVfs, gMultiplex.zName, 0); - if( rc2!=SQLITE_OK ) rc = SQLITE_IOERR_TRUNCATE; + for(i=(int)(size / pGroup->nChunkSize)+1; inReal; i++){ + multiplexSubClose(pGroup, i, pOrigVfs); } - pSubOpen = multiplexSubOpen(p, (int)(size/pGroup->nChunkSize), &rc2, NULL); + pSubOpen = multiplexSubOpen(pGroup, (int)(size/pGroup->nChunkSize), &rc2,0); if( pSubOpen ){ rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->nChunkSize); if( rc2!=SQLITE_OK ) rc = rc2; @@ -774,10 +751,9 @@ static int multiplexSync(sqlite3_file *pConn, int flags){ int rc = SQLITE_OK; int i; multiplexEnter(); - for(i=0; inMaxChunks; i++){ - /* if we don't have it open, we don't need to sync it */ - if( pGroup->bOpen[i] ){ - sqlite3_file *pSubOpen = pGroup->pReal[i]; + for(i=0; inReal; i++){ + sqlite3_file *pSubOpen = pGroup->aReal[i].p; + if( pSubOpen ){ int rc2 = pSubOpen->pMethods->xSync(pSubOpen, flags); if( rc2!=SQLITE_OK ) rc = rc2; } @@ -797,7 +773,7 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ int i; multiplexEnter(); if( !pGroup->bEnabled ){ - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL); if( pSubOpen==0 ){ rc = SQLITE_IOERR_FSTAT; }else{ @@ -805,35 +781,20 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ } }else{ *pSize = 0; - for(i=0; inMaxChunks; i++){ - sqlite3_file *pSubOpen = NULL; - /* if not opened already, check to see if the chunk exists */ - if( pGroup->bOpen[i] ){ - pSubOpen = pGroup->pReal[i]; + for(i=0; 1; i++){ + sqlite3_file *pSubOpen = 0; + sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; + int exists = 0; + rc = multiplexSubFilename(pGroup, i); + if( rc ) break; + rc2 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[i].z, + SQLITE_ACCESS_EXISTS, &exists); + if( rc2==SQLITE_OK && exists){ + /* if it exists, open it */ + pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL); }else{ - sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ - int exists = 0; - memcpy(gMultiplex.zName, pGroup->zName, pGroup->nName+1); - if( i ){ -#ifdef SQLITE_MULTIPLEX_EXT_OVWR - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName-SQLITE_MULTIPLEX_EXT_SZ, - SQLITE_MULTIPLEX_EXT_FMT, i); -#else - sqlite3_snprintf(SQLITE_MULTIPLEX_EXT_SZ+1, - gMultiplex.zName+pGroup->nName, - SQLITE_MULTIPLEX_EXT_FMT, i); -#endif - } - rc2 = pOrigVfs->xAccess(pOrigVfs, gMultiplex.zName, - SQLITE_ACCESS_EXISTS, &exists); - if( rc2==SQLITE_OK && exists){ - /* if it exists, open it */ - pSubOpen = multiplexSubOpen(p, i, &rc, NULL); - }else{ - /* stop at first "gap" */ - break; - } + /* stop at first "gap" */ + break; } if( pSubOpen ){ sqlite3_int64 sz; @@ -860,7 +821,7 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ static int multiplexLock(sqlite3_file *pConn, int lock){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xLock(pSubOpen, lock); } @@ -872,7 +833,7 @@ static int multiplexLock(sqlite3_file *pConn, int lock){ static int multiplexUnlock(sqlite3_file *pConn, int lock){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xUnlock(pSubOpen, lock); } @@ -884,7 +845,7 @@ static int multiplexUnlock(sqlite3_file *pConn, int lock){ static int multiplexCheckReservedLock(sqlite3_file *pConn, int *pResOut){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xCheckReservedLock(pSubOpen, pResOut); } @@ -924,15 +885,7 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){ } break; case MULTIPLEX_CTRL_SET_MAX_CHUNKS: - if( pArg ) { - int nMaxChunks = *(int *)pArg; - if(( nMaxChunks<1 ) || ( nMaxChunks>SQLITE_MULTIPLEX_MAX_CHUNKS )){ - rc = SQLITE_MISUSE; - }else{ - pGroup->nMaxChunks = nMaxChunks; - rc = SQLITE_OK; - } - } + rc = SQLITE_OK; break; case SQLITE_FCNTL_SIZE_HINT: case SQLITE_FCNTL_CHUNK_SIZE: @@ -940,7 +893,7 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){ rc = SQLITE_OK; break; default: - pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL); if( pSubOpen ){ rc = pSubOpen->pMethods->xFileControl(pSubOpen, op, pArg); } @@ -954,7 +907,7 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){ static int multiplexSectorSize(sqlite3_file *pConn){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xSectorSize(pSubOpen); } @@ -966,7 +919,7 @@ static int multiplexSectorSize(sqlite3_file *pConn){ static int multiplexDeviceCharacteristics(sqlite3_file *pConn){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xDeviceCharacteristics(pSubOpen); } @@ -984,7 +937,7 @@ static int multiplexShmMap( ){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xShmMap(pSubOpen, iRegion, szRegion, bExtend,pp); } @@ -1001,7 +954,7 @@ static int multiplexShmLock( ){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xShmLock(pSubOpen, ofst, n, flags); } @@ -1013,7 +966,7 @@ static int multiplexShmLock( static void multiplexShmBarrier(sqlite3_file *pConn){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ pSubOpen->pMethods->xShmBarrier(pSubOpen); } @@ -1024,7 +977,7 @@ static void multiplexShmBarrier(sqlite3_file *pConn){ static int multiplexShmUnmap(sqlite3_file *pConn, int deleteFlag){ multiplexConn *p = (multiplexConn*)pConn; int rc; - sqlite3_file *pSubOpen = multiplexSubOpen(p, 0, &rc, NULL); + sqlite3_file *pSubOpen = multiplexSubOpen(p->pGroup, 0, &rc, NULL); if( pSubOpen ){ return pSubOpen->pMethods->xShmUnmap(pSubOpen, deleteFlag); } @@ -1054,11 +1007,6 @@ int sqlite3_multiplex_initialize(const char *zOrigVfsName, int makeDefault){ if( !gMultiplex.pMutex ){ return SQLITE_NOMEM; } - gMultiplex.zName = sqlite3_malloc(pOrigVfs->mxPathname); - if( !gMultiplex.zName ){ - sqlite3_mutex_free(gMultiplex.pMutex); - return SQLITE_NOMEM; - } gMultiplex.pGroups = NULL; gMultiplex.isInitialized = 1; gMultiplex.pOrigVfs = pOrigVfs; @@ -1119,7 +1067,6 @@ int sqlite3_multiplex_shutdown(void){ if( gMultiplex.isInitialized==0 ) return SQLITE_MISUSE; if( gMultiplex.pGroups ) return SQLITE_MISUSE; gMultiplex.isInitialized = 0; - sqlite3_free(gMultiplex.zName); sqlite3_mutex_free(gMultiplex.pMutex); sqlite3_vfs_unregister(&gMultiplex.sThisVfs); memset(&gMultiplex, 0, sizeof(gMultiplex)); @@ -1221,8 +1168,8 @@ static int test_multiplex_dump( Tcl_NewIntObj(pGroup->flags)); /* count number of chunks with open handles */ - for(i=0; inMaxChunks; i++){ - if( pGroup->bOpen[i] ) nChunks++; + for(i=0; inReal; i++){ + if( pGroup->aReal[i].p!=0 ) nChunks++; } Tcl_ListObjAppendElement(interp, pGroupTerm, Tcl_NewIntObj(nChunks)); @@ -1230,7 +1177,7 @@ static int test_multiplex_dump( Tcl_ListObjAppendElement(interp, pGroupTerm, Tcl_NewIntObj(pGroup->nChunkSize)); Tcl_ListObjAppendElement(interp, pGroupTerm, - Tcl_NewIntObj(pGroup->nMaxChunks)); + Tcl_NewIntObj(pGroup->nReal)); Tcl_ListObjAppendElement(interp, pResult, pGroupTerm); } diff --git a/test/multiplex.test b/test/multiplex.test index 9278e84274..93d4aafc16 100644 --- a/test/multiplex.test +++ b/test/multiplex.test @@ -49,6 +49,7 @@ proc multiplex_set {db name chunk_size max_chunks} { # and files with the chunk extension. proc multiplex_delete {name} { global g_max_chunks + forcedelete $name for {set i 0} {$i<$g_max_chunks} {incr i} { forcedelete [multiplex_name $name $i] forcedelete [multiplex_name $name-journal $i] @@ -78,10 +79,10 @@ do_test multiplex-1.8 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.9.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.9.2 { sqlite3 db test.db } {} do_test multiplex-1.9.3 { multiplex_set db main 32768 16 } {SQLITE_OK} -do_test multiplex-1.9.4 { multiplex_set db main 32768 -1 } {SQLITE_MISUSE} +do_test multiplex-1.9.4 { multiplex_set db main 32768 -1 } {SQLITE_OK} do_test multiplex-1.9.5 { multiplex_set db main -1 16 } {SQLITE_MISUSE} do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK} -do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_MISUSE} +do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_OK} do_test multiplex-1.9.8 { multiplex_set db main 1073741824 1 } {SQLITE_OK} do_test multiplex-1.9.9 { db close } {} do_test multiplex-1.9.10 { sqlite3_multiplex_shutdown } {SQLITE_OK} @@ -89,10 +90,10 @@ do_test multiplex-1.9.10 { sqlite3_multiplex_shutdown } {SQLITE_OK} do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.10.2 { sqlite3 db test.db } {} do_test multiplex-1.10.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0} -do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {1} +do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {0} do_test multiplex-1.10.5 { lindex [ catchsql { SELECT multiplex_control(2, -1); } ] 0 } {1} do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0} -do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {1} +do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {0} do_test multiplex-1.10.8 { lindex [ catchsql { SELECT multiplex_control(2, 1073741824); } ] 0 } {0} do_test multiplex-1.10.9 { db close } {} do_test multiplex-1.10.10 { sqlite3_multiplex_shutdown } {SQLITE_OK} @@ -146,8 +147,9 @@ do_test multiplex-1.13.7 { sqlite3_multiplex_shutdown } sqlite3_multiplex_initialize "" 1 multiplex_set db main 32768 16 +file delete -force test.x do_test multiplex-2.1.2 { - sqlite3 db test.db + sqlite3 db test.x execsql { PRAGMA page_size=1024; PRAGMA auto_vacuum=OFF; @@ -159,7 +161,7 @@ do_test multiplex-2.1.2 { INSERT INTO t1 VALUES(2, randomblob(1100)); } } {} -do_test multiplex-2.1.3 { file size [multiplex_name test.db 0] } {4096} +do_test multiplex-2.1.3 { file size [multiplex_name test.x 0] } {4096} do_test multiplex-2.1.4 { execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) } } {} @@ -167,10 +169,10 @@ do_test multiplex-2.1.4 { do_test multiplex-2.2.1 { execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) } } {} -do_test multiplex-2.2.3 { file size [multiplex_name test.db 0] } {6144} +do_test multiplex-2.2.3 { file size [multiplex_name test.x 0] } {6144} do_test multiplex-2.3.1 { - sqlite3 db2 test2.db + sqlite3 db2 test2.x db2 close } {} @@ -181,7 +183,7 @@ do_test multiplex-2.4.1 { do_test multiplex-2.4.2 { execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) } } {} -do_test multiplex-2.4.4 { file size [multiplex_name test.db 0] } {7168} +do_test multiplex-2.4.4 { file size [multiplex_name test.x 0] } {7168} do_test multiplex-2.4.99 { db close sqlite3_multiplex_shutdown @@ -189,9 +191,9 @@ do_test multiplex-2.4.99 { do_test multiplex-2.5.1 { - multiplex_delete test.db + multiplex_delete test.x sqlite3_multiplex_initialize "" 1 - sqlite3 db test.db + sqlite3 db test.x multiplex_set db main 4096 16 } {SQLITE_OK} @@ -236,8 +238,8 @@ do_test multiplex-2.5.8 { db eval {SELECT a,length(b) FROM t1 WHERE a=4} } {4 4000} -do_test multiplex-2.5.9 { file size [multiplex_name test.db 0] } [list $g_chunk_size] -do_test multiplex-2.5.10 { file size [multiplex_name test.db 1] } [list $g_chunk_size] +do_test multiplex-2.5.9 { file size [multiplex_name test.x 0] } [list $g_chunk_size] +do_test multiplex-2.5.10 { file size [multiplex_name test.x 1] } [list $g_chunk_size] do_test multiplex-2.5.99 { db close @@ -523,50 +525,6 @@ do_faultsim_test multiplex-5.5 -prep { multiplex_set db main 32768 16 } -# test that mismatch filesize is detected -# -# Do not run this test if $::G(perm:presql) is set. If it is set, then the -# expected IO error will occur within the Tcl [sqlite3] wrapper, not within -# the first SQL statement executed below. This breaks the test case. -# -if {0==[info exists ::G(perm:presql)] || $::G(perm:presql) == ""} { - set all_journal_modes {delete persist truncate memory off} - foreach jmode $all_journal_modes { - do_test multiplex-5.6.1.$jmode { - sqlite3_multiplex_shutdown - multiplex_delete test.db - sqlite3 db test.db - db eval { - PRAGMA page_size = 1024; - PRAGMA auto_vacuum = off; - } - db eval "PRAGMA journal_mode = $jmode;" - } $jmode - do_test multiplex-5.6.2.$jmode { - execsql { - CREATE TABLE t1(a, b); - INSERT INTO t1 VALUES(1, randomblob(15000)); - INSERT INTO t1 VALUES(2, randomblob(15000)); - INSERT INTO t1 VALUES(3, randomblob(15000)); - INSERT INTO t1 VALUES(4, randomblob(15000)); - INSERT INTO t1 VALUES(5, randomblob(15000)); - } - db close - sqlite3_multiplex_initialize "" 1 - sqlite3 db test.db - multiplex_set db main 4096 16 - } {SQLITE_OK} - do_test multiplex-5.6.3.$jmode { - catchsql { - INSERT INTO t1 VALUES(6, randomblob(15000)); - } - } {1 {disk I/O error}} - do_test multiplex-5.6.4.$jmode { - db close - } {} - } -} - #------------------------------------------------------------------------- # Test that you can vacuum a multiplex'ed DB. @@ -575,8 +533,9 @@ ifcapable vacuum { sqlite3_multiplex_shutdown do_test multiplex-6.0.0 { multiplex_delete test.db + multiplex_delete test.x sqlite3_multiplex_initialize "" 1 - sqlite3 db test.db + sqlite3 db test.x multiplex_set db main 4096 16 } {SQLITE_OK} @@ -592,8 +551,8 @@ do_test multiplex-6.1.0 { INSERT INTO t1 VALUES(2, randomblob($g_chunk_size)); } } {} -do_test multiplex-6.2.1 { file size [multiplex_name test.db 0] } [list $g_chunk_size] -do_test multiplex-6.2.2 { file size [multiplex_name test.db 1] } [list $g_chunk_size] +do_test multiplex-6.2.1 { file size [multiplex_name test.x 0] } [list $g_chunk_size] +do_test multiplex-6.2.2 { file size [multiplex_name test.x 1] } [list $g_chunk_size] do_test multiplex-6.3.0 { execsql { VACUUM } @@ -601,7 +560,7 @@ do_test multiplex-6.3.0 { do_test multiplex-6.99 { db close - multiplex_delete test.db + multiplex_delete test.x sqlite3_multiplex_shutdown } {SQLITE_OK} From 877eeb3b56f8f2829fab39d61fb3afb1ba07029c Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 20 Jul 2011 17:13:30 +0000 Subject: [PATCH 10/41] All the SQLITE_OPEN_URI flag to propagate down into the VFS. FossilOrigin-Name: 29866f9598502a007816410fade34f1d0952dea0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c0583658f0..692bd49cf1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\sthe\smultiplexor\sopens\san\sauxiliary\sfile,\sit\snow\spersists\sthe\sname\sof\sthat\nfile\suntil\sit\sis\sclosed,\sas\sit\sshould.\s\sRemove\sthe\slimit\son\sthe\snumber\sof\nauxiliary\sfiles\sused\sby\sthe\smultiplexor. -D 2011-07-20T16:35:31.624 +C All\sthe\sSQLITE_OPEN_URI\sflag\sto\spropagate\sdown\sinto\sthe\sVFS. +D 2011-07-20T17:13:30.035 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F src/mutex_os2.c 882d735098c07c8c6a5472b8dd66e19675fe117f F src/mutex_unix.c b4f4e923bb8de93ec3f251fadb50855f23df9579 F src/mutex_w32.c 5e54f3ba275bcb5d00248b8c23107df2e2f73e33 F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 -F src/os.c 22ac61d06e72a0dac900400147333b07b13d8e1d +F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P ed5f0aad6b21066bacd01521e82c22e96991f400 -R e63c3d9c3ff7ac85b18419c4f45127d4 +P 1ffa542bf913200a18ef77447aec4fc3ca1ed618 +R a8712e3b34abd0caa57ff420866bce41 U drh -Z 1541751b97b37082064c8e76500e9b76 +Z aa653174b90521d7bcecad6884ea5241 diff --git a/manifest.uuid b/manifest.uuid index 04e86b35f3..2d93c3ac97 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1ffa542bf913200a18ef77447aec4fc3ca1ed618 \ No newline at end of file +29866f9598502a007816410fade34f1d0952dea0 \ No newline at end of file diff --git a/src/os.c b/src/os.c index ba0438adef..41ec69ce45 100644 --- a/src/os.c +++ b/src/os.c @@ -136,7 +136,7 @@ int sqlite3OsOpen( ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example, ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before ** reaching the VFS. */ - rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f3f, pFlagsOut); + rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut); assert( rc==SQLITE_OK || pFile->pMethods==0 ); return rc; } From 0a0ca697d86e0a4fda38334933e263f904b62ae6 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 20 Jul 2011 17:59:38 +0000 Subject: [PATCH 11/41] For an existing multiplexed database, try to set the chunk size automatically based on the sizes of the preexisting pieces. FossilOrigin-Name: 427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_multiplex.c | 37 ++++++++++++++++++++++++++++--------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index 692bd49cf1..b768ecaf18 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C All\sthe\sSQLITE_OPEN_URI\sflag\sto\spropagate\sdown\sinto\sthe\sVFS. -D 2011-07-20T17:13:30.035 +C For\san\sexisting\smultiplexed\sdatabase,\stry\sto\sset\sthe\schunk\ssize\sautomatically\nbased\son\sthe\ssizes\sof\sthe\spreexisting\spieces. +D 2011-07-20T17:59:38.568 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6 -F src/test_multiplex.c 282f315fd035c8d8342a4cc59748c60216b61fef +F src/test_multiplex.c 7f5b2ec63ff514f12e95ffbe134fca87eaac7e96 F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 1ffa542bf913200a18ef77447aec4fc3ca1ed618 -R a8712e3b34abd0caa57ff420866bce41 +P 29866f9598502a007816410fade34f1d0952dea0 +R f7447480ebd05c67794755dbb19b5608 U drh -Z aa653174b90521d7bcecad6884ea5241 +Z ce5790e6bda5ced4f7371ad338df0dcd diff --git a/manifest.uuid b/manifest.uuid index 2d93c3ac97..372fbaa188 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -29866f9598502a007816410fade34f1d0952dea0 \ No newline at end of file +427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index b6fe9e8b63..c5725e07a2 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -453,7 +453,7 @@ static int multiplexOpen( int rc = SQLITE_OK; /* Result code */ multiplexConn *pMultiplexOpen; /* The new multiplex file descriptor */ multiplexGroup *pGroup; /* Corresponding multiplexGroup object */ - sqlite3_file *pSubOpen; /* Real file descriptor */ + sqlite3_file *pSubOpen = 0; /* Real file descriptor */ sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ int nName; int sz; @@ -513,16 +513,35 @@ static int multiplexOpen( memcpy(pGroup->zName, zName, nName+1); pGroup->nName = nName; pGroup->flags = flags; - pSubOpen = multiplexSubOpen(pGroup, 0, &rc, pOutFlags); + rc = multiplexSubFilename(pGroup, 1); + if( rc==SQLITE_OK ){ + pSubOpen = multiplexSubOpen(pGroup, 0, &rc, pOutFlags); + } if( pSubOpen ){ - /* if this file is already larger than chunk size, disable - ** the multiplex feature. - */ + int exists, rc2, rc3; sqlite3_int64 sz; - int rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz); - if( (rc2==SQLITE_OK) && (sz>pGroup->nChunkSize) ){ - pGroup->bEnabled = 0; + + rc2 = pSubOpen->pMethods->xFileSize(pSubOpen, &sz); + if( rc2==SQLITE_OK ){ + /* If the first overflow file exists and if the size of the main file + ** is different from the chunk size, that means the chunk size is set + ** set incorrectly. So fix it. + ** + ** Or, if the first overflow file does not exist and the main file is + ** larger than the chunk size, that means the chunk size is too small. + ** But we have no way of determining the intended chunk size, so + ** just disable the multiplexor all togethre. + */ + rc3 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z, + SQLITE_ACCESS_EXISTS, &exists); + if( rc3==SQLITE_OK && exists && sz==(sz&0xffff0000) && sz>0 + && sz!=pGroup->nChunkSize ){ + pGroup->nChunkSize = sz; + }else if( rc3==SQLITE_OK && !exists && sz>pGroup->nChunkSize ){ + pGroup->bEnabled = 0; + } } + if( pSubOpen->pMethods->iVersion==1 ){ pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV1; }else{ @@ -780,10 +799,10 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ rc = pSubOpen->pMethods->xFileSize(pSubOpen, pSize); } }else{ + sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; *pSize = 0; for(i=0; 1; i++){ sqlite3_file *pSubOpen = 0; - sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; int exists = 0; rc = multiplexSubFilename(pGroup, i); if( rc ) break; From e6deb204589077c46427b1f25f0a248980419b29 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 21 Jul 2011 20:59:58 +0000 Subject: [PATCH 12/41] All multiplexor chunk sizes up to 4GiB. Disable the multiplexor if the chunk size is set to 0. FossilOrigin-Name: 83191ad6f31536b0c1929938e1fbeb4cf6121ab0 --- manifest | 14 +++++------ manifest.uuid | 2 +- src/test_multiplex.c | 60 +++++++++++++++++++++++++------------------- test/multiplex.test | 2 -- 4 files changed, 42 insertions(+), 36 deletions(-) diff --git a/manifest b/manifest index b768ecaf18..5bca43402e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C For\san\sexisting\smultiplexed\sdatabase,\stry\sto\sset\sthe\schunk\ssize\sautomatically\nbased\son\sthe\ssizes\sof\sthe\spreexisting\spieces. -D 2011-07-20T17:59:38.568 +C All\smultiplexor\schunk\ssizes\sup\sto\s4GiB.\s\sDisable\sthe\smultiplexor\sif\sthe\nchunk\ssize\sis\sset\sto\s0. +D 2011-07-21T20:59:58.248 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6 -F src/test_multiplex.c 7f5b2ec63ff514f12e95ffbe134fca87eaac7e96 +F src/test_multiplex.c 991a60733dbde8c529043d466c5c44d180762561 F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec @@ -595,7 +595,7 @@ F test/misc5.test 9f9338f8211c7f5d1cbe16331fa65d019501aa50 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3 F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 -F test/multiplex.test 2256e90e8780de6eeafc07d4084427c3a97d3bcb +F test/multiplex.test b45367b1dac7dfa4c5b8ff0f3844260804a0034d F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test dc212a22b36109fd1ae37154292444ef249c5ec2 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 29866f9598502a007816410fade34f1d0952dea0 -R f7447480ebd05c67794755dbb19b5608 +P 427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b +R 046ebc91a200dc382cece52b5754a0c1 U drh -Z ce5790e6bda5ced4f7371ad338df0dcd +Z 032caca1acf96a44c6601a79dc41d32f diff --git a/manifest.uuid b/manifest.uuid index 372fbaa188..3b6b943327 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b \ No newline at end of file +83191ad6f31536b0c1929938e1fbeb4cf6121ab0 \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index c5725e07a2..732df82cd7 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -134,7 +134,7 @@ struct multiplexGroup { char *zName; /* Base filename of this group */ int nName; /* Length of base filename */ int flags; /* Flags used for original opening */ - int nChunkSize; /* Chunk size used for this group */ + unsigned int szChunk; /* Chunk size used for this group */ int bEnabled; /* TRUE to use Multiplex VFS for this file */ multiplexGroup *pNext, *pPrev; /* Doubly linked list of all group objects */ }; @@ -494,18 +494,27 @@ static int multiplexOpen( } if( rc==SQLITE_OK ){ - const char *zChunkSize; /* assign pointers to extra space allocated */ char *p = (char *)&pGroup[1]; pMultiplexOpen->pGroup = pGroup; memset(pGroup, 0, sz); pGroup->bEnabled = -1; - pGroup->nChunkSize = SQLITE_MULTIPLEX_CHUNK_SIZE; + pGroup->szChunk = SQLITE_MULTIPLEX_CHUNK_SIZE; if( flags & SQLITE_OPEN_URI ){ + const char *zChunkSize; zChunkSize = sqlite3_uri_parameter(zName, "chunksize"); if( zChunkSize ){ - int n = atoi(zChunkSize); - if( n>0 ) pGroup->nChunkSize = (n+0xffff)&~0xffff; + unsigned int n = 0; + int i; + for(i=0; zChunkSize[i]>='0' && zChunkSize[i]<='9'; i++){ + n = n*10 + zChunkSize[i] - '0'; + } + if( n>0 ){ + pGroup->szChunk = (n+0xffff)&~0xffff; + }else{ + /* A zero or negative chunksize disabled the multiplexor */ + pGroup->bEnabled = 0; + } } } pGroup->zName = p; @@ -535,9 +544,9 @@ static int multiplexOpen( rc3 = pOrigVfs->xAccess(pOrigVfs, pGroup->aReal[1].z, SQLITE_ACCESS_EXISTS, &exists); if( rc3==SQLITE_OK && exists && sz==(sz&0xffff0000) && sz>0 - && sz!=pGroup->nChunkSize ){ - pGroup->nChunkSize = sz; - }else if( rc3==SQLITE_OK && !exists && sz>pGroup->nChunkSize ){ + && sz!=pGroup->szChunk ){ + pGroup->szChunk = sz; + }else if( rc3==SQLITE_OK && !exists && sz>pGroup->szChunk ){ pGroup->bEnabled = 0; } } @@ -656,15 +665,14 @@ static int multiplexRead( } }else{ while( iAmt > 0 ){ - int i = (int)(iOfst / pGroup->nChunkSize); + int i = (int)(iOfst / pGroup->szChunk); sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL); if( pSubOpen ){ - int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - - pGroup->nChunkSize; + int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) - pGroup->szChunk; if( extra<0 ) extra = 0; iAmt -= extra; rc = pSubOpen->pMethods->xRead(pSubOpen, pBuf, iAmt, - iOfst % pGroup->nChunkSize); + iOfst % pGroup->szChunk); if( rc!=SQLITE_OK ) break; pBuf = (char *)pBuf + iAmt; iOfst += iAmt; @@ -702,15 +710,15 @@ static int multiplexWrite( } }else{ while( iAmt > 0 ){ - int i = (int)(iOfst / pGroup->nChunkSize); + int i = (int)(iOfst / pGroup->szChunk); sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL); if( pSubOpen ){ - int extra = ((int)(iOfst % pGroup->nChunkSize) + iAmt) - - pGroup->nChunkSize; + int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) - + pGroup->szChunk; if( extra<0 ) extra = 0; iAmt -= extra; rc = pSubOpen->pMethods->xWrite(pSubOpen, pBuf, iAmt, - iOfst % pGroup->nChunkSize); + iOfst % pGroup->szChunk); if( rc!=SQLITE_OK ) break; pBuf = (char *)pBuf + iAmt; iOfst += iAmt; @@ -747,12 +755,12 @@ static int multiplexTruncate(sqlite3_file *pConn, sqlite3_int64 size){ sqlite3_file *pSubOpen; sqlite3_vfs *pOrigVfs = gMultiplex.pOrigVfs; /* Real VFS */ /* delete the chunks above the truncate limit */ - for(i=(int)(size / pGroup->nChunkSize)+1; inReal; i++){ + for(i=(int)(size / pGroup->szChunk)+1; inReal; i++){ multiplexSubClose(pGroup, i, pOrigVfs); } - pSubOpen = multiplexSubOpen(pGroup, (int)(size/pGroup->nChunkSize), &rc2,0); + pSubOpen = multiplexSubOpen(pGroup, (int)(size/pGroup->szChunk), &rc2,0); if( pSubOpen ){ - rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->nChunkSize); + rc2 = pSubOpen->pMethods->xTruncate(pSubOpen, size % pGroup->szChunk); if( rc2!=SQLITE_OK ) rc = rc2; }else{ rc = SQLITE_IOERR_TRUNCATE; @@ -821,7 +829,7 @@ static int multiplexFileSize(sqlite3_file *pConn, sqlite3_int64 *pSize){ if( rc2!=SQLITE_OK ){ rc = rc2; }else{ - if( sz>pGroup->nChunkSize ){ + if( sz>pGroup->szChunk ){ rc = SQLITE_IOERR_FSTAT; } *pSize += sz; @@ -891,14 +899,14 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){ break; case MULTIPLEX_CTRL_SET_CHUNK_SIZE: if( pArg ) { - int nChunkSize = *(int *)pArg; - if( nChunkSize<1 ){ + unsigned int szChunk = *(unsigned*)pArg; + if( szChunk<1 ){ rc = SQLITE_MISUSE; }else{ /* Round up to nearest multiple of MAX_PAGE_SIZE. */ - nChunkSize = (nChunkSize + (MAX_PAGE_SIZE-1)); - nChunkSize &= ~(MAX_PAGE_SIZE-1); - pGroup->nChunkSize = nChunkSize; + szChunk = (szChunk + (MAX_PAGE_SIZE-1)); + szChunk &= ~(MAX_PAGE_SIZE-1); + pGroup->szChunk = szChunk; rc = SQLITE_OK; } } @@ -1194,7 +1202,7 @@ static int test_multiplex_dump( Tcl_NewIntObj(nChunks)); Tcl_ListObjAppendElement(interp, pGroupTerm, - Tcl_NewIntObj(pGroup->nChunkSize)); + Tcl_NewIntObj(pGroup->szChunk)); Tcl_ListObjAppendElement(interp, pGroupTerm, Tcl_NewIntObj(pGroup->nReal)); diff --git a/test/multiplex.test b/test/multiplex.test index 93d4aafc16..28ce1c77e7 100644 --- a/test/multiplex.test +++ b/test/multiplex.test @@ -80,7 +80,6 @@ do_test multiplex-1.9.1 { sqlite3_multiplex_initialize "" 1 } {SQLITE_OK} do_test multiplex-1.9.2 { sqlite3 db test.db } {} do_test multiplex-1.9.3 { multiplex_set db main 32768 16 } {SQLITE_OK} do_test multiplex-1.9.4 { multiplex_set db main 32768 -1 } {SQLITE_OK} -do_test multiplex-1.9.5 { multiplex_set db main -1 16 } {SQLITE_MISUSE} do_test multiplex-1.9.6 { multiplex_set db main 31 16 } {SQLITE_OK} do_test multiplex-1.9.7 { multiplex_set db main 32768 100 } {SQLITE_OK} do_test multiplex-1.9.8 { multiplex_set db main 1073741824 1 } {SQLITE_OK} @@ -91,7 +90,6 @@ do_test multiplex-1.10.1 { sqlite3_multiplex_initialize "" 1 } do_test multiplex-1.10.2 { sqlite3 db test.db } {} do_test multiplex-1.10.3 { lindex [ catchsql { SELECT multiplex_control(2, 32768); } ] 0 } {0} do_test multiplex-1.10.4 { lindex [ catchsql { SELECT multiplex_control(3, -1); } ] 0 } {0} -do_test multiplex-1.10.5 { lindex [ catchsql { SELECT multiplex_control(2, -1); } ] 0 } {1} do_test multiplex-1.10.6 { lindex [ catchsql { SELECT multiplex_control(2, 31); } ] 0 } {0} do_test multiplex-1.10.7 { lindex [ catchsql { SELECT multiplex_control(3, 100); } ] 0 } {0} do_test multiplex-1.10.8 { lindex [ catchsql { SELECT multiplex_control(2, 1073741824); } ] 0 } {0} From b51bf43966fdc82055195c03f7739564c5bd12df Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 21 Jul 2011 21:29:35 +0000 Subject: [PATCH 13/41] Compile with the SQLITE_ENABLE_8_3_NAME macro set to 2 to force 8+3 filenames to be on all the time. FossilOrigin-Name: ae83dac70173fecf203bf7e9f7bcb189d3e48f08 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/util.c | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 5bca43402e..7053b7dba5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C All\smultiplexor\schunk\ssizes\sup\sto\s4GiB.\s\sDisable\sthe\smultiplexor\sif\sthe\nchunk\ssize\sis\sset\sto\s0. -D 2011-07-21T20:59:58.248 +C Compile\swith\sthe\sSQLITE_ENABLE_8_3_NAME\smacro\sset\sto\s2\sto\sforce\s8+3\sfilenames\nto\sbe\son\sall\sthe\stime. +D 2011-07-21T21:29:35.633 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -236,7 +236,7 @@ F src/tokenize.c c819d9f72168a035d545a5bdafe9b085b20df705 F src/trigger.c 1cfb80e2290ef66ea89cb4e821caae65a02c0d56 F src/update.c 74a6cfb34e9732c1e2a86278b229913b4b51eeec F src/utf.c c53eb7404b3eb5c1cbb5655c6a7a0e0ce6bd50f0 -F src/util.c 0f33bbbdfcc4a2d8cf20c3b2a16ffc3b57c58a70 +F src/util.c 06302ffd2b80408d4f6c7af71f7090e0cf8d8ff7 F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e F src/vdbe.c a9ced64f380bbd8b04da3a1c3a9602d3942704b5 F src/vdbe.h 5cf09e7ee8a3f7d93bc51f196a96550786afe7a1 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 427a9a5120a68bfa12fec97cfd02eb9b28b3fa6b -R 046ebc91a200dc382cece52b5754a0c1 +P 83191ad6f31536b0c1929938e1fbeb4cf6121ab0 +R f36be610ec3236a1941508a82c6dca72 U drh -Z 032caca1acf96a44c6601a79dc41d32f +Z be7120c77d6b184261113de7aebad3e1 diff --git a/manifest.uuid b/manifest.uuid index 3b6b943327..35b1e172d6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -83191ad6f31536b0c1929938e1fbeb4cf6121ab0 \ No newline at end of file +ae83dac70173fecf203bf7e9f7bcb189d3e48f08 \ No newline at end of file diff --git a/src/util.c b/src/util.c index de73577203..67e43b4ba8 100644 --- a/src/util.c +++ b/src/util.c @@ -1149,12 +1149,15 @@ int sqlite3AbsInt32(int x){ #ifdef SQLITE_ENABLE_8_3_NAMES /* -** If SQLITE_ENABLE_8_3_NAME is set at compile-time and if the database +** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database ** filename in zBaseFilename is a URI with the "8_3_names=1" parameter and ** if filename in z[] has a suffix (a.k.a. "extension") that is longer than ** three characters, then shorten the suffix on z[] to be the last three ** characters of the original suffix. ** +** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always +** do the suffix shortening regardless of URI parameter. +** ** Examples: ** ** test.db-journal => test.nal @@ -1162,9 +1165,12 @@ int sqlite3AbsInt32(int x){ ** test.db-shm => test.shm */ void sqlite3FileSuffix3(const char *zBaseFilename, char *z){ +#if SQLITE_ENABLE_8_3_NAMES<2 const char *zOk; zOk = sqlite3_uri_parameter(zBaseFilename, "8_3_names"); - if( zOk && sqlite3GetBoolean(zOk) ){ + if( zOk && sqlite3GetBoolean(zOk) ) +#endif + { int i, sz; sz = sqlite3Strlen30(z); for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){} From 16b92eef35f6cbac591171ddad58d43f3350ebec Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 22 Jul 2011 10:33:04 +0000 Subject: [PATCH 14/41] Use $(TCLSH_CMD) instead of tclsh in the autoconf makefile. FossilOrigin-Name: fd36d8067b5a29d9acbf8c96b9d837406d0c0cce --- Makefile.in | 2 +- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4a81e15664..2b3311ac99 100644 --- a/Makefile.in +++ b/Makefile.in @@ -785,7 +785,7 @@ parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h sqlite3.h: $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION - tclsh $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h + $(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h keywordhash.h: $(TOP)/tool/mkkeywordhash.c $(BCC) -o mkkeywordhash$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)/tool/mkkeywordhash.c diff --git a/manifest b/manifest index 7053b7dba5..3ca5f67419 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Compile\swith\sthe\sSQLITE_ENABLE_8_3_NAME\smacro\sset\sto\s2\sto\sforce\s8+3\sfilenames\nto\sbe\son\sall\sthe\stime. -D 2011-07-21T21:29:35.633 +C Use\s$(TCLSH_CMD)\sinstead\sof\stclsh\sin\sthe\sautoconf\smakefile. +D 2011-07-22T10:33:04.219 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e +F Makefile.in b85ed0fdfb95fb6822bc1c8c6bd5873fc53a84c2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc 9c76731c20561a33ce1257c70be3f029cedb62a6 F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 83191ad6f31536b0c1929938e1fbeb4cf6121ab0 -R f36be610ec3236a1941508a82c6dca72 +P ae83dac70173fecf203bf7e9f7bcb189d3e48f08 +R b476c21b2eaeefe9f084a953d275e8e3 U drh -Z be7120c77d6b184261113de7aebad3e1 +Z ff014274f8b77ee9173b86c8fcceebd1 diff --git a/manifest.uuid b/manifest.uuid index 35b1e172d6..f7999cc05f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ae83dac70173fecf203bf7e9f7bcb189d3e48f08 \ No newline at end of file +fd36d8067b5a29d9acbf8c96b9d837406d0c0cce \ No newline at end of file From fe3499654962bf51410db26812d412bda7560dcb Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 22 Jul 2011 10:53:05 +0000 Subject: [PATCH 15/41] Adjust the maximum number of open database connections in wal3.test down for OpenBSD. FossilOrigin-Name: b38e52f67574997de9f4b4318f2eb68ff0133f35 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/wal3.test | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 3ca5f67419..8d739ad206 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\s$(TCLSH_CMD)\sinstead\sof\stclsh\sin\sthe\sautoconf\smakefile. -D 2011-07-22T10:33:04.219 +C Adjust\sthe\smaximum\snumber\sof\sopen\sdatabase\sconnections\sin\swal3.test\sdown\nfor\sOpenBSD. +D 2011-07-22T10:53:05.152 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b85ed0fdfb95fb6822bc1c8c6bd5873fc53a84c2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -879,7 +879,7 @@ F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d F test/wal.test 5617ad308bfdb8a8885220d8a261a6096a8d7e57 F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782 -F test/wal3.test 5c396cc22497244d627306f4c1d360167353f8dd +F test/wal3.test d512a5c8b4aa345722d11e8f1671db7eb15a0e39 F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 F test/wal5.test f06a0427e06db00347e32eb9fa99d6a5c0f2d088 F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P ae83dac70173fecf203bf7e9f7bcb189d3e48f08 -R b476c21b2eaeefe9f084a953d275e8e3 +P fd36d8067b5a29d9acbf8c96b9d837406d0c0cce +R d12689e1e57ff777372910ecacb2cd46 U drh -Z ff014274f8b77ee9173b86c8fcceebd1 +Z af1cbe1963416f046ac52ddc2f1578ee diff --git a/manifest.uuid b/manifest.uuid index f7999cc05f..eb651d0c9b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fd36d8067b5a29d9acbf8c96b9d837406d0c0cce \ No newline at end of file +b38e52f67574997de9f4b4318f2eb68ff0133f35 \ No newline at end of file diff --git a/test/wal3.test b/test/wal3.test index bd296154e0..f7b55eb9bc 100644 --- a/test/wal3.test +++ b/test/wal3.test @@ -707,7 +707,7 @@ T delete # and continues. # set nConn 50 -if { [string match *BSD $tcl_platform(os)] } { set nConn 35 } +if { [string match *BSD $tcl_platform(os)] } { set nConn 25 } do_test wal3-9.0 { file delete -force test.db test.db-journal test.db wal sqlite3 db test.db @@ -784,4 +784,3 @@ do_multiclient_test tn { } finish_test - From 07516dd5dfca8367bcdf5fed3fa293ff0afc3fa6 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 22 Jul 2011 11:16:39 +0000 Subject: [PATCH 16/41] Add makefile targets sqlite3-all.c. FossilOrigin-Name: 71f7be586f5a18493cd516f89c4ecc460bb24462 --- Makefile.in | 3 +++ main.mk | 3 +++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2b3311ac99..a9fc93af7e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -517,6 +517,9 @@ sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl + $(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl + # Rule to build the amalgamation # sqlite3.lo: sqlite3.c diff --git a/main.mk b/main.mk index 16bb7115c9..1ab502af6e 100644 --- a/main.mk +++ b/main.mk @@ -383,6 +383,9 @@ sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl echo '#endif /* USE_SYSTEM_SQLITE */' >>tclsqlite3.c cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl + tclsh $(TOP)/tool/split-sqlite3c.tcl + fts2amal.c: target_source $(TOP)/ext/fts2/mkfts2amal.tcl tclsh $(TOP)/ext/fts2/mkfts2amal.tcl diff --git a/manifest b/manifest index 8d739ad206..791d74f8eb 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C Adjust\sthe\smaximum\snumber\sof\sopen\sdatabase\sconnections\sin\swal3.test\sdown\nfor\sOpenBSD. -D 2011-07-22T10:53:05.152 +C Add\smakefile\stargets\ssqlite3-all.c. +D 2011-07-22T11:16:39.376 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in b85ed0fdfb95fb6822bc1c8c6bd5873fc53a84c2 +F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc 9c76731c20561a33ce1257c70be3f029cedb62a6 F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151 @@ -104,7 +104,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 -F main.mk d81d86f0f70444f3abc241eccf5ace4a79ff9b69 +F main.mk 50adb7368bd0faa888eb4634b874d542d44f3de3 F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P fd36d8067b5a29d9acbf8c96b9d837406d0c0cce -R d12689e1e57ff777372910ecacb2cd46 +P b38e52f67574997de9f4b4318f2eb68ff0133f35 +R ada945a14522405a76d61d09ae93a2d9 U drh -Z af1cbe1963416f046ac52ddc2f1578ee +Z 925c4df3e98ac05a9968b9d94b638861 diff --git a/manifest.uuid b/manifest.uuid index eb651d0c9b..b207b87304 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b38e52f67574997de9f4b4318f2eb68ff0133f35 \ No newline at end of file +71f7be586f5a18493cd516f89c4ecc460bb24462 \ No newline at end of file From 75e7bc1db7027404e65841b2da934324a3dc5dbd Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 22 Jul 2011 11:23:49 +0000 Subject: [PATCH 17/41] Also add the sqlite3-all.c target to the MSVC makefile. FossilOrigin-Name: 8ce2b74a82264550b0e19da3e0e1a145db940a1c --- Makefile.msc | 3 +++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 718464d6ec..799970d5f9 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -486,6 +486,9 @@ sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib sqlite3.h sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl +sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl + $(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl + # Rule to build the amalgamation # sqlite3.lo: sqlite3.c diff --git a/manifest b/manifest index 791d74f8eb..42fc3e12f1 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\smakefile\stargets\ssqlite3-all.c. -D 2011-07-22T11:16:39.376 +C Also\sadd\sthe\ssqlite3-all.c\starget\sto\sthe\sMSVC\smakefile. +D 2011-07-22T11:23:49.199 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 9c76731c20561a33ce1257c70be3f029cedb62a6 +F Makefile.msc 8e04f517922b9e31a5bf975f07bb66df79ae7076 F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P b38e52f67574997de9f4b4318f2eb68ff0133f35 -R ada945a14522405a76d61d09ae93a2d9 +P 71f7be586f5a18493cd516f89c4ecc460bb24462 +R 645e7d58a7503109e1bb3e986974849f U drh -Z 925c4df3e98ac05a9968b9d94b638861 +Z aaeed83d2a39a45645a69e9a638df017 diff --git a/manifest.uuid b/manifest.uuid index b207b87304..e12fc96311 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -71f7be586f5a18493cd516f89c4ecc460bb24462 \ No newline at end of file +8ce2b74a82264550b0e19da3e0e1a145db940a1c \ No newline at end of file From fdf6db12a458aa5e93a64829833870371c662a2d Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 22 Jul 2011 21:25:57 +0000 Subject: [PATCH 18/41] Add retry logic for AV defense to winAccess(). Also allow OS tracing to be enabled by a compile-time option. FossilOrigin-Name: a6b85c73406caa3bf0585341c8ebc9897a1884f4 --- manifest | 18 +++++++++++------- manifest.uuid | 2 +- src/os_common.h | 9 ++++++--- src/os_win.c | 6 ++++-- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 42fc3e12f1..b359bc1a22 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Also\sadd\sthe\ssqlite3-all.c\starget\sto\sthe\sMSVC\smakefile. -D 2011-07-22T11:23:49.199 +C Add\sretry\slogic\sfor\sAV\sdefense\sto\swinAccess().\s\sAlso\sallow\sOS\stracing\sto\sbe\nenabled\sby\sa\scompile-time\soption. +D 2011-07-22T21:25:57.525 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -163,10 +163,10 @@ F src/mutex_w32.c 5e54f3ba275bcb5d00248b8c23107df2e2f73e33 F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 -F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f +F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c dcd6d5782dd30e918dc3d111cdcb1883bfb95345 -F src/os_win.c c5eadb2c0fc11347296a660f77b9844090265c0c +F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -952,7 +952,11 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 71f7be586f5a18493cd516f89c4ecc460bb24462 -R 645e7d58a7503109e1bb3e986974849f +P 8ce2b74a82264550b0e19da3e0e1a145db940a1c +R 0af84a25fe935b16dac1aa3e854e0baf +T *bgcolor * #d0c0ff +T *branch * av-defense +T *sym-av-defense * +T -sym-trunk * U drh -Z aaeed83d2a39a45645a69e9a638df017 +Z 9d105249d1658c472aed05118a4a48f3 diff --git a/manifest.uuid b/manifest.uuid index e12fc96311..2b894192c2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8ce2b74a82264550b0e19da3e0e1a145db940a1c \ No newline at end of file +a6b85c73406caa3bf0585341c8ebc9897a1884f4 \ No newline at end of file diff --git a/src/os_common.h b/src/os_common.h index eba856be8a..aa3e18a8c5 100644 --- a/src/os_common.h +++ b/src/os_common.h @@ -30,10 +30,13 @@ #endif #ifdef SQLITE_DEBUG -int sqlite3OSTrace = 0; -#define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X +# ifndef SQLITE_DEBUG_OS_TRACE +# define SQLITE_DEBUG_OS_TRACE 0 +# endif + int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE; +# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X #else -#define OSTRACE(X) +# define OSTRACE(X) #endif /* diff --git a/src/os_win.c b/src/os_win.c index 2d4f0adad2..5d9bf59843 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2452,11 +2452,13 @@ static int winAccess( return SQLITE_NOMEM; } if( isNT() ){ + int cnt = 0; WIN32_FILE_ATTRIBUTE_DATA sAttrData; memset(&sAttrData, 0, sizeof(sAttrData)); - if( GetFileAttributesExW((WCHAR*)zConverted, + while( (rc = GetFileAttributesExW((WCHAR*)zConverted, GetFileExInfoStandard, - &sAttrData) ){ + &sAttrData)) && rc==0 && retryIoerr(&cnt) ){} + if( rc ){ /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file ** as if it does not exist. */ From 11cce770424f1d76220f20a654e8c21a84757e25 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 23 Jul 2011 13:11:02 +0000 Subject: [PATCH 19/41] In the multiplexor, close auxiliary files before deleting them when doing a truncate. FossilOrigin-Name: 6fb7cfc2efb32dd5c8921a90b853390bc44d4794 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_multiplex.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 42fc3e12f1..c590aa5eff 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Also\sadd\sthe\ssqlite3-all.c\starget\sto\sthe\sMSVC\smakefile. -D 2011-07-22T11:23:49.199 +C In\sthe\smultiplexor,\sclose\sauxiliary\sfiles\sbefore\sdeleting\sthem\swhen\sdoing\na\struncate. +D 2011-07-23T13:11:02.100 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -213,7 +213,7 @@ F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 F src/test_journal.c 03313c693cca72959dcaaf79f8d76f21c01e19ff F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e F src/test_malloc.c 7ca7be34e0e09ef0ed6619544552ed95732e41f6 -F src/test_multiplex.c 991a60733dbde8c529043d466c5c44d180762561 +F src/test_multiplex.c 731fb740a9fd4b11cb7b1990c62fc88d01c90dfd F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 71f7be586f5a18493cd516f89c4ecc460bb24462 -R 645e7d58a7503109e1bb3e986974849f +P 8ce2b74a82264550b0e19da3e0e1a145db940a1c +R 5ff3917e6e15573461029ec08177c1a8 U drh -Z aaeed83d2a39a45645a69e9a638df017 +Z 73fb0245292065880727bc255b6bd8fa diff --git a/manifest.uuid b/manifest.uuid index e12fc96311..06036314cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8ce2b74a82264550b0e19da3e0e1a145db940a1c \ No newline at end of file +6fb7cfc2efb32dd5c8921a90b853390bc44d4794 \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 732df82cd7..d316847945 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -414,8 +414,8 @@ static void multiplexSubClose( ){ sqlite3_file *pSubOpen = pGroup->aReal[iChunk].p; if( pSubOpen ){ - if( pOrigVfs ) pOrigVfs->xDelete(pOrigVfs, pGroup->aReal[iChunk].z, 0); pSubOpen->pMethods->xClose(pSubOpen); + if( pOrigVfs ) pOrigVfs->xDelete(pOrigVfs, pGroup->aReal[iChunk].z, 0); sqlite3_free(pGroup->aReal[iChunk].p); } sqlite3_free(pGroup->aReal[iChunk].z); From 7d2dc7156ce267ca844793c20cd0c510a698de4b Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 25 Jul 2011 23:25:47 +0000 Subject: [PATCH 20/41] Enable the SQLITE_FCNTL_SIZE_HINT on unix even if SQLITE_FCNTL_CHUNK_SIZE has not been set. FossilOrigin-Name: 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 10 ++++++++-- test/wal5.test | 10 +--------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/manifest b/manifest index 758a9c3780..e1657062a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\swinAccess\sretry\slogic\sfrom\sthe\santi-antivirus\sbranch\ninto\sthe\strunk. -D 2011-07-23T13:54:34.013 +C Enable\sthe\sSQLITE_FCNTL_SIZE_HINT\son\sunix\seven\sif\sSQLITE_FCNTL_CHUNK_SIZE\nhas\snot\sbeen\sset. +D 2011-07-25T23:25:47.867 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c dcd6d5782dd30e918dc3d111cdcb1883bfb95345 +F src/os_unix.c b83e0924d1a832a89989d3d2770179205d0e066a F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -881,7 +881,7 @@ F test/wal.test 5617ad308bfdb8a8885220d8a261a6096a8d7e57 F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782 F test/wal3.test d512a5c8b4aa345722d11e8f1671db7eb15a0e39 F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 -F test/wal5.test f06a0427e06db00347e32eb9fa99d6a5c0f2d088 +F test/wal5.test 08e145a352b1223930c7f0a1de82a8747a99c322 F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 6fb7cfc2efb32dd5c8921a90b853390bc44d4794 a6b85c73406caa3bf0585341c8ebc9897a1884f4 -R 1255c11fb87a761a1f8eac495b8a38b4 +P 08d0e8799e1441ef063b1cdf9e4107071a0f81ca +R 513a198a27aca1f07c596d222f883111 U drh -Z 2eecc3b1645ef2e7bef18a04829340dc +Z bf5f24c7092583c5f65553c09e369462 diff --git a/manifest.uuid b/manifest.uuid index 96e327d41a..3e9f01365c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -08d0e8799e1441ef063b1cdf9e4107071a0f81ca \ No newline at end of file +05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index b2956c1647..dce13e5365 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3395,13 +3395,19 @@ static int proxyFileControl(sqlite3_file*,int,void*); ** SQLITE_FCNTL_SIZE_HINT operation is a no-op for Unix. */ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ - if( pFile->szChunk ){ + { /* preserve indentation of removed "if" */ i64 nSize; /* Required file size */ + i64 szChunk; /* Chunk size */ struct stat buf; /* Used to hold return values of fstat() */ if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT; - nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; + szChunk = pFile->szChunk; + if( szChunk==0 ){ + nSize = nByte; + }else{ + nSize = ((nByte+szChunk-1) / szChunk) * szChunk; + } if( nSize>(i64)buf.st_size ){ #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE diff --git a/test/wal5.test b/test/wal5.test index 0c700dfc50..af4056ccd2 100644 --- a/test/wal5.test +++ b/test/wal5.test @@ -235,14 +235,7 @@ foreach {testprefix do_wal_checkpoint} { do_test 2.3.$tn.5 { sql1 { INSERT INTO t2 VALUES(3, 4) } } {} do_test 2.3.$tn.6 { file_page_counts } {1 7 1 7} do_test 2.3.$tn.7 { code1 { do_wal_checkpoint db -mode full } } {1 7 5} - if {$tcl_platform(platform) == "windows"} { - # on unix, the size_hint is a no-op if no chunk size is set. - # the windows implementation does not have a similar check, - # and because of this, the db file size has an extra page. - do_test 2.3.$tn.8 { file_page_counts } {2 7 2 7} - } { - do_test 2.3.$tn.8 { file_page_counts } {1 7 2 7} - } + do_test 2.3.$tn.8 { file_page_counts } {2 7 2 7} } # Check that checkpoints block on the correct locks. And respond correctly @@ -350,4 +343,3 @@ foreach {testprefix do_wal_checkpoint} { finish_test - From f0b190d94c1d80b7c20d1a4d52aef9187142c864 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 26 Jul 2011 16:03:07 +0000 Subject: [PATCH 21/41] Prototype change for a new sqlite3_file_control() that will cause the -wal and -shm files to persist after the last database connection closes. FossilOrigin-Name: e34c553bf04761e86f3bd72f91439c05886caa5c --- manifest | 21 ++++++++++++--------- manifest.uuid | 2 +- src/os_unix.c | 25 +++++++++++++++++++------ src/os_win.c | 19 +++++++++++++++---- src/sqlite.h.in | 15 +++++++++++++++ src/wal.c | 4 +++- 6 files changed, 65 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index e1657062a6..38df8835a6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enable\sthe\sSQLITE_FCNTL_SIZE_HINT\son\sunix\seven\sif\sSQLITE_FCNTL_CHUNK_SIZE\nhas\snot\sbeen\sset. -D 2011-07-25T23:25:47.867 +C Prototype\schange\sfor\sa\snew\ssqlite3_file_control()\sthat\swill\scause\sthe\n-wal\sand\s-shm\sfiles\sto\spersist\safter\sthe\slast\sdatabase\sconnection\scloses. +D 2011-07-26T16:03:07.413 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,8 +165,8 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c b83e0924d1a832a89989d3d2770179205d0e066a -F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042 +F src/os_unix.c 294e8e9803454d70e796d84c77f990cc6d946899 +F src/os_win.c 313f48b6f92890f2a42d5ff6fa0fb0501d2fff25 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -181,7 +181,7 @@ F src/resolve.c 36368f44569208fa074e61f4dd0b6c4fb60ca2b4 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d219c4b68d603cc734b6f9b1e2780fee12a1fa0d F src/shell.c bbe7818ff5bc8614105ceb81ad67b8bdc0b671dd -F src/sqlite.h.in badc4f56b9b57a8731475c2ddbccd8198ce33b9b +F src/sqlite.h.in 0b3cab7b2ea51f58396e8871fa5f349cfece5330 F src/sqlite3ext.h 1a1a4f784aa9c3b00edd287940197de52487cd93 F src/sqliteInt.h ba4a6d6288efb25b84bc0d7d0aaf80f9b42523ba F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d @@ -247,7 +247,7 @@ F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b F src/vdbetrace.c 5d0dc3d5fd54878cc8d6d28eb41deb8d5885b114 F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 -F src/wal.c 0c70ad7b1cac6005fa5e2cbefd23ee05e391c290 +F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 106cd9ab3eb410dfa7d0598194c277664bb2e9a3 @@ -952,7 +952,10 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 08d0e8799e1441ef063b1cdf9e4107071a0f81ca -R 513a198a27aca1f07c596d222f883111 +P 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b +R 89b4ef80e4aa70f9d9aab4e9774d951c +T *branch * persistent-wal-patch +T *sym-persistent-wal-patch * +T -sym-trunk * U drh -Z bf5f24c7092583c5f65553c09e369462 +Z fcc3b5975e3b68e4a98c8be3a9674ec5 diff --git a/manifest.uuid b/manifest.uuid index 3e9f01365c..c07e3ca2d5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b \ No newline at end of file +e34c553bf04761e86f3bd72f91439c05886caa5c \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index dce13e5365..9f8204dfd2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -250,8 +250,9 @@ struct unixFile { /* ** Allowed values for the unixFile.ctrlFlags bitmask: */ -#define UNIXFILE_EXCL 0x01 /* Connections from one process only */ -#define UNIXFILE_RDONLY 0x02 /* Connection is read only */ +#define UNIXFILE_EXCL 0x01 /* Connections from one process only */ +#define UNIXFILE_RDONLY 0x02 /* Connection is read only */ +#define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ /* ** Include code that is common to all os_*.c files @@ -3450,21 +3451,33 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ ** Information and control of an open file handle. */ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ + unixFile *pFile = (unixFile*)id; switch( op ){ case SQLITE_FCNTL_LOCKSTATE: { - *(int*)pArg = ((unixFile*)id)->eFileLock; + *(int*)pArg = pFile->eFileLock; return SQLITE_OK; } case SQLITE_LAST_ERRNO: { - *(int*)pArg = ((unixFile*)id)->lastErrno; + *(int*)pArg = pFile->lastErrno; return SQLITE_OK; } case SQLITE_FCNTL_CHUNK_SIZE: { - ((unixFile*)id)->szChunk = *(int *)pArg; + pFile->szChunk = *(int *)pArg; return SQLITE_OK; } case SQLITE_FCNTL_SIZE_HINT: { - return fcntlSizeHint((unixFile *)id, *(i64 *)pArg); + return fcntlSizeHint(pFile, *(i64 *)pArg); + } + case SQLITE_FCNTL_PERSIST_WAL: { + int bPersist = *(int*)pArg; + if( bPersist<0 ){ + bPersist = (pFile->ctrlFlags & UNIXFILE_PERSIST_WAL)!=0; + }else if( bPersist==0 ){ + pFile->ctrlFlags &= ~UNIXFILE_PERSIST_WAL; + }else{ + pFile->ctrlFlags |= UNIXFILE_PERSIST_WAL; + } + return SQLITE_OK; } #ifndef NDEBUG /* The pager calls this method to signal that it has done diff --git a/src/os_win.c b/src/os_win.c index 5d9bf59843..4c0fc86869 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -102,8 +102,9 @@ struct winFile { const sqlite3_io_methods *pMethod; /*** Must be first ***/ sqlite3_vfs *pVfs; /* The VFS used to open this file */ HANDLE h; /* Handle for accessing the file */ - unsigned char locktype; /* Type of lock currently held on this file */ + u8 locktype; /* Type of lock currently held on this file */ short sharedLockByte; /* Randomly chosen byte used as a shared lock */ + u8 bPersistWal; /* True to persist WAL files */ DWORD lastErrno; /* The Windows errno from the last I/O error */ DWORD sectorSize; /* Sector size of the device file is on */ winShm *pShm; /* Instance of shared memory on this file */ @@ -1335,17 +1336,18 @@ static int winUnlock(sqlite3_file *id, int locktype){ ** Control and query of the open file handle. */ static int winFileControl(sqlite3_file *id, int op, void *pArg){ + winFile *pFile = (winFile*)id; switch( op ){ case SQLITE_FCNTL_LOCKSTATE: { - *(int*)pArg = ((winFile*)id)->locktype; + *(int*)pArg = pFile->locktype; return SQLITE_OK; } case SQLITE_LAST_ERRNO: { - *(int*)pArg = (int)((winFile*)id)->lastErrno; + *(int*)pArg = (int)pFile->lastErrno; return SQLITE_OK; } case SQLITE_FCNTL_CHUNK_SIZE: { - ((winFile*)id)->szChunk = *(int *)pArg; + pFile->szChunk = *(int *)pArg; return SQLITE_OK; } case SQLITE_FCNTL_SIZE_HINT: { @@ -1355,6 +1357,15 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ SimulateIOErrorBenign(0); return SQLITE_OK; } + case SQLITE_FCNTL_PERSIST_WAL: { + int bPersist = *(int*)pArg; + if( bPersist<0 ){ + bPersist = pFile->bPersistWal; + }else{ + pFile->bPersistWal = bPersist!=0; + } + return SQLITE_OK; + } case SQLITE_FCNTL_SYNC_OMITTED: { return SQLITE_OK; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index b8e8bfbc46..eb5f7a02a0 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -752,6 +752,20 @@ struct sqlite3_io_methods { ** is not changed but instead the prior value of that setting is written ** into the array entry, allowing the current retry settings to be ** interrogated. The zDbName parameter is ignored. +** +** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the +** persistent [WAL | Write AHead Log] setting. By default, the auxiliary +** write ahead log and shared memory files used for transaction control +** are automatically deleted when the latest connection to the database +** closes. Setting persistent WAL mode causes those files to persist after +** close. Persisting the files is useful when other processes that do not +** have write permission on the directory containing the database file want +** to read the database file, as the WAL and shared memory files must exist +** in order for the database to be readable. The fourth parameter to +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. +** That integer is 0 to disable persistent WAL mode or 1 to enable persistent +** WAL mode. If the integer is -1, then it is overwritten with the current +** WAL persistence setting. ** */ #define SQLITE_FCNTL_LOCKSTATE 1 @@ -763,6 +777,7 @@ struct sqlite3_io_methods { #define SQLITE_FCNTL_FILE_POINTER 7 #define SQLITE_FCNTL_SYNC_OMITTED 8 #define SQLITE_FCNTL_WIN32_AV_RETRY 9 +#define SQLITE_FCNTL_PERSIST_WAL 10 /* ** CAPI3REF: Mutex Handle diff --git a/src/wal.c b/src/wal.c index b9a03dff23..3bc42ffb17 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1804,13 +1804,15 @@ int sqlite3WalClose( */ rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE); if( rc==SQLITE_OK ){ + int bPersistWal = -1; if( pWal->exclusiveMode==WAL_NORMAL_MODE ){ pWal->exclusiveMode = WAL_EXCLUSIVE_MODE; } rc = sqlite3WalCheckpoint( pWal, SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0 ); - if( rc==SQLITE_OK ){ + sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersistWal); + if( rc==SQLITE_OK && bPersistWal!=1 ){ isDelete = 1; } } From 253cea5c6f34b1be77e9cc9c9c5ad35587ec5b25 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 26 Jul 2011 16:23:25 +0000 Subject: [PATCH 22/41] Test cases added. Fix the query mode. FossilOrigin-Name: a9d8794ae949df570466a84836882bc8bed95c7c --- manifest | 20 ++++++------- manifest.uuid | 2 +- src/os_unix.c | 2 +- src/os_win.c | 2 +- src/test1.c | 33 +++++++++++++++++++++ test/walpersist.test | 68 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 14 deletions(-) create mode 100644 test/walpersist.test diff --git a/manifest b/manifest index 38df8835a6..afa1dda3c6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Prototype\schange\sfor\sa\snew\ssqlite3_file_control()\sthat\swill\scause\sthe\n-wal\sand\s-shm\sfiles\sto\spersist\safter\sthe\slast\sdatabase\sconnection\scloses. -D 2011-07-26T16:03:07.413 +C Test\scases\sadded.\s\sFix\sthe\squery\smode. +D 2011-07-26T16:23:25.835 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,8 +165,8 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c 294e8e9803454d70e796d84c77f990cc6d946899 -F src/os_win.c 313f48b6f92890f2a42d5ff6fa0fb0501d2fff25 +F src/os_unix.c 637fa969213812ba92f1f3c54e4be967bda60a13 +F src/os_win.c 7dd45f72a6c6ae5a985865b440ebd14d8ee7b874 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -188,7 +188,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c c355b33803fb756dc09297ec84d19604301fa622 -F src/test1.c 693d9a63dfe2c68b167080c99cab82f267f5a38e +F src/test1.c e7ea726d26b9007bae7907d8b40280c70ec6c504 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -894,6 +894,7 @@ F test/walfault.test 58fce626359c9376fe35101b5c0f2df8040aa839 F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 F test/walmode.test 22ddccd073c817ac9ead62b88ac446e8dedc7d2c F test/walnoshm.test a074428046408f4eb5c6a00e09df8cc97ff93317 +F test/walpersist.test 45fb0c94fb63908e2d66b1d99ce4645bfce0fa1e F test/walro.test 2d5d69e2e99da19ce6faab340330234fc4ca0720 F test/walshared.test 6dda2293880c300baf5d791c307f653094585761 F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933 @@ -952,10 +953,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b -R 89b4ef80e4aa70f9d9aab4e9774d951c -T *branch * persistent-wal-patch -T *sym-persistent-wal-patch * -T -sym-trunk * +P e34c553bf04761e86f3bd72f91439c05886caa5c +R 19cfffdeb7e8194e5c58a90ee9f2b26d U drh -Z fcc3b5975e3b68e4a98c8be3a9674ec5 +Z c92a162aecc6522b9f0c0715256a714d diff --git a/manifest.uuid b/manifest.uuid index c07e3ca2d5..1a4145a1d2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e34c553bf04761e86f3bd72f91439c05886caa5c \ No newline at end of file +a9d8794ae949df570466a84836882bc8bed95c7c \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 9f8204dfd2..dbf3c10120 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3471,7 +3471,7 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ case SQLITE_FCNTL_PERSIST_WAL: { int bPersist = *(int*)pArg; if( bPersist<0 ){ - bPersist = (pFile->ctrlFlags & UNIXFILE_PERSIST_WAL)!=0; + *(int*)pArg = (pFile->ctrlFlags & UNIXFILE_PERSIST_WAL)!=0; }else if( bPersist==0 ){ pFile->ctrlFlags &= ~UNIXFILE_PERSIST_WAL; }else{ diff --git a/src/os_win.c b/src/os_win.c index 4c0fc86869..827091e84e 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1360,7 +1360,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ case SQLITE_FCNTL_PERSIST_WAL: { int bPersist = *(int*)pArg; if( bPersist<0 ){ - bPersist = pFile->bPersistWal; + *(int*)pArg = pFile->bPersistWal; }else{ pFile->bPersistWal = bPersist!=0; } diff --git a/src/test1.c b/src/test1.c index 3301ab7403..9a5a50103f 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5129,6 +5129,38 @@ static int file_control_win32_av_retry( return TCL_OK; } +/* +** tclcmd: file_control_persist_wal DB PERSIST-FLAG +** +** This TCL command runs the sqlite3_file_control interface with +** the SQLITE_FCNTL_PERSIST_WAL opcode. +*/ +static int file_control_persist_wal( + ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3 *db; + int rc; + int bPersist; + char z[100]; + + if( objc!=3 ){ + Tcl_AppendResult(interp, "wrong # args: should be \"", + Tcl_GetStringFromObj(objv[0], 0), " DB FLAG", 0); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){ + return TCL_ERROR; + } + if( Tcl_GetIntFromObj(interp, objv[2], &bPersist) ) return TCL_ERROR; + rc = sqlite3_file_control(db, NULL, SQLITE_FCNTL_PERSIST_WAL, (void*)&bPersist); + sqlite3_snprintf(sizeof(z), z, "%d %d", rc, bPersist); + Tcl_AppendResult(interp, z, (char*)0); + return TCL_OK; +} + /* ** tclcmd: sqlite3_vfs_list @@ -5928,6 +5960,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "file_control_chunksize_test", file_control_chunksize_test, 0 }, { "file_control_sizehint_test", file_control_sizehint_test, 0 }, { "file_control_win32_av_retry", file_control_win32_av_retry, 0 }, + { "file_control_persist_wal", file_control_persist_wal, 0 }, { "sqlite3_vfs_list", vfs_list, 0 }, { "sqlite3_create_function_v2", test_create_function_v2, 0 }, diff --git a/test/walpersist.test b/test/walpersist.test new file mode 100644 index 0000000000..3f8b0b8930 --- /dev/null +++ b/test/walpersist.test @@ -0,0 +1,68 @@ +# 2011 July 26 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file contains tests for using WAL with persistent WAL file mode. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/lock_common.tcl +set ::testprefix walpersist + +do_test walpersist-1.0 { + db eval { + PRAGMA journal_mode=WAL; + CREATE TABLE t1(a); + INSERT INTO t1 VALUES(randomblob(5000)); + } + file exists test.db-wal +} {1} +do_test walpersist-1.1 { + file exists test.db-shm +} {1} +do_test walpersist-1.2 { + db close + list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm] +} {1 0 0} +do_test walpersist-1.3 { + sqlite3 db test.db + db eval {SELECT length(a) FROM t1} +} {5000} +do_test walpersist-1.4 { + list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm] +} {1 1 1} +do_test walpersist-1.5 { + file_control_persist_wal db -1 +} {0 0} +do_test walpersist-1.6 { + file_control_persist_wal db 1 +} {0 1} +do_test walpersist-1.7 { + file_control_persist_wal db -1 +} {0 1} +do_test walpersist-1.8 { + file_control_persist_wal db 0 +} {0 0} +do_test walpersist-1.9 { + file_control_persist_wal db -1 +} {0 0} +do_test walpersist-1.10 { + file_control_persist_wal db 1 +} {0 1} +do_test walpersist-1.11 { + db close + list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm] +} {1 1 1} + + + + +finish_test From 58384f17204a615d9d42c01bfd78f4e16448c477 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 28 Jul 2011 00:14:45 +0000 Subject: [PATCH 23/41] Use osStat() instead of stat() consistently in os_unix.c FossilOrigin-Name: 9109128cb5640d687251dfbefa2fd998063cd9fb --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index e1657062a6..4620ad3442 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enable\sthe\sSQLITE_FCNTL_SIZE_HINT\son\sunix\seven\sif\sSQLITE_FCNTL_CHUNK_SIZE\nhas\snot\sbeen\sset. -D 2011-07-25T23:25:47.867 +C Use\sosStat()\sinstead\sof\sstat()\sconsistently\sin\sos_unix.c +D 2011-07-28T00:14:45.749 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c b83e0924d1a832a89989d3d2770179205d0e066a +F src/os_unix.c c617801bbe9a2233ceca4c3e3b8f5faedf955878 F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 08d0e8799e1441ef063b1cdf9e4107071a0f81ca -R 513a198a27aca1f07c596d222f883111 +P 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b +R a79be5193c847721eba9e1a1f8d0351d U drh -Z bf5f24c7092583c5f65553c09e369462 +Z 74ce5df3117db74444298f434c4c80d4 diff --git a/manifest.uuid b/manifest.uuid index 3e9f01365c..940999a63e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b \ No newline at end of file +9109128cb5640d687251dfbefa2fd998063cd9fb \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index dce13e5365..7f0013e82b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4789,7 +4789,7 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){ ** ** Even if a subsequent open() call does succeed, the consequences of ** not searching for a resusable file descriptor are not dire. */ - if( 0==stat(zPath, &sStat) ){ + if( 0==osStat(zPath, &sStat) ){ unixInodeInfo *pInode; unixEnterMutex(); @@ -4865,7 +4865,7 @@ static int findCreateFileMode( memcpy(zDb, zPath, nDb); zDb[nDb] = '\0'; - if( 0==stat(zDb, &sStat) ){ + if( 0==osStat(zDb, &sStat) ){ *pMode = sStat.st_mode & 0777; }else{ rc = SQLITE_IOERR_FSTAT; @@ -5210,7 +5210,7 @@ static int unixAccess( *pResOut = (osAccess(zPath, amode)==0); if( flags==SQLITE_ACCESS_EXISTS && *pResOut ){ struct stat buf; - if( 0==stat(zPath, &buf) && buf.st_size==0 ){ + if( 0==osStat(zPath, &buf) && buf.st_size==0 ){ *pResOut = 0; } } From e75a717dc87eaf769421ccd4d939c8e44ce5c2f0 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 28 Jul 2011 07:34:44 +0000 Subject: [PATCH 24/41] Fix conditional for retry logic in winAccess and add missing call to logIoerr. FossilOrigin-Name: 8a145863d1a8711953ae72d706404fb96f6fec06 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 4620ad3442..4818017f6a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sosStat()\sinstead\sof\sstat()\sconsistently\sin\sos_unix.c -D 2011-07-28T00:14:45.749 +C Fix\sconditional\sfor\sretry\slogic\sin\swinAccess\sand\sadd\smissing\scall\sto\slogIoerr. +D 2011-07-28T07:34:44.659 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c c617801bbe9a2233ceca4c3e3b8f5faedf955878 -F src/os_win.c 8449cb4ce1cd50248b7133108532d9582cc6c042 +F src/os_win.c 2d96ae3e548059caab14515ec5d44f7f9a627b57 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b -R a79be5193c847721eba9e1a1f8d0351d -U drh -Z 74ce5df3117db74444298f434c4c80d4 +P 9109128cb5640d687251dfbefa2fd998063cd9fb +R 5bc8852e9677e7c4f366bdd5e0dbb83a +U mistachkin +Z 4ff729fa32427901a460673b5cd07868 diff --git a/manifest.uuid b/manifest.uuid index 940999a63e..3a5d35cf84 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9109128cb5640d687251dfbefa2fd998063cd9fb \ No newline at end of file +8a145863d1a8711953ae72d706404fb96f6fec06 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 5d9bf59843..4aaf74fefa 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2455,7 +2455,7 @@ static int winAccess( int cnt = 0; WIN32_FILE_ATTRIBUTE_DATA sAttrData; memset(&sAttrData, 0, sizeof(sAttrData)); - while( (rc = GetFileAttributesExW((WCHAR*)zConverted, + while( !(rc = GetFileAttributesExW((WCHAR*)zConverted, GetFileExInfoStandard, &sAttrData)) && rc==0 && retryIoerr(&cnt) ){} if( rc ){ @@ -2470,6 +2470,7 @@ static int winAccess( attr = sAttrData.dwFileAttributes; } }else{ + logIoerr(cnt); if( GetLastError()!=ERROR_FILE_NOT_FOUND ){ winLogError(SQLITE_IOERR_ACCESS, "winAccess", zFilename); free(zConverted); From 4e6b49b4098bf4795bb877b79d80133e4ab58685 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 28 Jul 2011 19:16:41 +0000 Subject: [PATCH 25/41] Remove redundant sub-expression from retry loop invariant in winAccess. Also, make check for SQLITE_ACCESS_READWRITE formally correct. FossilOrigin-Name: 93079a92c49edf72eb289f352cd5ed7ab2faaff3 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 5 +++-- test/win32lock.test | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 4818017f6a..1cfb86f6a1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sconditional\sfor\sretry\slogic\sin\swinAccess\sand\sadd\smissing\scall\sto\slogIoerr. -D 2011-07-28T07:34:44.659 +C Remove\sredundant\ssub-expression\sfrom\sretry\sloop\sinvariant\sin\swinAccess.\s\sAlso,\smake\scheck\sfor\sSQLITE_ACCESS_READWRITE\sformally\scorrect. +D 2011-07-28T19:16:41.062 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c c617801bbe9a2233ceca4c3e3b8f5faedf955878 -F src/os_win.c 2d96ae3e548059caab14515ec5d44f7f9a627b57 +F src/os_win.c f79cb7c31cc82532f625313d9f29359931dd2ed7 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -911,7 +911,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test 0a16a7df4a51575bda27529ac992a5a94e4a38bd +F test/win32lock.test e12fe40524705cde9a4f5af4668e811807807b84 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 9109128cb5640d687251dfbefa2fd998063cd9fb -R 5bc8852e9677e7c4f366bdd5e0dbb83a +P 8a145863d1a8711953ae72d706404fb96f6fec06 +R c93000a51b03c9223d1343b66dc15be8 U mistachkin -Z 4ff729fa32427901a460673b5cd07868 +Z 63cb8d3f96a5697becf5d48d5fb1787f diff --git a/manifest.uuid b/manifest.uuid index 3a5d35cf84..3763b8717f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8a145863d1a8711953ae72d706404fb96f6fec06 \ No newline at end of file +93079a92c49edf72eb289f352cd5ed7ab2faaff3 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 4aaf74fefa..88b47a4697 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2457,7 +2457,7 @@ static int winAccess( memset(&sAttrData, 0, sizeof(sAttrData)); while( !(rc = GetFileAttributesExW((WCHAR*)zConverted, GetFileExInfoStandard, - &sAttrData)) && rc==0 && retryIoerr(&cnt) ){} + &sAttrData)) && retryIoerr(&cnt) ){} if( rc ){ /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file ** as if it does not exist. @@ -2495,7 +2495,8 @@ static int winAccess( rc = attr!=INVALID_FILE_ATTRIBUTES; break; case SQLITE_ACCESS_READWRITE: - rc = (attr & FILE_ATTRIBUTE_READONLY)==0; + rc = attr!=INVALID_FILE_ATTRIBUTES && + (attr & FILE_ATTRIBUTE_READONLY)==0; break; default: assert(!"Invalid flags argument"); diff --git a/test/win32lock.test b/test/win32lock.test index 802ea27d16..8ed467cfc8 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -57,7 +57,7 @@ while {1} { do_test win32lock-1.2-$delay1 { set ::msg } {1 100000 2 50000 3 25000 4 12500} - if {$::log!=""} { + if {[info exists ::log] && $::log!=""} { do_test win32lock-1.2-$delay1-log1 { regsub {\d+} $::log # x set x From c8eee5e5e14e11a9b04d6c13dcecf0b9fa5f0e39 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 30 Jul 2011 23:50:12 +0000 Subject: [PATCH 26/41] Fix a (humorous) typo in the lemon documentation. FossilOrigin-Name: ed630b012f468d6779b83dd8c4dbf3a8dafee573 --- doc/lemon.html | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/lemon.html b/doc/lemon.html index 6a4d6dbd2c..2c65555972 100644 --- a/doc/lemon.html +++ b/doc/lemon.html @@ -282,7 +282,7 @@ tokens) and it honors the same commenting conventions as C and C++.

A terminal symbol (token) is any string of alphanumeric and underscore characters that begins with an upper case letter. -A terminal can contain lower class letters after the first character, +A terminal can contain lowercase letters after the first character, but the usual convention is to make terminals all upper case. A nonterminal, on the other hand, is any string of alphanumeric and underscore characters than begins with a lower case letter. diff --git a/manifest b/manifest index da1057fbbe..2828036c72 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\schanges\sfor\sthe\snew\ssqlite3_file_control()\sthat\swill\scause\sthe\s-wal\sand\s-shm\sfiles\sto\spersist\safter\sthe\slast\sdatabase\sconnection\scloses. -D 2011-07-28T20:48:38.832 +C Fix\sa\s(humorous)\stypo\sin\sthe\slemon\sdocumentation. +D 2011-07-30T23:50:12.095 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -26,7 +26,7 @@ F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 F configure 93e7e695581fa7bef4949161453d9845c5592ad0 x F configure.ac 298a759c086e72c013da459c2aec02a104f4224f F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad -F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538 +F doc/lemon.html 3091574143dd3415669b6745843ff8d011d33549 F doc/pager-invariants.txt 870107036470d7c419e93768676fae2f8749cf9e F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1 @@ -953,7 +953,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 93079a92c49edf72eb289f352cd5ed7ab2faaff3 a9d8794ae949df570466a84836882bc8bed95c7c -R e027707f27957f6e6a59d5fffc14bff5 -U mistachkin -Z 03c4de519e387b889b617972ba4102a3 +P 1b56677bdfb102d070a2057a65ba424fec81131d +R 07a1c012e85371e0cbf430cb6bbf3579 +U drh +Z 06c1fbb8b37310ceef1a2adde6978995 diff --git a/manifest.uuid b/manifest.uuid index 961da9f06b..313ea78ef0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1b56677bdfb102d070a2057a65ba424fec81131d \ No newline at end of file +ed630b012f468d6779b83dd8c4dbf3a8dafee573 \ No newline at end of file From fda06befd5d323355b2265e7e34628886282c433 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2011 00:57:34 +0000 Subject: [PATCH 27/41] Add retry logic for AV defense to winOpen. Also, refactor test suite to allow the key Tcl file operations (e.g. copy and delete) to be retried. FossilOrigin-Name: 9007586fdabed8dbcc78581ea9821cfd1f9a4c8c --- manifest | 341 ++++++++++++++++++------------------ manifest.uuid | 2 +- src/os_win.c | 33 ++-- test/8_3_names.test | 8 +- test/alter.test | 8 +- test/alter2.test | 4 +- test/alter3.test | 6 +- test/alter4.test | 6 +- test/async.test | 2 +- test/async2.test | 2 +- test/async3.test | 4 +- test/async5.test | 2 +- test/attach.test | 22 +-- test/attach2.test | 8 +- test/attach3.test | 4 +- test/attachmalloc.test | 8 +- test/autoinc.test | 6 +- test/autovacuum.test | 8 +- test/autovacuum_ioerr2.test | 8 +- test/backcompat.test | 4 +- test/backup.test | 52 +++--- test/backup2.test | 18 +- test/backup_ioerr.test | 6 +- test/capi3.test | 8 +- test/capi3c.test | 8 +- test/collate7.test | 2 +- test/corrupt.test | 32 ++-- test/corrupt2.test | 42 ++--- test/corrupt9.test | 6 +- test/corruptA.test | 10 +- test/corruptB.test | 16 +- test/corruptC.test | 42 ++--- test/corruptD.test | 4 +- test/corruptE.test | 20 +-- test/crash.test | 6 +- test/crash3.test | 6 +- test/crash4.test | 2 +- test/crash5.test | 2 +- test/crash6.test | 6 +- test/crash7.test | 2 +- test/crash8.test | 14 +- test/createtab.test | 2 +- test/dbstatus.test | 4 +- test/delete.test | 6 +- test/descidx1.test | 6 +- test/diskfull.test | 4 +- test/e_expr.test | 6 +- test/e_fts3.test | 4 +- test/enc2.test | 26 +-- test/enc3.test | 4 +- test/enc4.test | 4 +- test/exclusive.test | 16 +- test/exclusive2.test | 4 +- test/fallocate.test | 2 +- test/filectrl.test | 2 +- test/filefmt.test | 10 +- test/fts1j.test | 6 +- test/fts1o.test | 2 +- test/fts2j.test | 6 +- test/fts2o.test | 4 +- test/fts3aj.test | 6 +- test/fts3ao.test | 4 +- test/fts3snippet.test | 2 +- test/fts4aa.test | 2 +- test/fuzz_malloc.test | 2 +- test/hook.test | 4 +- test/incrblob.test | 6 +- test/incrvacuum.test | 12 +- test/incrvacuum2.test | 2 +- test/incrvacuum_ioerr.test | 2 +- test/insert5.test | 2 +- test/io.test | 12 +- test/ioerr.test | 8 +- test/ioerr4.test | 10 +- test/journal1.test | 8 +- test/journal2.test | 2 +- test/journal3.test | 2 +- test/jrnlmode.test | 12 +- test/jrnlmode2.test | 2 +- test/jrnlmode3.test | 4 +- test/loadext.test | 2 +- test/lock4.test | 2 +- test/lock5.test | 4 +- test/main.test | 14 +- test/malloc.test | 8 +- test/malloc3.test | 4 +- test/malloc5.test | 4 +- test/mallocA.test | 6 +- test/malloc_common.tcl | 2 +- test/manydb.test | 4 +- test/memsubsys1.test | 2 +- test/memsubsys2.test | 2 +- test/misc1.test | 2 +- test/misc2.test | 6 +- test/misc5.test | 4 +- test/misc7.test | 30 ++-- test/misuse.test | 4 +- test/multiplex.test | 4 +- test/notify1.test | 4 +- test/notify2.test | 2 +- test/notify3.test | 2 +- test/openv2.test | 2 +- test/pager1.test | 18 +- test/pagerfault.test | 6 +- test/pagesize.test | 8 +- test/pcache2.test | 4 +- test/pragma.test | 22 +-- test/pragma2.test | 8 +- test/quota.test | 10 +- test/rollback.test | 4 +- test/savepoint.test | 16 +- test/savepoint6.test | 2 +- test/securedel.test | 2 +- test/shared.test | 30 ++-- test/shared2.test | 2 +- test/shared3.test | 2 +- test/shared4.test | 8 +- test/shared6.test | 2 +- test/shared7.test | 2 +- test/speed3.test | 2 +- test/sqllimits1.test | 2 +- test/stat.test | 2 +- test/sync.test | 4 +- test/table.test | 4 +- test/temptable.test | 6 +- test/temptrigger.test | 4 +- test/tester.tcl | 195 +++++++++++++++------ test/thread002.test | 2 +- test/thread003.test | 2 +- test/thread005.test | 2 +- test/tkt-2d1a5c67d.test | 4 +- test/tkt-5ee23731f.test | 2 +- test/tkt-f3e5abed55.test | 6 +- test/tkt1667.test | 2 +- test/tkt1873.test | 2 +- test/tkt2686.test | 2 +- test/tkt2817.test | 2 +- test/tkt2820.test | 4 +- test/tkt2854.test | 2 +- test/tkt3457.test | 12 +- test/tkt35xx.test | 2 +- test/trigger1.test | 4 +- test/trigger4.test | 6 +- test/triggerA.test | 10 +- test/triggerC.test | 2 +- test/triggerD.test | 2 +- test/vacuum.test | 14 +- test/vacuum2.test | 2 +- test/vacuum3.test | 2 +- test/view.test | 2 +- test/vtab1.test | 4 +- test/vtab7.test | 4 +- test/vtabC.test | 2 +- test/wal.test | 62 +++---- test/wal2.test | 24 +-- test/wal3.test | 18 +- test/wal4.test | 2 +- test/walbak.test | 6 +- test/walcksum.test | 30 ++-- test/walcrash.test | 22 +-- test/walfault.test | 2 +- test/walmode.test | 2 +- test/walnoshm.test | 8 +- test/walslow.test | 8 +- test/walthread.test | 10 +- 165 files changed, 926 insertions(+), 859 deletions(-) diff --git a/manifest b/manifest index 2828036c72..0905616d4a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\s(humorous)\stypo\sin\sthe\slemon\sdocumentation. -D 2011-07-30T23:50:12.095 +C Add\sretry\slogic\sfor\sAV\sdefense\sto\swinOpen.\s\sAlso,\srefactor\stest\ssuite\sto\sallow\sthe\skey\sTcl\sfile\soperations\s(e.g.\scopy\sand\sdelete)\sto\sbe\sretried. +D 2011-08-02T00:57:34.578 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 51caec436f811fa387a85cf7b05f13962c7fe0dc -F src/os_win.c 60af92b1b1cc7aee13f5e0b5f9dde2d7abb41354 +F src/os_win.c 4eb6fa00ee28f6d7bad0526edcbe5a60d297c67a F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -251,14 +251,14 @@ F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f F src/where.c 106cd9ab3eb410dfa7d0598194c277664bb2e9a3 -F test/8_3_names.test b93687beebd17f6ebf812405a6833bae5d1f4199 +F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 52fc8dee494092031a556911d404ca30a749a30b -F test/alter.test a3f570072b53d7c0fe463bab3f5affa8e113c487 -F test/alter2.test e0c09d630d650ea32333781a4ed3c45eb02c4289 -F test/alter3.test 8677e48d95536f7a6ed86a1a774744dadcc22b07 -F test/alter4.test 1e5dd6b951e9f65ca66422edff02e56df82dd403 +F test/alter.test 5314fc01ef51ab8af0b8890725b710ed48d4806b +F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060 +F test/alter3.test 49c9d9fba2b8fcdce2dedeca97bbf1f369cc548d +F test/alter4.test b2debc14d8cbe4c1d12ccd6a41eef88a8c1f15d5 F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc F test/analyze.test c8cb89e8736336f1f0646c8123e6028a14c7b55e F test/analyze2.test 8f2b1534d43f5547ce9a6b736c021d4192c75be3 @@ -267,28 +267,28 @@ F test/analyze4.test 757b37875cf9bb528d46f74497bc789c88365045 F test/analyze5.test 1de8d66b11aae5a1453aa042d62e834a476bac9c F test/analyze6.test c125622a813325bba1b4999040ddc213773c2290 F test/analyze7.test 5508e7828164ea0b518ed219bed7320a481863d4 -F test/async.test ad4ba51b77cd118911a3fe1356b0809da9c108c3 -F test/async2.test bf5e2ca2c96763b4cba3d016249ad7259a5603b6 -F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e +F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b +F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b +F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7 F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a -F test/async5.test f3592d79c84d6e83a5f50d3fd500445f7d97dfdf -F test/attach.test 2bb09073d7d5499127db00f50780766dcea913e1 -F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437 -F test/attach3.test bd9830bc3a0d22ed1310c9bff6896927937017dc +F test/async5.test 0dd8701bd588bf6e70c2557a22ae3f22b2567b4c +F test/attach.test 0e6f8de2589f11a5f474ef57fe5af2877e61c0e8 +F test/attach2.test e54436ed956d3d88bdee61221da59bf3935a0966 +F test/attach3.test d89ccfe4fe6e2b5e368d480fcdfe4b496c54cf4e F test/attach4.test 31f9eb0ca7bdbc393cc4657b877903a226a83d4b -F test/attachmalloc.test 1d5b821a676f7bf0b00d87cc106b78966789ba57 +F test/attachmalloc.test 3a4bfca9545bfe906a8d2e622de10fbac5b711b0 F test/auth.test b047105c32da7db70b842fd24056723125ecc2ff F test/auth2.test 270baddc8b9c273682760cffba6739d907bd2882 F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5 -F test/autoinc.test 85ef3180a737e6580086a018c09c6f1a52759b46 +F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf F test/autoindex1.test 058d0b331ae6840a61bbee910d8cbae27bfd5991 -F test/autovacuum.test bb7c0885e6f8f1d633045de48f2b66082162766d -F test/autovacuum_ioerr2.test 598b0663074d3673a9c1bc9a16e80971313bafe6 +F test/autovacuum.test fcaf4616ae5bb18098db1cb36262565e5c841c3c +F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 -F test/backcompat.test 0f23ff8d516acdf42f3d866a66d85306de2d02bc -F test/backup.test 004d3b78bffd990741ab50133ed4347c25c172b1 -F test/backup2.test b7c69f937c912e85ac8a5dbd1e1cf290302b2d49 -F test/backup_ioerr.test 1f012e692f42c0442ae652443258f70e9f20fa38 +F test/backcompat.test 71eeb75ea567c060774c4e8db4b0e703f21c7677 +F test/backup.test 6970614b002b056ae5bab5b76559905e02b6f0b2 +F test/backup2.test b4966934b2dc10a9a6546114566ea69b34a5185e +F test/backup_ioerr.test 40d208bc9224b666ee3ed423f49bc9062a36a9d0 F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f @@ -310,9 +310,9 @@ F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0 F test/cache.test 754baab2f18089fc9bcba7afaeb4dc907c6c6de2 F test/capi2.test 835d4cee9f542ea50fa8d01f3fe6de80b0627360 -F test/capi3.test 5c1ea6c940f2d7c4d5af8ef1ec2f92a267d2e37a +F test/capi3.test 7200dff6acb17b9a4b6f9918f554eaae04968ddd F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4 -F test/capi3c.test bea67403a5e37a4b33230ee4723e315a2ffb31e7 +F test/capi3c.test ccf0acf045dbacd09f6229aa4efed670aaba76a9 F test/capi3d.test cd36571f014f34bdc4421967f6453cbb597d5d16 F test/capi3e.test f7408dda65c92b9056199fdc180f893015f83dde F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3 @@ -324,59 +324,59 @@ F test/collate3.test d28d2cfab2c3a3d4628ae4b2b7afc9965daa3b4c F test/collate4.test 3d3f123f83fd8ccda6f48d617e44e661b9870c7d F test/collate5.test 67f1d3e848e230ff4802815a79acb0a8b5e69bd7 F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907 -F test/collate7.test fac8db7aac3978466c04ae892cc74dcf2bc031aa +F test/collate7.test 8ec29d98f3ee4ccebce6e16ce3863fb6b8c7b868 F test/collate8.test df26649cfcbddf109c04122b340301616d3a88f6 F test/collate9.test 3adcc799229545940df2f25308dd1ad65869145a F test/collateA.test b8218ab90d1fa5c59dcf156efabb1b2599c580d6 F test/colmeta.test 087c42997754b8c648819832241daf724f813322 F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b F test/conflict.test cabc41f7616675df71b4fddabca3bd5d9221915a -F test/corrupt.test 1a5bef8b2d178859af69814ecedcd37219a89968 -F test/corrupt2.test 808a28d0ca3b97e9aa8c91cd2b485ea2700b76d1 +F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e +F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0 F test/corrupt3.test e3006aaf579d2ed7f1b94bf4cc695d3c784fa5af F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4 F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75 -F test/corrupt9.test fad0bc26a5c972580a8d763c62f24094f4e8ef25 -F test/corruptA.test 856ea7a2eb5c1c767abbdf02679ac6cb158e4643 -F test/corruptB.test 44133515cf46c4d7bba691e3bcfa478080413af0 -F test/corruptC.test 483aa35dadfd96bdf549e38d75ffc2942576477e -F test/corruptD.test 63a449a3146b460231535d04a409d14ce71795ad -F test/corruptE.test 7290b61145d954be549340e462ca84826d8a31a3 +F test/corrupt9.test 959179e68dc0b7b99f424cf3e0381c86dcdd0112 +F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce +F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647 +F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb +F test/corruptD.test 99b1999dbfa7cc04aaeac9d695a2445d4e7c7458 +F test/corruptE.test 78f7e1b9fd4a92e5951c7a5e414f2c4492733870 F test/count.test 454e1ce985c94d13efeac405ce54439f49336163 -F test/crash.test 1b6ac8410689ff78028887f445062dc897c9ac89 +F test/crash.test 519dc29f6fea151f015a23236e555239353946eb F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651 -F test/crash3.test 776f9363554c029fcce71d9e6600fa0ba6359ce7 -F test/crash4.test 02ff4f15c149ca1e88a5c299b4896c84d9450c3b -F test/crash5.test 80a2f7073381837fc082435c97df52a830abcd80 -F test/crash6.test 9c730cf06335003cb1f5cfceddacd044155336e0 -F test/crash7.test e20a7b9ee1d16eaef7c94a4cb7ed2191b4d05970 -F test/crash8.test 76b95451933fe172ce8e26bff22d5c663c8ae473 +F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418 +F test/crash4.test fe2821baf37168dc59dd733dcf7dba2a401487bc +F test/crash5.test 69226a1b948d8961395b7ad2a1df084c212ce8cf +F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba +F test/crash7.test 6c6a369af266af2ef50ab34df8f94d719065e2c1 +F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 -F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272 +F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8 F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47 F test/date.test a18a2ce81add84b17b06559e82ad7bb91bc6ddff -F test/dbstatus.test 175b088308f2ce3f7afb8208f25c10878ee05921 +F test/dbstatus.test a719af0f226bd280748a4bb9054c0a5a9fc1b16c F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc -F test/delete.test f7629d9eb245dfca170169cc5c7a735dec34aeb4 +F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701 F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab -F test/descidx1.test b1353c1a15cfbee97b13a1dcedaf0fe78163ba6a +F test/descidx1.test 533dcbda614b0463b0ea029527fd27e5a9ab2d66 F test/descidx2.test 9f1a0c83fd57f8667c82310ca21b30a350888b5d F test/descidx3.test fe720e8b37d59f4cef808b0bf4e1b391c2e56b6f -F test/diskfull.test 0cede7ef9d8f415d9d3944005c76be7589bb5ebb +F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e F test/distinct.test 8c4d951fc40aba84421060e07b16099d2f4c2fdf F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376 F test/e_createtable.test 4771686a586b6ae414f927c389b2c101cc05c028 F test/e_delete.test e2ae0d3fce5efd70fef99025e932afffc5616fab F test/e_droptrigger.test ddd4b28ed8a3d81bd5153fa0ab7559529a2ca03a F test/e_dropview.test b347bab30fc8de67b131594b3cd6f3d3bdaa753d -F test/e_expr.test 71b55f90c9336ecec5a99641679036931260c754 +F test/e_expr.test d93ccded2409c66637dc1649a02f169e041b63d8 F test/e_fkey.test 38039b840ab19331000b0f0eb1d82baa7208a67a -F test/e_fts3.test 75bb0aee26384ef586165e21018a17f7cd843469 +F test/e_fts3.test 5c02288842e4f941896fd44afdef564dd5fc1459 F test/e_insert.test 76d4bb5da9b28014d515d91ffe29a79a1e99f2bc F test/e_reindex.test a064f0878b8f848fbca38f1f61f82f15a3000c64 F test/e_resolve.test dcce9308fb13b934ce29591105d031d3e14fbba6 @@ -386,19 +386,19 @@ F test/e_update.test b926341a65955d69a6375c9eb4fd82e7089bc83a F test/e_uri.test 6f35b491f80dac005c8144f38b2dfb4d96483596 F test/e_vacuum.test 6c09c2af7f2f140518f371c5342100118f779dcf F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea -F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398 -F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041 -F test/enc4.test b145fa25feb56ea1d51a5bc43ca268c0cf691a67 +F test/enc2.test 796c59832e2b9a52842f382ffda8f3e989db03ad +F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40 +F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020 F test/eqp.test f14fadd76da53405e9885e2431cacf7191d83cdb F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3 -F test/exclusive.test 53e1841b422e554cecf0160f937c473d6d0e3062 -F test/exclusive2.test 343d55130c12c67b8bf10407acec043a6c26c86b +F test/exclusive.test a1b324cb21834a490cd052d409d34789cfef57cb +F test/exclusive2.test 372be98f6de44dd78734e364b7b626ea211761a6 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d -F test/fallocate.test 43dc34b8c24be6baffadc3b4401ee15710ce83c6 -F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e -F test/filefmt.test f178cfc29501a14565954c961b226e61877dd32c +F test/fallocate.test b5d34437bd7ab01d41b1464b8117aefd4d32160e +F test/filectrl.test 4eb0178956ca25a756e6d79711a90fec7157b454 +F test/filefmt.test ffa17b5aebc3eb4b1e3be1ccb5ee906ffbd97f6e F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da F test/fkey2.test 080969fe219b3b082b0e097ac18c6af2e5b0631f F test/fkey3.test 5ec899d12b13bcf1e9ef40eff7fb692fdb91392e @@ -412,12 +412,12 @@ F test/fts1d.test a73deace5c18df4a549b12908bade4f05dcf1a2f F test/fts1e.test 77244843e925560b5a0b70069c3e7ab62f181ed2 F test/fts1f.test 2d6cb10d8b7a4e6edc321bbdb3982f1f48774714 F test/fts1i.test 6bfe08cdfdced063a39a50c8601da65e6274d879 -F test/fts1j.test e4c0ffcd0ba2adce09c6b7b43ffd0749b5fda5c7 +F test/fts1j.test e3797475796043a161e348c46a309664cac83f7f F test/fts1k.test 65d3b41487b9f738d11b0f00eca375c0ca6bd970 F test/fts1l.test 15c119ed2362b2b28d5300c0540a6a43eab66c36 F test/fts1m.test 2d9ca67b095d49f037a914087cc0a61e89da4f0c F test/fts1n.test a2317dcd27b1d087ee3878b30e0a59c593c98b7a -F test/fts1o.test 382b8b07a2d6de5610814d9477117c4430464b9c +F test/fts1o.test fd92f82ea9090dbc2a13d4cd58aafe5afa371b6a F test/fts1porter.test d86e9c3e0c7f8ff95add6582b4b585fb4e02b96d F test/fts2.test e3fb95f96a650411574efc136f3fb10eef479ed7 F test/fts2a.test 473a5c8b473a4e21a8e3fddaed1e59666e0c6ab7 @@ -429,12 +429,12 @@ F test/fts2f.test cf84096235991709c1e61caa389632aa0a4f976d F test/fts2g.test d49d6f6c900e6e20a0fb980ec1cd568dee12af76 F test/fts2h.test 223af921323b409d4b5b18ff4e51619541b174bb F test/fts2i.test 1b22451d1f13f7c509baec620dc3a4a754885dd6 -F test/fts2j.test f68d7611f76309bc8b94170f3740d9fbbc061d9b +F test/fts2j.test 298fa1670aa21cd445b282d139b70c72e7ade12b F test/fts2k.test c7ebf4a4937594aa07459e3e1bca1251c1be8659 F test/fts2l.test 3333336621524cf7d60bb62d6ef6ab69647866ed F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51 F test/fts2n.test 12b9c5352128cebd1c6b8395e43788d4b09087c2 -F test/fts2o.test c6a79567d85403dc4d15b89f3f9799a0a0aef065 +F test/fts2o.test 09cd920d585ebf1c2910b6be869efa286e308a84 F test/fts2p.test 4b48c35c91e6a7dbf5ac8d1e5691823cc999aafb F test/fts2q.test b2fbbe038b7a31a52a6079b215e71226d8c6a682 F test/fts2r.test b154c30b63061d8725e320fba1a39e2201cadd5e @@ -450,12 +450,12 @@ F test/fts3af.test d394978c534eabf22dd0837e718b913fd66b499c F test/fts3ag.test 0b7d303f61ae5d620c4efb5e825713ea34ff9441 F test/fts3ah.test dc9f66c32c296f1bc8bcc4535126bddfeca62894 F test/fts3ai.test d29cee6ed653e30de478066881cec8aa766531b2 -F test/fts3aj.test 584facbc9ac4381a7ec624bfde677340ffc2a5a4 +F test/fts3aj.test 0ed71e1dd9b03b843a857dc3eb9b15630e0104fc F test/fts3ak.test bd14deafe9d1586e8e9bf032411026ac4f8c925d F test/fts3al.test 07d64326e79bbdbab20ee87fc3328fbf01641c9f F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8 F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18 -F test/fts3ao.test b83f99f70e9eec85f27d75801a974b3f820e01f9 +F test/fts3ao.test 60a15590d3c8578e943e4a149524b16b9bc1be92 F test/fts3atoken.test 402ef2f7c2fb4b3d4fa0587df6441c1447e799b3 F test/fts3auto.test c1a30b37002b7c764a96937fbc71065b73d69494 F test/fts3aux1.test 0b02743955d56fc0d4d66236a26177bd1b726de0 @@ -481,9 +481,9 @@ F test/fts3prefix.test 36246609111ec1683f7ea5ed27666ce2cefb5676 F test/fts3query.test ef79d31fdb355d094baec1c1b24b60439a1fb8a2 F test/fts3rnd.test 1320d8826a845e38a96e769562bf83d7a92a15d0 F test/fts3shared.test 8bb266521d7c5495c0ae522bb4d376ad5387d4a2 -F test/fts3snippet.test a12f22a3ba4dd59751a57c79b031d07ab5f51ddd +F test/fts3snippet.test 8e956051221a34c7daeb504f023cb54d5fa5a8b2 F test/fts3sort.test 63d52c1812904b751f9e1ff487472e44833f5402 -F test/fts4aa.test 148d9eb54901af23b5d402b1f388f43e559e1728 +F test/fts4aa.test 6e7f90420b837b2c685f3bcbe84c868492d40a68 F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a @@ -491,22 +491,22 @@ F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6 F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167 F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b -F test/fuzz_malloc.test dd7001ac86d09c154a7dff064f4739c60e2b312c +F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26 F test/fuzzer1.test ddfb04f3bd5cfdda3b1aa15b78d3ad055c9cc50f -F test/hook.test f2277c309e4ee8067d95d6b9b315568e9d5329b2 +F test/hook.test 5f3749de6462a6b87b4209b74adf7df5ac2df639 F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4 F test/in.test 19b642bb134308980a92249750ea4ce3f6c75c2d F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0 F test/in4.test 64f3cc1acde1b9161ccdd8e5bde3daefdb5b2617 -F test/incrblob.test 76e787ca3301d9bfa6906031c626d26f8dd707de +F test/incrblob.test 3307c04876fe025e10256e3cc8050ab5a84aa27f F test/incrblob2.test edc3a96e557bd61fb39acc8d2edd43371fbbaa19 F test/incrblob3.test aedbb35ea1b6450c33b98f2b6ed98e5020be8dc7 F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597 F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0 -F test/incrvacuum.test 453d1e490d8f5ad2c9b3a54282a0690d6ae56462 -F test/incrvacuum2.test ae04573b73ad52179f56e194fff0fbe43b509d23 -F test/incrvacuum_ioerr.test 57d2f5777ab13fa03b87b262a4ea1bad5cfc0291 +F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32 +F test/incrvacuum2.test 62fbeb85459fe4e501684d8fb5b6e98a23e3b0c0 +F test/incrvacuum_ioerr.test 22f208d01c528403240e05beecc41dc98ed01637 F test/index.test b5429732b3b983fa810e3ac867d7ca85dae35097 F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6 F test/index3.test 423a25c789fc8cc51aaf2a4370bbdde2d9e9eed7 @@ -516,15 +516,15 @@ F test/insert.test aef273dd1cee84cc92407469e6bd1b3cdcb76908 F test/insert2.test 4f3a04d168c728ed5ec2c88842e772606c7ce435 F test/insert3.test 1b7db95a03ad9c5013fdf7d6722b6cd66ee55e30 F test/insert4.test 63ea672b0fc6d3a9a0ccee774a771510b1e684c4 -F test/insert5.test 1f93cbe9742110119133d7e8e3ccfe6d7c249766 +F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6 F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4 F test/interrupt.test 42e7cf98646fd9cb4a3b131a93ed3c50b9e149f1 F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f -F test/io.test 1b895d6774491895cbc75659969f07ca01860c88 -F test/ioerr.test 622aebd2f24779cafaf5dd3e3c2b349ce40ade3b +F test/io.test b278aa8fa609ed0dcc825df31b2d9f526c5a52bd +F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8 F test/ioerr2.test 1b56cb80d5b0726ee3ba325ca175734541e32955 F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd -F test/ioerr4.test fc6eddfec2efc2f1ed217b9eae4c1c1d3516ce86 +F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4 F test/join.test 8d63cc4d230a7affafa4b6ab0b97c49b8ccb365c F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324 @@ -532,40 +532,40 @@ F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe F test/join6.test bf82cf3f979e9eade83ad0d056a66c5ed71d1901 -F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19 -F test/journal2.test 50a3604768494d4a337f194f0a9480e7c57dcb72 -F test/journal3.test ff175219be1b02d2f7e54297ad7e491b7533edb6 -F test/jrnlmode.test e3fe6c4a2c3213d285650dc8e33aab7eaaa5ce53 -F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00 -F test/jrnlmode3.test c6522b276ba315fd1416198de6fc1da9e72409fb +F test/journal1.test 8b71ef1ed5798bdc0e6eb616d8694e2c2c188d4d +F test/journal2.test 29937bdbb253bbfd92057610120bdc0aa7e84a0a +F test/journal3.test 6fd28532c88b447db844186bc190523108b6dbb4 +F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36 +F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d +F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05 F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/like.test 9cc5261d22f2108a27cedff8a972aa3284a4ba52 F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da F test/limit.test 2db7b3b34fb925b8e847d583d2eb67531d0ce67e -F test/loadext.test 0393ce12d9616aa87597dd0ec88181de181f6db0 +F test/loadext.test dab17f7014f8079698dbd4b02705562b0ce6db5f F test/loadext2.test 0bcaeb4d81cd5b6e883fdfea3c1bdbe1f173cbca F test/lock.test db74fdf5a73bad29ab3d862ea78bf1068972cc1d F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00 -F test/lock4.test c82268c031d39345d05efa672f80b025481b3ae5 -F test/lock5.test b2abb5e711bc59b0eae00f6c97a36ec9f458fada +F test/lock4.test e175ae13865bc87680607563bafba21f31a26f12 +F test/lock5.test 5ad6a1f536036ff1be915cfdd41481aeafda3273 F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5 F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64 F test/lock_common.tcl 0c270b121d40959fa2f3add382200c27045b3d95 F test/lookaside.test 93f07bac140c5bb1d49f3892d2684decafdc7af2 -F test/main.test 9d7bbfcc1b52c88ba7b2ba6554068ecf9939f252 +F test/main.test 39c4bb8a157f57298ed1659d6df89d9f35aaf2c8 F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 -F test/malloc.test 76017be66cec4375a4b4ea5c71245e27a9fe2d0b -F test/malloc3.test 4128b1e6ffa506103b278ad97af89174f310c7ca +F test/malloc.test 8c727fe29fccd280cbf8f6acf08bd10b76beaf34 +F test/malloc3.test de8eca0c3e748878845fdca3663ec4b642073caf F test/malloc4.test 957337613002b7058a85116493a262f679f3a261 -F test/malloc5.test 4d16d1bb26d2deddd7c4f480deec341f9b2d0e22 +F test/malloc5.test 338e0f7df5fde4a0129c8002a915410e1080bfb4 F test/malloc6.test 2f039d9821927eacae43e1831f815e157659a151 F test/malloc7.test 7c68a32942858bc715284856c5507446bba88c3a F test/malloc8.test 9b7a3f8cb9cf0b12fff566e80a980b1767bd961d F test/malloc9.test 2307c6ee3703b0a21391f3ea92388b4b73f9105e -F test/mallocA.test 4b650c745aab289079454f4d1c02abe5c97ab6b3 +F test/mallocA.test 47006c8d70f29b030652e251cb9d35ba60289198 F test/mallocAll.test 98f1be74bc9f49a858bc4f361fc58e26486798be F test/mallocB.test bc475ab850cda896142ab935bbfbc74c24e51ed6 F test/mallocC.test 3dffe16532f109293ce1ccecd0c31dca55ef08c4 @@ -577,53 +577,53 @@ F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6 F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9 -F test/malloc_common.tcl 50d0ed21eed0ae9548b58935bd29ac89a05a54fa -F test/manydb.test b3d3bc4c25657e7f68d157f031eb4db7b3df0d3c +F test/malloc_common.tcl 9a329bb7fd3723ee508542be8ff428bf33cccc92 +F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test 708a028d6d373e5b3842e4bdc8ba80998c9a4da6 F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 -F test/memsubsys1.test 679db68394a5692791737b150852173b3e2fea10 -F test/memsubsys2.test 72a731225997ad5e8df89fdbeae9224616b6aecc +F test/memsubsys1.test 16ce163ac1ace3d71bf0eaa6a821ed153addd91f +F test/memsubsys2.test 3a1c1a9de48e5726faa85108b02459fae8cb9ee9 F test/minmax.test 722d80816f7e096bf2c04f4111f1a6c1ba65453d F test/minmax2.test 33504c01a03bd99226144e4b03f7631a274d66e0 F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354 -F test/misc1.test e56baf44656dd68d6475a4b44521045a60241e9b -F test/misc2.test a628db7b03e18973e5d446c67696b03de718c9fd +F test/misc1.test 55cb2bfbf4a8cd61f4be1effc30426ad41696bff +F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d F test/misc3.test 72c5dc87a78e7865c5ec7a969fc572913dbe96b6 F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6 -F test/misc5.test 9f9338f8211c7f5d1cbe16331fa65d019501aa50 +F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 -F test/misc7.test 29032efcd3d826fbd409e2a7af873e7939f4a4e3 -F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 -F test/multiplex.test b45367b1dac7dfa4c5b8ff0f3844260804a0034d +F test/misc7.test eafaa41b9133d7a2ded4641bbe5f340731d35a52 +F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054 +F test/multiplex.test 9df8bf738b3b97c718fceb3fadb30900ba494418 F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test dc212a22b36109fd1ae37154292444ef249c5ec2 -F test/notify1.test 8433bc74bd952fb8a6e3f8d7a4c2b28dfd69e310 -F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db -F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a +F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf +F test/notify2.test 9503e51b9a272a5405c205ad61b7623d5a9ca489 +F test/notify3.test a86259abbfb923aa27d30f0fc038c88e5251488a F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 -F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec +F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/oserror.test 3fe52e0bd2891a9bf7cdeb639554992453d46301 -F test/pager1.test 228a831060dab96bc91b03ba2a85cedefd1ab38a +F test/pager1.test 7fc949ccd463dedda729e4d0a1a44e63a3273d39 F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f -F test/pagerfault.test 4194b8ea2a5da7958cd155556605ff554e1b065a +F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442 F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401 F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7 F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 -F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb +F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 -F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16 +F test/pcache2.test 9f9357bb0f463b87bdf695646024ed2031a0c85a F test/permutations.test aae89941ca0968b53633c97b5dd0d6f9f9899d27 -F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850 -F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 +F test/pragma.test c8108e01da04f16e67e5754e610bc62c1b993f6c +F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 -F test/quota.test 48c3a5a98687d67ef06fc16d2e603284756bbec3 +F test/quota.test 9535e220ad10ac1cdc49e246a53f080056f41141 F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6 F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 F test/randexpr1.test 1084050991e9ba22c1c10edd8d84673b501cc25a @@ -631,21 +631,21 @@ F test/rdonly.test c267d050a1d9a6a321de502b737daf28821a518d F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a F test/releasetest.tcl fa302d03fd9acfce6d910553a33473bfcf561958 -F test/rollback.test 1a83118ea6db4e7d8c10eaa63871b5e90502ffdc +F test/rollback.test a1b4784b864331eae8b2a98c189efa2a8b11ff07 F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81 F test/rowid.test e58e0acef38b527ed1b0b70d3ada588f804af287 F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798 -F test/savepoint.test a1bef7ace82cc7922975fa96b06176e9bd5114cf +F test/savepoint.test e575217b07d6a6e895e66f4eda076570815e0027 F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7 F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0 F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd -F test/savepoint6.test 76d3948568b2cdc0c13a671cadcae75009b183d6 +F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7 F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5 F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38 F test/schema4.test e6a66e20cc69f0e306667c08be7fda3d11707dc5 -F test/securedel.test 328d2921c0ca49bdd3352e516b0377fc07143254 +F test/securedel.test 87a2561151af1f1e349071a89fdd77059f50113c F test/select1.test f67ca2dfc05df41c7b86eb32ca409b427a5f43b0 F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56 F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054 @@ -659,12 +659,12 @@ F test/selectA.test 06d1032fa9009314c95394f2ca2e60d9f7ae8532 F test/selectB.test 0d072c5846071b569766e6cd7f923f646a8b2bfa F test/selectC.test f9bf1bc4581b5b8158caa6e4e4f682acb379fb25 F test/server1.test f5b790d4c0498179151ca8a7715a65a7802c859c -F test/shared.test b9114eaea7e748a3a4c8ff7b9ca806c8f95cef3e -F test/shared2.test 7f6ad2d857d0f4e5d6a0b9a897b5e56a6b6ea18c -F test/shared3.test d69bdd5f156580876c5345652d21dc2092e85962 -F test/shared4.test d0fadacb50bb6981b2fb9dc6d1da30fa1edddf83 -F test/shared6.test 990d2584b5db28e6e1f24742c711b26e59757b67 -F test/shared7.test 8114027cb5e8c376e467115703d46e5ac4e77739 +F test/shared.test 34945a516532b11182c3eb26e31247eee3c9ae48 +F test/shared2.test 8f71d4eb4d5261280de92284df74172545c852cc +F test/shared3.test ebf77f023f4bdaa8f74f65822b559e86ce5c6257 +F test/shared4.test 72d90821e8d2fc918a08f16d32880868d8ee8e9d +F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9 +F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 @@ -676,32 +676,32 @@ F test/speed1.test f2974a91d79f58507ada01864c0e323093065452 F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb F test/speed1p.test c4a469f29f135f4d76c55b1f2a52f36e209466cc F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded -F test/speed3.test 5a419039e9da95d906adb2298af2849600c81c11 +F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523 F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b -F test/sqllimits1.test 0ebf7bed0b99c96f24e0b7fa5e59dbc42359c421 -F test/stat.test c7b20ea43003dc2dc33335e231c27be8284c4a2a +F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298 +F test/stat.test 0997f6a57a35866b14111ed361ed8851ce7978ae F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9 F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796 F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/superlock.test 5d7a4954b0059c903f82c7b67867bc5451a7c082 -F test/sync.test 2bd73b585089c99e76b3e1796c42059b7d89d872 +F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85 F test/syscall.test 707c95e4ab7863e13f1293c6b0c76bead30249b3 F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f -F test/table.test 04ba066432430657712d167ebf28080fe878d305 +F test/table.test 50c47f5fe9c112e92723af27cd735e6c92de6f85 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3 F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c -F test/temptable.test 1a21a597055dcf6002b6f1ee867632dccd6e925c -F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05 -F test/tester.tcl aad52c7644513e5650f6613d371b0af3193c3885 +F test/temptable.test 51edd31c65ed1560dd600b1796e8325df96318e2 +F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d +F test/tester.tcl 0b2999b578964297663de4870babbbee29225622 F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f -F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db -F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca +F test/thread002.test 716631b06cccf33b368ab7f6dd3cad92907b8928 +F test/thread003.test 33d2d46e6a53ccb2ff8dc4d0c4e3b3aaee36dcd1 F test/thread004.test f51dfc3936184aaf73ee85f315224baad272a87f -F test/thread005.test bf5c374ca65dd89fd56c8fe511ccfb46875bda5e +F test/thread005.test 50d10b5684399676174bd96c94ad4250b1a2c8b6 F test/thread1.test df115faa10a4ba1d456e9d4d9ec165016903eae4 F test/thread2.test f35d2106452b77523b3a2b7d1dcde2e5ee8f9e46 F test/thread_common.tcl 334639cadcb9f912bf82aa73f49efd5282e6cadd @@ -710,7 +710,7 @@ F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9 F test/threadtest3.c 0ed13e09690f6204d7455fac3b0e8ece490f6eef F test/tkt-02a8e81d44.test 58494de77be2cf249228ada3f313fa399821c6ab F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660 -F test/tkt-2d1a5c67d.test 73574c758502bf23260c17f97fcd9316dfb5a060 +F test/tkt-2d1a5c67d.test b028a811049eb472cb2d3a43fc8ce4f6894eebda F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28 F test/tkt-31338dca7e.test 5741cd48de500347a437ba1be58c8335e83c5a5e F test/tkt-313723c356.test c47f8a9330523e6f35698bf4489bcb29609b53ac @@ -721,7 +721,7 @@ F test/tkt-4a03edc4c8.test 2865e4edbc075b954daa82f8da7cc973033ec76e F test/tkt-54844eea3f.test a12b851128f46a695e4e378cca67409b9b8f5894 F test/tkt-5d863f876e.test 884072c2de496ddbb90c387c9ebc0d4f44a91b8e F test/tkt-5e10420e8d.test 904d1687b3c06d43e5b3555bbcf6802e7c0ffd84 -F test/tkt-5ee23731f.test 3581260f2a71e51db94e1506ba6b0f7311d002a9 +F test/tkt-5ee23731f.test 9db6e1d7209dc0794948b260d6f82b2b1de83a9f F test/tkt-752e1646fc.test ea78d88d14fe9866bdd991c634483334639e13bf F test/tkt-78e04e52ea.test ab52f0c1e2de6e46c910f4cc16b086bba05952b7 F test/tkt-80ba201079.test a09684db1a0bd55b8838f606adccee456a51ddbf @@ -736,7 +736,7 @@ F test/tkt-bd484a090c.test 60460bf946f79a79712b71f202eda501ca99b898 F test/tkt-cbd054fa6b.test f14f97ea43662e6f70c9e63287081e8be5d9d589 F test/tkt-d11f09d36e.test fb44f7961aa6d4b632fb7b9768239832210b5fc7 F test/tkt-d82e3f3721.test 731359dfdcdb36fea0559cd33fec39dd0ceae8e6 -F test/tkt-f3e5abed55.test 19fb59268da6f20a69a181b9c14154132d1c65e3 +F test/tkt-f3e5abed55.test 669bb076f2ac573c7398ce00f40cd0ca502043a9 F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87 F test/tkt-f7b4edec.test d998a08ff2b18b7f62edce8e3044317c45efe6c7 F test/tkt-f973c7ac31.test 1da0ed15ec2c7749fb5ce2828cd69d07153ad9f4 @@ -753,8 +753,8 @@ F test/tkt1536.test 83ff7a7b6e248016f8d682d4f7a4ae114070d466 F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808 F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f F test/tkt1644.test 80b6a2bb17885f3cf1cb886d97cdad13232bb869 -F test/tkt1667.test 5d208e8d8cbcf82a446b315774290b66b464bc5f -F test/tkt1873.test 255a002b9afdcf8b0fa3188984e2c964202340e9 +F test/tkt1667.test 4700d931ed19ea3983e8e703becb28079250b460 +F test/tkt1873.test 0e1b8c023050a430c2525179ed4022ddc7c31264 F test/tkt2141.test f543d96f50d5a5dc0bc744f7db74ea166720ce46 F test/tkt2192.test ff40157e5f42e65f844255d220fc6b290470942f F test/tkt2213.test a9702175601a57b61aba095a233b001d6f362474 @@ -768,13 +768,13 @@ F test/tkt2450.test 77ed94863f2049c1420288ddfea2d41e5e0971d6 F test/tkt2565.test 8be666e927cb207aae88188f31c331870878b650 F test/tkt2640.test 28134f5d1e05658ef182520cf0b680fa3de5211b F test/tkt2643.test 3f3ebb743da00d4fed4fcf6daed92a0e18e57813 -F test/tkt2686.test 08f0f584461bc4990376936daa0a9bd3e6e81671 +F test/tkt2686.test 6ee01c9b9e9c48f6d3a1fdd553b1cc4258f903d6 F test/tkt2767.test 569000d842678f9cf2db7e0d1b27cbc9011381b0 -F test/tkt2817.test 94646b604c7dbae7058782f6582c05e200700aa9 -F test/tkt2820.test 017fdee33aaef7abc092beab6088816f1942304b +F test/tkt2817.test f31839e01f4243cff7399ef654d3af3558cb8d8d +F test/tkt2820.test 39940276b3436d125deb7d8ebeee053e4cf13213 F test/tkt2822.test a2b27a58df62d1b2e712f91dbe42ad3b7e0e77cc F test/tkt2832.test a9b0b74a02dca166a04d9e37739c414b10929caa -F test/tkt2854.test b81dc3144901b123fe5674471adf5a47ca48a7c3 +F test/tkt2854.test e432965db29e27e16f539b2ba7f502eb2ccc49af F test/tkt2920.test a8737380e4ae6424e00c0273dc12775704efbebf F test/tkt2927.test 4752868b9eeeb07a217f7f19f4cbaac98d6d086d F test/tkt2942.test c5c87d179799ca6d1fbe83c815510b87cd5ec7ce @@ -790,7 +790,7 @@ F test/tkt3357.test 77c37c6482b526fe89941ce951c22d011f5922ed F test/tkt3419.test 1bbf36d7ea03b638c15804251287c2391f5c1f6b F test/tkt3424.test 61f831bd2b071bd128fa5d00fbda57e656ca5812 F test/tkt3442.test 0adb70e9fe9cb750a702065a68ad647409dbc158 -F test/tkt3457.test edbf54b05cbe5165f00192becbd621038f1615e4 +F test/tkt3457.test eb68bb3b19c8677cff06c639ff15d206dbf17fd6 F test/tkt3461.test 228ea328a5a21e8663f80ee3d212a6ad92549a19 F test/tkt3493.test 1686cbde85f8721fc1bdc0ee72f2ef2f63139218 F test/tkt3508.test d75704db9501625c7f7deec119fcaf1696aefb7d @@ -799,7 +799,7 @@ F test/tkt3527.test ee4af96183579565987e58873a7490bc04934ffb F test/tkt3541.test 5dc257bde9bc833ab9cc6844bf170b998dbb950a F test/tkt3554.test f599967f279077bace39220cbe76085c7b423725 F test/tkt3581.test 1966b7193f1e3f14951cce8c66907ae69454e9a3 -F test/tkt35xx.test ed9721bd9eb1693b3b4d3cf2a093fa7f92af0c93 +F test/tkt35xx.test 69d038ce5898f1b64f2084b780bbab1cf9be0a25 F test/tkt3630.test 929f64852103054125200bc825c316d5f75d42f7 F test/tkt3718.test 3b59dcb5c4e7754dacd91e7fd353a61492cc402a F test/tkt3731.test 0c5f4cbffe102d43c3b2188af91a9e36348f974b @@ -830,19 +830,19 @@ F test/trace2.test 962175290996d5f06dc4402ca218bbfc7df4cb20 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6 F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22 F test/trans3.test d728abaa318ca364dc370e06576aa7e5fbed7e97 -F test/trigger1.test 2e18561f85e448bb633c9c9de792e9bbf7b2dd3e +F test/trigger1.test 38c657eaf9907344c9e0bcb16af94a452c6babde F test/trigger2.test 834187beafd1db383af0c659cfa49b0576832816 F test/trigger3.test d2c60d8be271c355d61727411e753181e877230a -F test/trigger4.test 8e90ee98cba940cd5f96493f82e55083806ab8a0 +F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9 F test/trigger7.test b39e6dee1debe0ff9c2ef66326668f149f07c9c4 F test/trigger8.test 30cb0530bd7c4728055420e3f739aa00412eafa4 F test/trigger9.test 5b0789f1c5c4600961f8e68511b825b87be53e31 -F test/triggerA.test eaf11a29db2a11967d2d4b49d37f92bce598194e +F test/triggerA.test e0aaba16d3547193d36bbd82a1b0ed75e9c88d40 F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe -F test/triggerC.test 02c690febf608ae20b9af86184a9867f79855b1d -F test/triggerD.test bfdac1143deee8fb12b6a3640d76e5669a567ff6 +F test/triggerC.test 4d4bdaf0230c206b50d350330107ef9802bc2d4f +F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650 F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84 @@ -853,52 +853,52 @@ F test/unordered.test e81169ce2a8f31b2c6b66af691887e1376ab3ced F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172 F test/uri.test 53de9a2549cbda9c343223236918ef502f6a9051 F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae -F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09 -F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76 -F test/vacuum3.test f39ad1428347c5808cd2da7578c470f186a4d0ce +F test/vacuum.test 9516f3a8e49be666f2dde28561e4be5ae5612de0 +F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324 +F test/vacuum3.test 77ecdd54592b45a0bcb133339f99f1ae0ae94d0d F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 F test/veryquick.test 7701bb609fe8bf6535514e8b849a309e8f00573b -F test/view.test 45f518205ecdb6dd23a86dd4a99bb4ae945e625d -F test/vtab1.test 7b79832824cbae37ff01a06ed155027f7c15bf9e +F test/view.test b182a67ec43f490b156b5a710827a341be83dd17 +F test/vtab1.test b40b7e531dea8f0f7e78c76ff96eed103f58d015 F test/vtab2.test 7bcffc050da5c68f4f312e49e443063e2d391c0d F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1 F test/vtab4.test 942f8b8280b3ea8a41dae20e7822d065ca1cb275 F test/vtab5.test 889f444970393c73f1e077e2bdc5d845e157a391 F test/vtab6.test c7f290d172609d636fbfc58166eadcb55d5c117c -F test/vtab7.test a8c3c3cb3eb60be364991bd714e4927e26c4cd85 +F test/vtab7.test ae560ebea870ed04e9aa4177cc302f910faaabb5 F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583 F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b F test/vtabA.test c86e1990b7e1e2bb34602a06fffa4c69f2b516dc F test/vtabB.test 04df5dc531b9f44d9ca65b9c1b79f12b5922a796 -F test/vtabC.test 1cf7896ab6859bfe3074244b2b0e12de5cbdd766 +F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292 F test/vtabD.test 74167b1578e5886fe4c886d6bef2fd1406444c42 F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61 F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d -F test/wal.test 5617ad308bfdb8a8885220d8a261a6096a8d7e57 -F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782 -F test/wal3.test d512a5c8b4aa345722d11e8f1671db7eb15a0e39 -F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 +F test/wal.test e11da8d5ea8a38a247339455098357e9adf63d76 +F test/wal2.test a2caa432d056596c6ee815d2743b2ced86f67a59 +F test/wal3.test 18da4e65c30c43c646ad40e145e9a074e4062fc9 +F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c F test/wal5.test 08e145a352b1223930c7f0a1de82a8747a99c322 F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe -F test/walbak.test 4df1c7369da0301caeb9a48fa45997fd592380e4 +F test/walbak.test 53be94bccbc3f592d22a5909588ccc81b319ce83 F test/walbig.test e882bc1d014afffbfa2b6ba36e0f07d30a633ad0 -F test/walcksum.test a37b36375c595e61bdb7e1ec49b5f0979b6fc7ce -F test/walcrash.test e763841551d6b23677ccb419797c1589dcbdbaf5 +F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde +F test/walcrash.test 4fcb661faf71db91214156d52d43ee327f52bde1 F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142 -F test/walfault.test 58fce626359c9376fe35101b5c0f2df8040aa839 +F test/walfault.test efb0d5724893133e71b8d9d90abdb781845a6bb0 F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 -F test/walmode.test 22ddccd073c817ac9ead62b88ac446e8dedc7d2c -F test/walnoshm.test a074428046408f4eb5c6a00e09df8cc97ff93317 +F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c +F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496 F test/walpersist.test 45fb0c94fb63908e2d66b1d99ce4645bfce0fa1e F test/walro.test 2d5d69e2e99da19ce6faab340330234fc4ca0720 F test/walshared.test 6dda2293880c300baf5d791c307f653094585761 -F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933 -F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c +F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a +F test/walthread.test a2ed5270eb695284d4ad27d252517bdc3317ee2a F test/where.test de337a3fe0a459ec7c93db16a519657a90552330 F test/where2.test 43d4becaf5a5df854e6c21d624a1cb84c6904554 F test/where3.test 8e1175c7ef710c70502858fc4fb08d784b3620b9 @@ -953,7 +953,10 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 1b56677bdfb102d070a2057a65ba424fec81131d -R 07a1c012e85371e0cbf430cb6bbf3579 -U drh -Z 06c1fbb8b37310ceef1a2adde6978995 +P ed630b012f468d6779b83dd8c4dbf3a8dafee573 +R 735027666e11a1bb5deb1c9d66f6a810 +T *branch * winopen-retry-logic +T *sym-winopen-retry-logic * +T -sym-trunk * +U mistachkin +Z 48ff1b46b7d2b6052641cde313ef9900 diff --git a/manifest.uuid b/manifest.uuid index 313ea78ef0..04c96eaa22 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed630b012f468d6779b83dd8c4dbf3a8dafee573 \ No newline at end of file +9007586fdabed8dbcc78581ea9821cfd1f9a4c8c \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 0ca5db6b42..a006627bf9 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2191,6 +2191,7 @@ static int winOpen( winFile *pFile = (winFile*)id; void *zConverted; /* Filename in OS encoding */ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ + int cnt = 0; /* If argument zPath is a NULL pointer, this function is required to open ** a temporary file. Use this buffer to store the file name in. @@ -2310,31 +2311,31 @@ static int winOpen( #endif if( isNT() ){ - h = CreateFileW((WCHAR*)zConverted, - dwDesiredAccess, - dwShareMode, - NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL - ); + while( (h = CreateFileW((WCHAR*)zConverted, + dwDesiredAccess, + dwShareMode, NULL, + dwCreationDisposition, + dwFlagsAndAttributes, + NULL))==INVALID_HANDLE_VALUE && + retryIoerr(&cnt) ){} /* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. ** Since the ASCII version of these Windows API do not exist for WINCE, ** it's important to not reference them for WINCE builds. */ #if SQLITE_OS_WINCE==0 }else{ - h = CreateFileA((char*)zConverted, - dwDesiredAccess, - dwShareMode, - NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL - ); + while( (h = CreateFileA((char*)zConverted, + dwDesiredAccess, + dwShareMode, NULL, + dwCreationDisposition, + dwFlagsAndAttributes, + NULL))==INVALID_HANDLE_VALUE && + retryIoerr(&cnt) ){} #endif } + logIoerr(cnt); + OSTRACE(("OPEN %d %s 0x%lx %s\n", h, zName, dwDesiredAccess, h==INVALID_HANDLE_VALUE ? "failed" : "ok")); diff --git a/test/8_3_names.test b/test/8_3_names.test index 418685e64b..b53e28a92a 100644 --- a/test/8_3_names.test +++ b/test/8_3_names.test @@ -67,8 +67,8 @@ do_test 8_3_names-2.1 { file exists test.nal } 1 forcedelete test2.db test2.nal test2.db-journal -file copy test.db test2.db -file copy test.nal test2.nal +copy_file test.db test2.db +copy_file test.nal test2.nal do_test 8_3_names-2.2 { db eval { COMMIT; @@ -101,8 +101,8 @@ do_test 8_3_names-3.1 { file exists test.nal } 0 forcedelete test2.db test2.nal test2.db-journal -file copy test.db test2.db -file copy test.db-journal test2.db-journal +copy_file test.db test2.db +copy_file test.db-journal test2.db-journal do_test 8_3_names-3.2 { db eval { COMMIT; diff --git a/test/alter.test b/test/alter.test index 359034d5aa..4d5a484b2e 100644 --- a/test/alter.test +++ b/test/alter.test @@ -221,8 +221,8 @@ do_test alter-1.7 { # ifcapable attach { do_test alter-1.8.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' AS aux; } @@ -412,8 +412,8 @@ do_test alter-3.1.8 { # Make sure "ON" cannot be used as a database, table or column name without # quoting. Otherwise the sqlite_alter_trigger() function might not work. -file delete -force test3.db -file delete -force test3.db-journal +forcedelete test3.db +forcedelete test3.db-journal ifcapable attach { do_test alter-3.2.1 { catchsql { diff --git a/test/alter2.test b/test/alter2.test index 66b1950945..14be637f97 100644 --- a/test/alter2.test +++ b/test/alter2.test @@ -315,8 +315,8 @@ do_test alter2-6.1 { } {2} ifcapable attach { do_test alter2-6.2 { - file delete -force test2.db-journal - file delete -force test2.db + forcedelete test2.db-journal + forcedelete test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b); diff --git a/test/alter3.test b/test/alter3.test index 74ba33c5e1..28d293e24b 100644 --- a/test/alter3.test +++ b/test/alter3.test @@ -196,7 +196,7 @@ ifcapable schema_version { do_test alter3-4.1 { db close - file delete -force test.db + forcedelete test.db set ::DB [sqlite3 db test.db] execsql { PRAGMA legacy_file_format=ON; @@ -237,8 +237,8 @@ do_test alter3-4.99 { ifcapable attach { do_test alter3-5.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 'one'); diff --git a/test/alter4.test b/test/alter4.test index 738db3fd3b..cda45533c6 100644 --- a/test/alter4.test +++ b/test/alter4.test @@ -178,7 +178,7 @@ ifcapable schema_version { do_test alter4-4.1 { db close - file delete -force test.db + forcedelete test.db set ::DB [sqlite3 db test.db] execsql { CREATE TEMP TABLE t1(a, b); @@ -213,8 +213,8 @@ do_test alter4-4.99 { ifcapable attach { do_test alter4-5.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { CREATE TEMP TABLE t1(a, b); INSERT INTO t1 VALUES(1, 'one'); diff --git a/test/async.test b/test/async.test index f1d641da7a..e1bc08642e 100644 --- a/test/async.test +++ b/test/async.test @@ -68,7 +68,7 @@ foreach testfile [lsort -dictionary [glob $testdir/*.test]] { # Make sure everything is flushed through. This is because [source]ing # the next test file will delete the database file on disk (using - # [file delete]). If the asynchronous backend still has the file + # [delete_file]). If the asynchronous backend still has the file # open, it will become confused. # flush_async_queue diff --git a/test/async2.test b/test/async2.test index ec4ae308d7..7994a7219d 100644 --- a/test/async2.test +++ b/test/async2.test @@ -51,7 +51,7 @@ foreach err [list ioerr malloc-transient malloc-persistent] { for {set n 1} {$::go} {incr n} { set ::sqlite_io_error_pending 0 sqlite3_memdebug_fail -1 - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql $::setup_script db close diff --git a/test/async3.test b/test/async3.test index 77c4d55d49..9336b66058 100644 --- a/test/async3.test +++ b/test/async3.test @@ -41,8 +41,8 @@ set paths { do_test async3-1.0 { file mkdir [file join chocolate banana vanilla] - file delete -force chocolate/banana/vanilla/file.db - file delete -force chocolate/banana/vanilla/file.db-journal + forcedelete chocolate/banana/vanilla/file.db + forcedelete chocolate/banana/vanilla/file.db-journal } {} do_test async3-1.1 { diff --git a/test/async5.test b/test/async5.test index 5ea4c70ec9..aa484fccb3 100644 --- a/test/async5.test +++ b/test/async5.test @@ -20,7 +20,7 @@ if {[info commands sqlite3async_initialize] eq ""} { } db close -file delete -force test2.db +forcedelete test2.db sqlite3async_initialize "" 1 sqlite3async_control halt never sqlite3 db test.db diff --git a/test/attach.test b/test/attach.test index 1bb596cb90..d57f5bfb52 100644 --- a/test/attach.test +++ b/test/attach.test @@ -24,8 +24,8 @@ ifcapable !attach { } for {set i 2} {$i<=15} {incr i} { - file delete -force test$i.db - file delete -force test$i.db-journal + forcedelete test$i.db + forcedelete test$i.db-journal } do_test attach-1.1 { @@ -628,7 +628,7 @@ do_test attach-5.1 { db close sqlite3 db test.db db2 close - file delete -force test2.db + forcedelete test2.db sqlite3 db2 test2.db catchsql { ATTACH DATABASE 'test.db' AS orig; @@ -725,7 +725,7 @@ if {$tcl_platform(platform)=="unix"} { file attributes cannot-read -permission 0000 if {[file writable cannot-read]} { puts "\n**** Tests do not work when run as root ****" - file delete -force cannot-read + forcedelete cannot-read exit 1 } catchsql { @@ -735,7 +735,7 @@ if {$tcl_platform(platform)=="unix"} { do_test attach-6.2.2 { db errorcode } {14} - file delete -force cannot-read + forcedelete cannot-read } # Check the error message if we try to access a database that has @@ -749,12 +749,12 @@ for {set i 2} {$i<=15} {incr i} { catch {db$i close} } db close -file delete -force test2.db -file delete -force no-such-file +forcedelete test2.db +forcedelete no-such-file ifcapable subquery { do_test attach-7.1 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db catchsql { DETACH RAISE ( IGNORE ) IN ( SELECT "AAAAAA" . * ORDER BY @@ -777,7 +777,7 @@ do_test attach-8.1 { do_test attach-8.2 { db errorcode } {26} -file delete -force test2.db +forcedelete test2.db do_test attach-8.3 { sqlite3 db2 test2.db db2 eval {CREATE TABLE t1(x); BEGIN EXCLUSIVE} @@ -789,13 +789,13 @@ do_test attach-8.4 { db errorcode } {5} db2 close -file delete -force test2.db +forcedelete test2.db # Test that it is possible to attach the same database more than # once when not in shared-cache mode. That this is not possible in # shared-cache mode is tested in shared7.test. do_test attach-9.1 { - file delete -force test4.db + forcedelete test4.db execsql { ATTACH 'test4.db' AS aux1; CREATE TABLE aux1.t1(a, b); diff --git a/test/attach2.test b/test/attach2.test index 3cc5af961b..db230723ab 100644 --- a/test/attach2.test +++ b/test/attach2.test @@ -33,8 +33,8 @@ do_test attach2-1.1 { CREATE TABLE t1(a,b); CREATE INDEX x1 ON t1(a); } - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal sqlite3 db2 test2.db db2 eval { CREATE TABLE t1(a,b); @@ -327,7 +327,7 @@ do_test attach2-4.15 { db close db2 close -file delete -force test2.db +forcedelete test2.db sqlite3_soft_heap_limit $soft_limit # These tests - attach2-5.* - check that the master journal file is deleted @@ -335,7 +335,7 @@ sqlite3_soft_heap_limit $soft_limit # # Update: It's not actually created if a rollback occurs, so that test # doesn't really prove too much. -foreach f [glob test.db*] {file delete -force $f} +foreach f [glob test.db*] {forcedelete $f} do_test attach2-5.1 { sqlite3 db test.db execsql { diff --git a/test/attach3.test b/test/attach3.test index 36d39991bd..f861425346 100644 --- a/test/attach3.test +++ b/test/attach3.test @@ -35,8 +35,8 @@ execsql { } # Create tables t1 and t2 in database file test2.db -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db2 test2.db execsql { CREATE TABLE t1(a, b); diff --git a/test/attachmalloc.test b/test/attachmalloc.test index c485c618bd..7fee1e1b2a 100644 --- a/test/attachmalloc.test +++ b/test/attachmalloc.test @@ -29,8 +29,8 @@ do_malloc_test attachmalloc-1 -tclprep { catch { db close } for {set i 2} {$i<=4} {incr i} { catch { db$i close } - file delete -force test$i.db - file delete -force test$i.db-journal + forcedelete test$i.db + forcedelete test$i.db-journal } } -tclbody { if {[catch {sqlite3 db test.db}]} { @@ -48,8 +48,8 @@ do_malloc_test attachmalloc-1 -tclprep { } do_malloc_test attachmalloc-2 -tclprep { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal sqlite3 db2 test2.db db2 eval { CREATE TABLE t1(a, b, c); diff --git a/test/autoinc.test b/test/autoinc.test index 983b9b8321..98f6919b03 100644 --- a/test/autoinc.test +++ b/test/autoinc.test @@ -427,8 +427,8 @@ ifcapable tempdb { # ifcapable tempdb&&attach { do_test autoinc-5.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal sqlite3 db2 test2.db execsql { CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n); @@ -520,7 +520,7 @@ do_test autoinc-7.2 { do_test autoinc-8.1 { catch {db2 close} catch {db close} - file delete -force test.db + forcedelete test.db sqlite3 db test.db set DB [sqlite3_connection_pointer db] set STMT [sqlite3_prepare $DB { diff --git a/test/autovacuum.test b/test/autovacuum.test index 57dfd52df1..1aef18f33e 100644 --- a/test/autovacuum.test +++ b/test/autovacuum.test @@ -467,7 +467,7 @@ do_test autovacuum-3.3 { do_test autovacuum-3.4 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { PRAGMA auto_vacuum; @@ -502,7 +502,7 @@ do_test autovacuum-4.0 { # Reset everything just in case. # db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA auto_vacuum = 1; @@ -599,8 +599,8 @@ do_test autovacuum-6.1 { # do_test autovacuum-7.1 { db close - file delete -force test.db - file delete -force test.db-journal + forcedelete test.db + forcedelete test.db-journal sqlite3 db test.db execsql { diff --git a/test/autovacuum_ioerr2.test b/test/autovacuum_ioerr2.test index dadb29c0c5..891d00eb06 100644 --- a/test/autovacuum_ioerr2.test +++ b/test/autovacuum_ioerr2.test @@ -75,7 +75,7 @@ do_ioerr_test autovacuum-ioerr2-3 -sqlprep { DROP TABLE abc2; } -file delete -force backup.db +forcedelete backup.db ifcapable subquery { do_ioerr_test autovacuum-ioerr2-4 -tclprep { if {![file exists backup.db]} { @@ -99,9 +99,9 @@ ifcapable subquery { dbb close } db close - file delete -force test.db - file delete -force test.db-journal - copy_file backup.db test.db + forcedelete test.db + forcedelete test.db-journal + forcecopy backup.db test.db set ::DB [sqlite3 db test.db] execsql { PRAGMA cache_size = 10; diff --git a/test/backcompat.test b/test/backcompat.test index fa643f9b76..e8e2f61581 100644 --- a/test/backcompat.test +++ b/test/backcompat.test @@ -61,7 +61,7 @@ foreach bin $binaries { proc do_backcompat_test {rv bin1 bin2 script} { - file delete -force test.db + forcedelete test.db if {$bin1 != ""} { set ::bc_chan1 [launch_testfixture $bin1] } set ::bc_chan2 [launch_testfixture $bin2] @@ -152,7 +152,7 @@ proc read_file_system {} { proc write_file_system {data} { foreach f {test.db test.db-journal test.db-wal} d $data { if {[string length $d] == 0} { - file delete -force $f + forcedelete $f } else { write_file $f $d } diff --git a/test/backup.test b/test/backup.test index 0e2c26f33b..62698857b4 100644 --- a/test/backup.test +++ b/test/backup.test @@ -73,7 +73,7 @@ test_contents backup-1.2 db main db main # Check that it is possible to create and finish backup operations. # do_test backup-1.3.1 { - file delete test2.db + delete_file test2.db sqlite3 db2 test2.db sqlite3_backup B db2 main db main } {B} @@ -168,8 +168,8 @@ foreach pgsz_dest {512 1024 2048} { foreach nPagePerStep {1 200} { # Open the databases. - catch { file delete test.db } - catch { file delete test2.db } + catch { delete_file test.db } + catch { delete_file test2.db } eval $zOpenScript # Set to true if copying to an in-memory destination. Copying to an @@ -279,8 +279,8 @@ foreach nSrcPg {10 64 65 66 100} { foreach nDestRow {10 100} { foreach nDestPgsz {512 1024 2048 4096} { - catch { file delete test.db } - catch { file delete test2.db } + catch { delete_file test.db } + catch { delete_file test2.db } sqlite3 db test.db sqlite3 db2 test2.db @@ -327,8 +327,8 @@ foreach nDestPgsz {512 1024 2048 4096} { #-------------------------------------------------------------------- do_test backup-3.$iTest.1 { - catch { file delete -force test.db } - catch { file delete -force test2.db } + catch { forcedelete test.db } + catch { forcedelete test2.db } sqlite3 db test.db set iTab 1 @@ -392,8 +392,8 @@ do_test backup-4.1.4 { } {unknown database aux} do_test backup-4.2.1 { - catch { file delete -force test3.db } - catch { file delete -force test4.db } + catch { forcedelete test3.db } + catch { forcedelete test4.db } execsql { ATTACH 'test3.db' AS aux1; CREATE TABLE aux1.t1(a, b); @@ -439,7 +439,7 @@ db close db2 close do_test backup-4.5.1 { - catch { file delete -force test.db } + catch { forcedelete test.db } sqlite3 db test.db sqlite3 db2 :memory: execsql { @@ -491,12 +491,12 @@ db2 close # 3) Backing up memory-to-file. # set iTest 0 -file delete -force bak.db-wal +forcedelete bak.db-wal foreach {writer file} {db test.db db3 test.db db :memory:} { incr iTest - catch { file delete bak.db } + catch { delete_file bak.db } sqlite3 db2 bak.db - catch { file delete $file } + catch { delete_file $file } sqlite3 db $file sqlite3 db3 $file @@ -597,9 +597,9 @@ foreach {writer file} {db test.db db3 test.db db :memory:} { catch {db close} catch {db2 close} catch {db3 close} - catch { file delete bak.db } + catch { delete_file bak.db } sqlite3 db2 bak.db - catch { file delete $file } + catch { delete_file $file } sqlite3 db $file sqlite3 db3 $file do_test backup-5.$iTest.5.1 { @@ -644,8 +644,8 @@ foreach {writer file} {db test.db db3 test.db db :memory:} { # Test the sqlite3_backup_remaining() and backup_pagecount() APIs. # do_test backup-6.1 { - catch { file delete -force test.db } - catch { file delete -force test2.db } + catch { forcedelete test.db } + catch { forcedelete test2.db } sqlite3 db test.db sqlite3 db2 test2.db execsql { @@ -701,8 +701,8 @@ catch {db2 close} # backup-7.3.*: Destination database is externally locked (return SQLITE_BUSY). # do_test backup-7.0 { - catch { file delete -force test.db } - catch { file delete -force test2.db } + catch { forcedelete test.db } + catch { forcedelete test2.db } sqlite3 db2 test2.db sqlite3 db test.db execsql { @@ -754,7 +754,7 @@ integrity_check backup-7.3.6 db2 do_test backup-7.3.1 { db2 close db3 close - file delete -force test2.db + forcedelete test2.db sqlite3 db2 test2.db sqlite3 db3 test2.db @@ -783,8 +783,8 @@ catch { db3 close } # These tests reuse the database "test.db" left over from backup-7.*. # do_test backup-8.1 { - catch { file delete -force test2.db } - catch { file delete -force test3.db } + catch { forcedelete test2.db } + catch { forcedelete test3.db } sqlite3 db2 test2.db sqlite3 db3 test3.db @@ -865,8 +865,8 @@ catch {db2 close} ifcapable memorymanage { db close - file delete -force test.db - file delete -force bak.db + forcedelete test.db + forcedelete bak.db sqlite3 db test.db sqlite3 db2 test.db @@ -918,7 +918,7 @@ ifcapable memorymanage { # 10.2.*: If the db is a file, the backup is not restarted. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal foreach {tn file rc} { 1 test.db SQLITE_DONE 2 :memory: SQLITE_OK @@ -948,7 +948,7 @@ foreach {tn file rc} { } {1} do_test backup-10.$tn.3 { - file delete -force bak.db bak.db-journal + forcedelete bak.db bak.db-journal sqlite3 db2 bak.db sqlite3_backup B db2 main db main B step 50 diff --git a/test/backup2.test b/test/backup2.test index 749c460e4a..34924b02c8 100644 --- a/test/backup2.test +++ b/test/backup2.test @@ -61,7 +61,7 @@ set cksum [dbcksum db main] # is identical to the original. # do_test backup2-2 { - file delete -force bu1.db + forcedelete bu1.db db backup bu1.db sqlite3 db2 bu1.db dbcksum db2 main @@ -72,7 +72,7 @@ do_test backup2-2 { # do_test backup2-3.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db2 eval {BEGIN EXCLUSIVE} set rc [catch {db restore bu1.db} res] @@ -82,7 +82,7 @@ do_test backup2-3.1 { } {1 {restore failed: source database busy}} do_test backup2-3.2 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db restore bu1.db dbcksum db main @@ -96,7 +96,7 @@ do_test backup2-4 { } $cksum do_test backup2-5 { db2 close - file delete -force bu1.db bu2.db + forcedelete bu1.db bu2.db db backup temp bu2.db sqlite3 db2 bu2.db dbcksum db2 main @@ -127,7 +127,7 @@ do_test backup2-7 { # Try to backup database that does not exist # do_test backup2-8 { - file delete -force bu1.db + forcedelete bu1.db set rc [catch {db backup aux1 bu1.db} res] lappend rc $res } {1 {backup failed: unknown database aux1}} @@ -143,7 +143,7 @@ do_test backup2-9 { # if {$tcl_platform(platform)=="windows"} { do_test backup2-10 { - file delete -force bu3.db + forcedelete bu3.db file mkdir bu3.db set rc [catch {db restore temp bu3.db} res] lappend rc $res @@ -151,7 +151,7 @@ if {$tcl_platform(platform)=="windows"} { } if {$tcl_platform(platform)!="windows"} { do_test backup2-10 { - file delete -force bu3.db + forcedelete bu3.db file mkdir bu3.db set rc [catch {db restore temp bu3.db} res] lappend rc $res @@ -172,7 +172,7 @@ do_test backup2-12 { lappend rc $res } {1 {restore failed: unknown database aux1}} do_test backup2-13 { - file delete -force bu4.db + forcedelete bu4.db set rc [catch {db restore bu4.db} res] lappend rc $res } {1 {cannot open source database: unable to open database file}} @@ -184,6 +184,6 @@ do_test backup2-14 { lappend rc $res } {1 {wrong # args: should be "db restore ?DATABASE? FILENAME"}} -file delete -force bu1.db bu2.db bu3.db bu4.db +forcedelete bu1.db bu2.db bu3.db bu4.db finish_test diff --git a/test/backup_ioerr.test b/test/backup_ioerr.test index 3b5e95df50..313cff3da9 100644 --- a/test/backup_ioerr.test +++ b/test/backup_ioerr.test @@ -60,7 +60,7 @@ do_test backup_ioerr-1.2 { } {1} do_test backup_ioerr-1.3 { db close - file delete -force test.db + forcedelete test.db } {} # Turn off IO error simulation. @@ -155,8 +155,8 @@ for {set iError 1} {$bStop == 0} {incr iError} { catch { ddb close } catch { sdb close } - catch { file delete -force test.db } - catch { file delete -force bak.db } + catch { forcedelete test.db } + catch { forcedelete bak.db } # Open the source and destination databases. sqlite3 sdb test.db diff --git a/test/capi3.test b/test/capi3.test index cc1461a7ee..cbba04cd84 100644 --- a/test/capi3.test +++ b/test/capi3.test @@ -697,7 +697,7 @@ if {![sqlite3 -has-codec]} { # Now test that the library correctly handles bogus entries in the # sqlite_master table (schema corruption). do_test capi3-8.1 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); @@ -722,7 +722,7 @@ if {![sqlite3 -has-codec]} { # Build a 5-field row record. The first field is a string 'table', and # subsequent fields are all NULL. db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); @@ -739,8 +739,8 @@ if {![sqlite3 -has-codec]} { } {1 {malformed database schema (?)}} db close } -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal # Test the english language string equivalents for sqlite error codes diff --git a/test/capi3c.test b/test/capi3c.test index af9794380f..c1d5510bd8 100644 --- a/test/capi3c.test +++ b/test/capi3c.test @@ -670,7 +670,7 @@ if {![sqlite3 -has-codec]} { # Now test that the library correctly handles bogus entries in the # sqlite_master table (schema corruption). do_test capi3c-8.1 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); @@ -695,7 +695,7 @@ if {![sqlite3 -has-codec]} { # Build a 5-field row record. The first field is a string 'table', and # subsequent fields are all NULL. db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { CREATE TABLE t1(a); @@ -712,8 +712,8 @@ if {![sqlite3 -has-codec]} { } {1 {malformed database schema (?)}} db close } -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal # Test the english language string equivalents for sqlite error codes diff --git a/test/collate7.test b/test/collate7.test index 22b67310f6..da97491ece 100644 --- a/test/collate7.test +++ b/test/collate7.test @@ -44,7 +44,7 @@ do_test collate7-1.4 { } {2} do_test collate7-2.1 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db sqlite3_create_collation_v2 db CASELESS caseless_cmp {incr ::caseless_del} execsql { diff --git a/test/corrupt.test b/test/corrupt.test index 719c19ccb9..09f3c5bd7c 100644 --- a/test/corrupt.test +++ b/test/corrupt.test @@ -15,7 +15,7 @@ # # $Id: corrupt.test,v 1.12 2009/07/13 09:41:45 danielk1977 Exp $ -catch {file delete -force test.db test.db-journal test.bu} +catch {forcedelete test.db test.db-journal test.bu} set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -51,22 +51,10 @@ do_test corrupt-1.1 { } {} integrity_check corrupt-1.2 -# Copy file $from into $to -# -proc copy_file {from to} { - set f [open $from] - fconfigure $f -translation binary - set t [open $to w] - fconfigure $t -translation binary - puts -nonewline $t [read $f [file size $from]] - close $t - close $f -} - # Setup for the tests. Make a backup copy of the good database in test.bu. # Create a string of garbage data that is 256 bytes long. # -copy_file test.db test.bu +forcecopy test.db test.bu set fsize [file size test.db] set junk "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" while {[string length $junk]<256} {append junk $junk} @@ -79,7 +67,7 @@ set junk [string range $junk 0 255] for {set i [expr {1*256}]} {$i<$fsize-256} {incr i 256} { set tn [expr {$i/256}] db close - copy_file test.bu test.db + forcecopy test.bu test.db set fd [open test.db r+] fconfigure $fd -translation binary seek $fd $i @@ -132,7 +120,7 @@ for {set i [expr {1*256}]} {$i<$fsize-256} {incr i 256} { # do_test corrupt-3.1 { db close - copy_file test.bu test.db + forcecopy test.bu test.db sqlite3 db test.db list } {} @@ -181,7 +169,7 @@ do_test corrupt-3.6 { do_test corrupt-4.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA page_size = 1024; @@ -213,7 +201,7 @@ do_test corrupt-4.2 { do_test corrupt-5.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA page_size = 1024 } @@ -236,7 +224,7 @@ do_test corrupt-5.2 { # running this testcase under valgrind revealed the problem. do_test corrupt-6.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA page_size = 1024; CREATE TABLE t1(x); @@ -264,7 +252,7 @@ do_test corrupt-6.1 { ifcapable oversize_cell_check { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA page_size = 1024; CREATE TABLE t1(x); @@ -317,7 +305,7 @@ ifcapable oversize_cell_check { } db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal do_test corrupt-8.1 { sqlite3 db test.db execsql { @@ -335,7 +323,7 @@ do_test corrupt-8.1 { } {1 {database disk image is malformed}} db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal do_test corrupt-8.2 { sqlite3 db test.db execsql { diff --git a/test/corrupt2.test b/test/corrupt2.test index bdbc0165f4..744a76ed04 100644 --- a/test/corrupt2.test +++ b/test/corrupt2.test @@ -41,9 +41,9 @@ do_test corrupt2-1.1 { do_test corrupt2-1.2 { # Corrupt the 16 byte magic string at the start of the file - file delete -force corrupt.db - file delete -force corrupt.db-journal - copy_file test.db corrupt.db + forcedelete corrupt.db + forcedelete corrupt.db-journal + forcecopy test.db corrupt.db set f [open corrupt.db RDWR] seek $f 8 start puts $f blah @@ -60,9 +60,9 @@ do_test corrupt2-1.3 { db2 close # Corrupt the page-size (bytes 16 and 17 of page 1). - file delete -force corrupt.db - file delete -force corrupt.db-journal - copy_file test.db corrupt.db + forcedelete corrupt.db + forcedelete corrupt.db-journal + forcecopy test.db corrupt.db set f [open corrupt.db RDWR] fconfigure $f -encoding binary seek $f 16 start @@ -80,9 +80,9 @@ do_test corrupt2-1.4 { db2 close # Corrupt the free-block list on page 1. - file delete -force corrupt.db - file delete -force corrupt.db-journal - copy_file test.db corrupt.db + forcedelete corrupt.db + forcedelete corrupt.db-journal + forcecopy test.db corrupt.db set f [open corrupt.db RDWR] fconfigure $f -encoding binary seek $f 101 start @@ -100,9 +100,9 @@ do_test corrupt2-1.5 { db2 close # Corrupt the free-block list on page 1. - file delete -force corrupt.db - file delete -force corrupt.db-journal - copy_file test.db corrupt.db + forcedelete corrupt.db + forcedelete corrupt.db-journal + forcecopy test.db corrupt.db set f [open corrupt.db RDWR] fconfigure $f -encoding binary seek $f 101 start @@ -123,9 +123,9 @@ db2 close # Corrupt a database by having 2 indices of the same name: do_test corrupt2-2.1 { - file delete -force corrupt.db - file delete -force corrupt.db-journal - copy_file test.db corrupt.db + forcedelete corrupt.db + forcedelete corrupt.db-journal + forcecopy test.db corrupt.db sqlite3 db2 corrupt.db execsql " @@ -150,8 +150,8 @@ do_test corrupt2-2.1 { db2 close do_test corrupt2-3.1 { - file delete -force corrupt.db - file delete -force corrupt.db-journal + forcedelete corrupt.db + forcedelete corrupt.db-journal sqlite3 db2 corrupt.db execsql " @@ -200,8 +200,8 @@ db2 close unset -nocomplain result do_test corrupt2-5.1 { - file delete -force corrupt.db - file delete -force corrupt.db-journal + forcedelete corrupt.db + forcedelete corrupt.db-journal sqlite3 db2 corrupt.db execsql " @@ -257,8 +257,8 @@ proc corruption_test {args} { array set A $args catch {db close} - file delete -force corrupt.db - file delete -force corrupt.db-journal + forcedelete corrupt.db + forcedelete corrupt.db-journal sqlite3 db corrupt.db db eval $::presql diff --git a/test/corrupt9.test b/test/corrupt9.test index f083cf247a..f199452f95 100644 --- a/test/corrupt9.test +++ b/test/corrupt9.test @@ -86,7 +86,7 @@ integrity_check corrupt9-1.2 # Make sure the corruption is detected. # db close -file copy -force test.db test.db-template +forcecopy test.db test.db-template corrupt_freelist test.db 1 sqlite3 db test.db @@ -103,7 +103,7 @@ do_test corrupt9-2.2 { db close -file copy -force test.db-template test.db +forcecopy test.db-template test.db corrupt_freelist test.db 2 sqlite3 db test.db do_test corrupt9-3.1 { @@ -118,7 +118,7 @@ do_test corrupt9-3.2 { } {1 {database disk image is malformed}} db close -file copy -force test.db-template test.db +forcecopy test.db-template test.db corrupt_freelist test.db 3 sqlite3 db test.db do_test corrupt9-4.1 { diff --git a/test/corruptA.test b/test/corruptA.test index 9c7d228f4a..8b76d3a201 100644 --- a/test/corruptA.test +++ b/test/corruptA.test @@ -40,12 +40,12 @@ integrity_check corruptA-1.2 # is detected when opening the database file. # db close -file copy -force test.db test.db-template +forcecopy test.db test.db-template set unreadable_version 02 ifcapable wal { set unreadable_version 03 } do_test corruptA-2.1 { - file copy -force test.db-template test.db + forcecopy test.db-template test.db hexio_write test.db 19 $unreadable_version ;# the read format number sqlite3 db test.db catchsql {SELECT * FROM t1} @@ -53,7 +53,7 @@ do_test corruptA-2.1 { do_test corruptA-2.2 { db close - file copy -force test.db-template test.db + forcecopy test.db-template test.db hexio_write test.db 21 41 ;# max embedded payload fraction sqlite3 db test.db catchsql {SELECT * FROM t1} @@ -61,7 +61,7 @@ do_test corruptA-2.2 { do_test corruptA-2.3 { db close - file copy -force test.db-template test.db + forcecopy test.db-template test.db hexio_write test.db 22 1f ;# min embedded payload fraction sqlite3 db test.db catchsql {SELECT * FROM t1} @@ -69,7 +69,7 @@ do_test corruptA-2.3 { do_test corruptA-2.4 { db close - file copy -force test.db-template test.db + forcecopy test.db-template test.db hexio_write test.db 23 21 ;# min leaf payload fraction sqlite3 db test.db catchsql {SELECT * FROM t1} diff --git a/test/corruptB.test b/test/corruptB.test index 4aa1d010ce..0ff2d6e9e0 100644 --- a/test/corruptB.test +++ b/test/corruptB.test @@ -46,7 +46,7 @@ do_test corruptB-1.1 { } {1} integrity_check corruptB-1.2 -file copy -force test.db bak.db +forcecopy test.db bak.db # Set the right-child of a B-Tree rootpage to refer to the root-page itself. # @@ -65,7 +65,7 @@ do_test corruptB-1.3.2 { # do_test corruptB-1.4.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db set cell_offset [hexio_get_int [hexio_read test.db [expr $offset+12] 2]] hexio_write test.db [expr $offset+$cell_offset] [hexio_render_int32 $::root] } {4} @@ -78,7 +78,7 @@ do_test corruptB-1.4.2 { # do_test corruptB-1.5.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db sqlite3 db test.db execsql { INSERT INTO t1 SELECT randomblob(200) FROM t1; @@ -91,7 +91,7 @@ do_test corruptB-1.5.1 { } } {} -file copy -force test.db bak.db +forcecopy test.db bak.db # Set the right-child pointer of the right-child of the root page to point # back to the root page. @@ -112,7 +112,7 @@ do_test corruptB-1.6.2 { # do_test corruptB-1.7.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db set cell_offset [hexio_get_int [hexio_read test.db [expr $c_offset+12] 2]] hexio_write test.db [expr $c_offset+$cell_offset] [hexio_render_int32 $::root] } {4} @@ -140,7 +140,7 @@ do_test corruptB-1.8.2 { # do_test corruptB-1.9.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db set cell_offset [hexio_get_int [hexio_read test.db [expr $c_offset+12] 2]] hexio_write test.db [expr $c_offset+$cell_offset] [hexio_render_int32 $::root] } {4} @@ -153,7 +153,7 @@ do_test corruptB-1.9.2 { do_test corruptB-2.1.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db hexio_write test.db [expr $offset+8] [hexio_render_int32 0x6FFFFFFF] } {4} do_test corruptB-2.1.2 { @@ -167,7 +167,7 @@ do_test corruptB-2.1.2 { # do_test corruptB-3.1.1 { db close - file copy -force bak.db test.db + forcecopy bak.db test.db sqlite3 db test.db set v [string repeat abcdefghij 200] execsql { diff --git a/test/corruptC.test b/test/corruptC.test index 0580426388..34e81a1be8 100644 --- a/test/corruptC.test +++ b/test/corruptC.test @@ -17,7 +17,7 @@ # # $Id: corruptC.test,v 1.14 2009/07/11 06:55:34 danielk1977 Exp $ -catch {file delete -force test.db test.db-journal test.bu} +catch {forcedelete test.db test.db-journal test.bu} set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -58,16 +58,10 @@ proc random {range} { return [expr {round(rand()*$range)}] } -# Copy file $from into $to -# -proc copy_file {from to} { - file copy -force $from $to -} - # Setup for the tests. Make a backup copy of the good database in test.bu. # db close -copy_file test.db test.bu +forcecopy test.db test.bu sqlite3 db test.db set fsize [file size test.db] @@ -92,7 +86,7 @@ expr srand($qseed) # test that a corrupt content offset size is handled (seed 5577) do_test corruptC-2.1 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 2053 [format %02x 0x04] @@ -104,7 +98,7 @@ do_test corruptC-2.1 { # test that a corrupt content offset size is handled (seed 5649) do_test corruptC-2.2 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 27 [format %02x 0x08] @@ -125,7 +119,7 @@ do_test corruptC-2.2 { # test that a corrupt free cell size is handled (seed 13329) do_test corruptC-2.3 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 1094 [format %02x 0x76] @@ -137,7 +131,7 @@ do_test corruptC-2.3 { # test that a corrupt free cell size is handled (seed 169571) do_test corruptC-2.4 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 3119 [format %02x 0xdf] @@ -149,7 +143,7 @@ do_test corruptC-2.4 { # test that a corrupt free cell size is handled (seed 169571) do_test corruptC-2.5 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 3119 [format %02x 0xdf] @@ -169,7 +163,7 @@ Page 4: btreeInitPage() returns error code 11}}} # test that a corrupt free cell size is handled (seed 169595) do_test corruptC-2.6 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 619 [format %02x 0xe2] @@ -182,7 +176,7 @@ do_test corruptC-2.6 { # corruption (seed 178692) do_test corruptC-2.7 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 3074 [format %02x 0xa0] @@ -194,7 +188,7 @@ do_test corruptC-2.7 { # corruption (seed 179069) do_test corruptC-2.8 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 1393 [format %02x 0x7d] @@ -210,7 +204,7 @@ do_test corruptC-2.8 { # corruption (seed 170434) do_test corruptC-2.9 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 2095 [format %02x 0xd6] @@ -222,7 +216,7 @@ do_test corruptC-2.9 { # corruption (seed 186504) do_test corruptC-2.10 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 3130 [format %02x 0x02] @@ -234,7 +228,7 @@ do_test corruptC-2.10 { # corruption (seed 1589) do_test corruptC-2.11 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 55 [format %02x 0xa7] @@ -246,7 +240,7 @@ do_test corruptC-2.11 { # corruption (seed 14166) do_test corruptC-2.12 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 974 [format %02x 0x2e] @@ -258,7 +252,7 @@ do_test corruptC-2.12 { # corruption (seed 218803) do_test corruptC-2.13 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 102 [format %02x 0x12] @@ -269,7 +263,7 @@ do_test corruptC-2.13 { do_test corruptC-2.14 { db close - copy_file test.bu test.db + forcecopy test.bu test.db sqlite3 db test.db set blob [string repeat abcdefghij 10000] @@ -286,7 +280,7 @@ do_test corruptC-2.14 { # do_test corruptC-2.15 { db close - copy_file test.bu test.db + forcecopy test.bu test.db hexio_write test.db 986 b9 sqlite3 db test.db catchsql {SELECT count(*) FROM sqlite_master;} @@ -300,7 +294,7 @@ for {set tn 0} {$tn<$fsize} {incr tn 1} { # setup for test db close - copy_file test.bu test.db + forcecopy test.bu test.db sqlite3 db test.db # Seek to a random location in the file, and write a random single byte diff --git a/test/corruptD.test b/test/corruptD.test index 61dada6588..393d41ee36 100644 --- a/test/corruptD.test +++ b/test/corruptD.test @@ -85,7 +85,7 @@ do_test corruptD-1.0 { DELETE FROM t1 WHERE a = 30; DELETE FROM t1 WHERE a = 40; } - copy_file test.db test.bu + forcecopy test.db test.bu } {} proc incr_change_counter {} { @@ -96,7 +96,7 @@ proc incr_change_counter {} { proc restore_file {} { db close - copy_file test.bu test.db + forcecopy test.bu test.db sqlite3 db test.db } diff --git a/test/corruptE.test b/test/corruptE.test index a47adba1f1..94bc928fff 100644 --- a/test/corruptE.test +++ b/test/corruptE.test @@ -16,7 +16,7 @@ # # $Id: corruptE.test,v 1.14 2009/07/11 06:55:34 danielk1977 Exp $ -catch {file delete -force test.db test.db-journal test.bu} +catch {forcedelete test.db test.db-journal test.bu} set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -60,23 +60,17 @@ ifcapable {integrityck} { integrity_check corruptE-1.2 } -# Copy file $from into $to -# -proc copy_file {from to} { - file copy -force $from $to -} - # Setup for the tests. Make a backup copy of the good database in test.bu. # db close -copy_file test.db test.bu +forcecopy test.db test.bu sqlite3 db test.db set fsize [file size test.db] do_test corruptE-2.1 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 2041 [format %02x 0x2e] @@ -92,7 +86,7 @@ do_test corruptE-2.1 { do_test corruptE-2.2 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 2047 [format %02x 0x84] @@ -108,7 +102,7 @@ do_test corruptE-2.2 { do_test corruptE-2.3 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 7420 [format %02x 0xa8] @@ -124,7 +118,7 @@ do_test corruptE-2.3 { do_test corruptE-2.4 { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db 10233 [format %02x 0xd0] @@ -165,7 +159,7 @@ set tc 1 foreach test $tests { do_test corruptE-3.$tc { db close - copy_file test.bu test.db + forcecopy test.bu test.db # insert corrupt byte(s) hexio_write test.db [lindex $test 0] [format %02x [lindex $test 1]] diff --git a/test/crash.test b/test/crash.test index 42f41a36e4..f644dcaf73 100644 --- a/test/crash.test +++ b/test/crash.test @@ -215,8 +215,8 @@ for {set i 1} {$i < $repeats} {incr i} { # ifcapable attach { do_test crash-4.0 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' AS aux; PRAGMA aux.default_cache_size = 10; @@ -318,7 +318,7 @@ ifcapable attach { # in test crash-5.3 for details. # db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test crash-5.1 { execsql { diff --git a/test/crash3.test b/test/crash3.test index 9b7a678474..7958af992e 100644 --- a/test/crash3.test +++ b/test/crash3.test @@ -73,7 +73,7 @@ foreach {sql res2} [list \ for {set ii 0} {$ii < 10} {incr ii} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db do_test crash3-1.$tn.1 { execsql { @@ -106,7 +106,7 @@ foreach {sql res2} [list \ # This block tests both the IOCAP_SEQUENTIAL and IOCAP_SAFE_APPEND flags. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test crash3-2.0 { execsql { @@ -177,7 +177,7 @@ foreach {::crashfile ::delay ::char} { # for {set ii 0} {$ii < 10} {incr ii} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal crashsql -file test.db -char {sequential atomic} { CREATE TABLE abc(a, b, c); } diff --git a/test/crash4.test b/test/crash4.test index 839299b542..f68caecdef 100644 --- a/test/crash4.test +++ b/test/crash4.test @@ -63,7 +63,7 @@ foreach cmd $sql_cmd_list { # for {set cnt 1; set fin 0} {!$fin} {incr cnt} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal do_test crash4-1.$cnt.1 { set seed [expr {int(abs(rand()*10000))}] set delay [expr {int($cnt/50)+1}] diff --git a/test/crash5.test b/test/crash5.test index e8faa01b17..42248d719e 100644 --- a/test/crash5.test +++ b/test/crash5.test @@ -34,7 +34,7 @@ for {set ii 0} {$ii < 10} {incr ii} { # Set up the database so that it is an auto-vacuum database # containing a single table (root page 3) with a single row. # The row has an overflow page (page 4). - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db set c [string repeat 3 1500] db eval { diff --git a/test/crash6.test b/test/crash6.test index d5ee439f8c..69c19464b3 100644 --- a/test/crash6.test +++ b/test/crash6.test @@ -23,7 +23,7 @@ ifcapable !crashtest { for {set ii 0} {$ii < 10} {incr ii} { catch {db close} - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal crashsql -delay 2 -file test.db { PRAGMA auto_vacuum=OFF; PRAGMA page_size=4096; @@ -40,7 +40,7 @@ for {set ii 0} {$ii < 10} {incr ii} { for {set ii 0} {$ii < 10} {incr ii} { catch {db close} - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA auto_vacuum=OFF; @@ -66,7 +66,7 @@ proc signature {} { # for {set ii 0} {$ii < 30} {incr ii} { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db set pagesize [expr 1024 << ($ii % 4)] diff --git a/test/crash7.test b/test/crash7.test index fc0596a8aa..4554a2ac58 100644 --- a/test/crash7.test +++ b/test/crash7.test @@ -26,7 +26,7 @@ proc signature {} { foreach f [list test.db test.db-journal] { for {set ii 1} {$ii < 64} {incr ii} { db close - file delete test.db + delete_file test.db sqlite3 db test.db set from_size [expr 1024 << ($ii&3)] diff --git a/test/crash8.test b/test/crash8.test index 6424a1abb9..8bc258651a 100644 --- a/test/crash8.test +++ b/test/crash8.test @@ -243,7 +243,7 @@ do_test crash8-3.11 { # ifcapable pragma { reset_db - file delete -force test2.db + forcedelete test2.db do_test crash8-4.1 { execsql { @@ -336,14 +336,14 @@ ifcapable pragma { } {def} do_test crash8-4.10 { - file delete $zMasterJournal + delete_file $zMasterJournal execsql { SELECT b FROM main.ab WHERE a = 0 } } {jkl} } for {set i 1} {$i < 10} {incr i} { catch { db close } - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db do_test crash8-5.$i.1 { execsql { @@ -367,7 +367,7 @@ for {set i 1} {$i < 10} {incr i} { } {ok} catch { db close } - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db do_test crash8-5.$i.2 { execsql { @@ -383,9 +383,9 @@ for {set i 1} {$i < 10} {incr i} { BEGIN; UPDATE t1 SET x = randomblob(900); } - file delete -force testX.db testX.db-journal testX.db-wal - copy_file test.db testX.db - copy_file test.db-journal testX.db-journal + forcedelete testX.db testX.db-journal testX.db-wal + forcecopy test.db testX.db + forcecopy test.db-journal testX.db-journal db close crashsql -file test.db -delay [expr ($::i%2) + 1] { diff --git a/test/createtab.test b/test/createtab.test index 3f036b76d6..01e0b6122e 100644 --- a/test/createtab.test +++ b/test/createtab.test @@ -27,7 +27,7 @@ ifcapable autovacuum { # for {set av 0} {$av<=$upperBound} {incr av} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db # Create a table that spans multiple pages. It is important diff --git a/test/dbstatus.test b/test/dbstatus.test index 202f34a043..39522f4857 100644 --- a/test/dbstatus.test +++ b/test/dbstatus.test @@ -155,7 +155,7 @@ foreach ::lookaside_buffer_size {0 64 120} { # Step 1. db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500 db cache size 0 @@ -287,7 +287,7 @@ foreach ::lookaside_buffer_size {0 64 120} { # Step 1. db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500 db cache size 1000 diff --git a/test/delete.test b/test/delete.test index 61e979ef11..47d357811b 100644 --- a/test/delete.test +++ b/test/delete.test @@ -275,7 +275,7 @@ do_test delete-8.0 { } } {123} db close -catch {file delete -force test.db-journal} +catch {forcedelete test.db-journal} catch {file attributes test.db -permissions 0444} catch {file attributes test.db -readonly 1} sqlite3 db test.db @@ -312,12 +312,12 @@ do_test delete-8.6 { integrity_check delete-8.7 # Need to do the following for tcl 8.5 on mac. On that configuration, the -# -readonly flag is taken so seriously that a subsequent [file delete -force] +# -readonly flag is taken so seriously that a subsequent [forcedelete] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal # The following tests verify that SQLite correctly handles the case # where an index B-Tree is being scanned, the rowid column being read diff --git a/test/descidx1.test b/test/descidx1.test index 1154dc5643..c7fab340a5 100644 --- a/test/descidx1.test +++ b/test/descidx1.test @@ -297,14 +297,14 @@ do_test descidx1-5.9 { ifcapable legacyformat { do_test descidx1-6.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql {PRAGMA legacy_file_format} } {1} } else { do_test descidx1-6.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql {PRAGMA legacy_file_format} } {0} @@ -328,7 +328,7 @@ ifcapable vacuum { } do_test descidx1-6.4 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql {PRAGMA legacy_file_format=NO} execsql {PRAGMA legacy_file_format} diff --git a/test/diskfull.test b/test/diskfull.test index a71db91e41..391dfb4fcf 100644 --- a/test/diskfull.test +++ b/test/diskfull.test @@ -82,8 +82,8 @@ proc do_diskfull_test {prefix sql} { do_diskfull_test diskfull-2 VACUUM # db close -# file delete -force test.db -# file delete -force test.db-journal +# forcedelete test.db +# forcedelete test.db-journal # sqlite3 db test.db # # do_test diskfull-3.1 { diff --git a/test/e_expr.test b/test/e_expr.test index b61b42da98..3c9678c3cc 100644 --- a/test/e_expr.test +++ b/test/e_expr.test @@ -657,7 +657,7 @@ set sqlite_current_time 0 # EVIDENCE-OF: R-57598-59332 -- syntax diagram expr # -file delete -force test.db2 +forcedelete test.db2 execsql { ATTACH 'test.db2' AS dbname; CREATE TABLE dbname.tblname(cname); @@ -1675,7 +1675,7 @@ db3 close # Test statements related to the EXISTS and NOT EXISTS operators. # catch { db close } -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_execsql_test e_expr-34.1 { @@ -1756,7 +1756,7 @@ foreach {tn e1 e2} { # catch { db close } -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test e_expr-35.0 { execsql { diff --git a/test/e_fts3.test b/test/e_fts3.test index 3f7ed0e517..2a580ca313 100644 --- a/test/e_fts3.test +++ b/test/e_fts3.test @@ -60,7 +60,7 @@ foreach {DO_MALLOC_TEST enc} { # [foreach] loop is testing with OOM errors, disable the lookaside buffer. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db if {$DO_MALLOC_TEST} { sqlite3_db_config_lookaside db 0 0 0 } db eval "PRAGMA encoding = '$enc'" @@ -637,7 +637,7 @@ read_test 8.2.2 { PRAGMA table_info(t9c) } {0 c\"1 {} 0 {} 0 1 c'2 {} 0 {} 0} # foreach DO_MALLOC_TEST {0 1 2} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db if {$DO_MALLOC_TEST} { sqlite3_db_config_lookaside db 0 0 0 } diff --git a/test/enc2.test b/test/enc2.test index ce25bf3956..415bc0f720 100644 --- a/test/enc2.test +++ b/test/enc2.test @@ -142,7 +142,7 @@ set encodings [list UTF-8 UTF-16le UTF-16be] set sqlite_os_trace 0 set i 1 foreach enc $encodings { - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval "PRAGMA encoding = \"$enc\"" execsql $dbcontents @@ -172,13 +172,13 @@ foreach enc $encodings { # encoding to the main database. ifcapable attach { do_test enc2-4.1 { - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval "PRAGMA encoding = 'UTF-8'" db eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.2 { - file delete -force test2.db + forcedelete test2.db sqlite3 db2 test2.db db2 eval "PRAGMA encoding = 'UTF-16'" db2 eval "CREATE TABLE abc(a, b, c);" @@ -206,7 +206,7 @@ proc test_collate {enc lhs rhs} { return $res } -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] do_test enc2-5.0 { execsql { @@ -235,7 +235,7 @@ do_test enc2-5.3 { } {one two three four five UTF-16BE} db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] execsql {pragma encoding = 'UTF-16LE'} do_test enc2-5.4 { @@ -265,7 +265,7 @@ do_test enc2-5.7 { } {one two three four five UTF-8} db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] execsql {pragma encoding = 'UTF-16BE'} do_test enc2-5.8 { @@ -311,7 +311,7 @@ do_test enc2-5.14 { } test_collate db close -file delete -force test.db +forcedelete test.db do_test enc2-5.15 { sqlite3 db test.db; set ::DB [sqlite3_connection_pointer db] @@ -333,7 +333,7 @@ proc test_function {enc arg} { } db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] execsql {pragma encoding = 'UTF-8'} do_test enc2-6.0 { @@ -366,7 +366,7 @@ do_test enc2-6.3 { } {{UTF-16BE sqlite}} db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] execsql {pragma encoding = 'UTF-16LE'} do_test enc2-6.3 { @@ -399,7 +399,7 @@ do_test enc2-6.6 { } {{UTF-16BE sqlite}} db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db; set DB [sqlite3_connection_pointer db] execsql {pragma encoding = 'UTF-16BE'} do_test enc2-6.7 { @@ -433,7 +433,7 @@ do_test enc2-6.10 { db close -file delete -force test.db +forcedelete test.db # The following tests - enc2-7.* - function as follows: # @@ -493,7 +493,7 @@ ifcapable {complete} { # Test that the encoding of an empty database may still be set after the # (empty) schema has been initialized. -file delete -force test.db +forcedelete test.db do_test enc2-9.1 { sqlite3 db test.db execsql { @@ -537,7 +537,7 @@ do_test enc2-9.5 { # do_test enc2-10.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db eval { PRAGMA encoding=UTF16; diff --git a/test/enc3.test b/test/enc3.test index 44b217934e..1d8a258165 100644 --- a/test/enc3.test +++ b/test/enc3.test @@ -81,7 +81,7 @@ ifcapable {bloblit && utf16} { # ifcapable {utf16 && shared_cache} { db close - file delete -force test8.db test8.db-journal + forcedelete test8.db test8.db-journal set ::enable_shared_cache [sqlite3_enable_shared_cache 1] sqlite3 dbaux test8.db sqlite3 db test.db @@ -100,7 +100,7 @@ ifcapable {utf16 && shared_cache} { } dbaux } {1 {attached databases must use the same text encoding as main database}} dbaux close - file delete -force test8.db test8.db-journal + forcedelete test8.db test8.db-journal sqlite3_enable_shared_cache $::enable_shared_cache } diff --git a/test/enc4.test b/test/enc4.test index 7de6e849f9..94869b6fb7 100644 --- a/test/enc4.test +++ b/test/enc4.test @@ -43,7 +43,7 @@ set vals [list\ set i 1 foreach enc $encodings { - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval "PRAGMA encoding = \"$enc\"" @@ -93,7 +93,7 @@ foreach enc $encodings { incr i } -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test enc4-4.1 { diff --git a/test/exclusive.test b/test/exclusive.test index db79d3030f..ffde891533 100644 --- a/test/exclusive.test +++ b/test/exclusive.test @@ -22,12 +22,12 @@ ifcapable {!pager_pragmas} { return } -file delete -force test2.db-journal -file delete -force test2.db -file delete -force test3.db-journal -file delete -force test3.db -file delete -force test4.db-journal -file delete -force test4.db +forcedelete test2.db-journal +forcedelete test2.db +forcedelete test3.db-journal +forcedelete test3.db +forcedelete test4.db-journal +forcedelete test4.db #---------------------------------------------------------------------- # Test cases exclusive-1.X test the PRAGMA logic. @@ -481,8 +481,8 @@ do_execsql_test exclusive-6.1 { } do_test exclusive-6.2 { forcedelete test2.db test2.db-journal - file copy test.db test2.db - file copy test.db-journal test2.db-journal + copy_file test.db test2.db + copy_file test.db-journal test2.db-journal sqlite3 db test2.db } {} diff --git a/test/exclusive2.test b/test/exclusive2.test index 18f304dbbe..2208da5101 100644 --- a/test/exclusive2.test +++ b/test/exclusive2.test @@ -259,8 +259,8 @@ do_test exclusive2-2.8 { db close catch {close $::fd} -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal do_test exclusive2-3.0 { sqlite3 db test.db diff --git a/test/fallocate.test b/test/fallocate.test index 05aa2a81e5..8a5fa32360 100644 --- a/test/fallocate.test +++ b/test/fallocate.test @@ -79,7 +79,7 @@ ifcapable !wal { set skipwaltests 1 } if {!$skipwaltests} { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db file_control_chunksize_test db main [expr 32*1024] diff --git a/test/filectrl.test b/test/filectrl.test index 67e81830c4..9f077d523c 100644 --- a/test/filectrl.test +++ b/test/filectrl.test @@ -37,5 +37,5 @@ do_test filectrl-1.5 { file_control_lockproxy_test db [pwd] } {} db close -file delete -force .test_control_lockproxy.db-conch test.proxy +forcedelete .test_control_lockproxy.db-conch test.proxy finish_test diff --git a/test/filefmt.test b/test/filefmt.test index 72edbeebc7..1165cd62d5 100644 --- a/test/filefmt.test +++ b/test/filefmt.test @@ -23,7 +23,7 @@ source $testdir/tester.tcl do_not_use_codec db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal # Database begins with valid 16-byte header string. # @@ -63,7 +63,7 @@ ifcapable pager_pragmas { && $pagesize>$SQLITE_MAX_PAGE_SIZE} continue do_test filefmt-1.5.$pagesize.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval "PRAGMA auto_vacuum=OFF" db eval "PRAGMA page_size=$pagesize" @@ -105,7 +105,7 @@ do_test filefmt-1.7 { ifcapable pager_pragmas { do_test filefmt-1.8 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval {PRAGMA page_size=512; CREATE TABLE t1(x)} db close @@ -125,7 +125,7 @@ ifcapable pager_pragmas { # always derives this from the size of the file. # db close -file delete -force test.db +forcedelete test.db set a_string_counter 1 proc a_string {n} { @@ -157,7 +157,7 @@ integrity_check filefmt-2.1.5 do_test filefmt-2.1.6 { hexio_read test.db 28 4 } {00000010} db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db db func a_string a_string diff --git a/test/fts1j.test b/test/fts1j.test index 5ff0d0ed21..4dac22abbf 100644 --- a/test/fts1j.test +++ b/test/fts1j.test @@ -19,8 +19,8 @@ ifcapable !fts1 { } # Clean up anything left over from a previous pass. -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db2 test2.db db eval { @@ -84,6 +84,6 @@ do_test fts1j-1.3 { catch {db eval {DETACH DATABASE two}} catch {db2 close} -file delete -force test2.db +forcedelete test2.db finish_test diff --git a/test/fts1o.test b/test/fts1o.test index 92666c6f50..61fd74ca0e 100644 --- a/test/fts1o.test +++ b/test/fts1o.test @@ -95,7 +95,7 @@ do_test fts1o-3.6 { # Test that it is possible to rename an fts1 table in an attached # database. # -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal do_test fts1o-4.1 { execsql { diff --git a/test/fts2j.test b/test/fts2j.test index b8a89b205d..a8a2c07c18 100644 --- a/test/fts2j.test +++ b/test/fts2j.test @@ -19,8 +19,8 @@ ifcapable !fts2 { } # Clean up anything left over from a previous pass. -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db2 test2.db db eval { @@ -84,6 +84,6 @@ do_test fts2j-1.3 { catch {db eval {DETACH DATABASE two}} catch {db2 close} -file delete -force test2.db +forcedelete test2.db finish_test diff --git a/test/fts2o.test b/test/fts2o.test index 5a33c45518..63e71b958a 100644 --- a/test/fts2o.test +++ b/test/fts2o.test @@ -109,7 +109,7 @@ do_test fts2o-2.12 { # be run on an initially empty db. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test fts2o-3.1 { @@ -134,7 +134,7 @@ do_test fts2o-3.2 { # Test that it is possible to rename an fts2 table in an attached # database. # -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal do_test fts2o-3.1 { execsql { diff --git a/test/fts3aj.test b/test/fts3aj.test index 60d26c026e..f3d46f2ad8 100644 --- a/test/fts3aj.test +++ b/test/fts3aj.test @@ -19,8 +19,8 @@ ifcapable !fts3 { } # Clean up anything left over from a previous pass. -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db2 test2.db db eval { @@ -84,6 +84,6 @@ do_test fts3aj-1.3 { catch {db eval {DETACH DATABASE two}} catch {db2 close} -file delete -force test2.db +forcedelete test2.db finish_test diff --git a/test/fts3ao.test b/test/fts3ao.test index cd9df01eb4..0b6fcd3d19 100644 --- a/test/fts3ao.test +++ b/test/fts3ao.test @@ -111,7 +111,7 @@ do_test fts3ao-2.12 { # be run on an initially empty db. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test fts3ao-3.1 { @@ -136,7 +136,7 @@ do_test fts3ao-3.2 { # Test that it is possible to rename an fts3 table in an attached # database. # -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal do_test fts3ao-3.1 { execsql { diff --git a/test/fts3snippet.test b/test/fts3snippet.test index 359a87c6f3..b8646cdfaa 100644 --- a/test/fts3snippet.test +++ b/test/fts3snippet.test @@ -131,7 +131,7 @@ foreach {DO_MALLOC_TEST enc} { } { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db sqlite3_db_config_lookaside db 0 0 0 db eval "PRAGMA encoding = \"$enc\"" diff --git a/test/fts4aa.test b/test/fts4aa.test index 1131df3bec..c56933170d 100644 --- a/test/fts4aa.test +++ b/test/fts4aa.test @@ -1686,7 +1686,7 @@ foreach {q r} [array get fts4aa_res] { # do_test fts4aa-3.0 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval { PRAGMA page_size=65536; diff --git a/test/fuzz_malloc.test b/test/fuzz_malloc.test index f2209aaba5..1e31babd92 100644 --- a/test/fuzz_malloc.test +++ b/test/fuzz_malloc.test @@ -47,7 +47,7 @@ proc do_fuzzy_malloc_test {testname args} { sqlite3_memdebug_fail -1 db close - file delete test.db test.db-journal + delete_file test.db test.db-journal sqlite3 db test.db set ::prep $::fuzzyopts(-sqlprep) execsql $::prep diff --git a/test/hook.test b/test/hook.test index c4dfb2e4f9..a195275c9b 100644 --- a/test/hook.test +++ b/test/hook.test @@ -95,7 +95,7 @@ do_test hook-3.9 { # Ticket #3564. # do_test hook-3.10 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal sqlite3 db2 test2.db proc commit_hook {} { set y [db2 one {SELECT y FROM t3 WHERE y>10}] @@ -217,7 +217,7 @@ ifcapable trigger { set ::update_hook {} ifcapable attach { do_test hook-4.2.3 { - file delete -force test2.db + forcedelete test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b); diff --git a/test/incrblob.test b/test/incrblob.test index 9c9389eb4c..388c4ba3a3 100644 --- a/test/incrblob.test +++ b/test/incrblob.test @@ -120,7 +120,7 @@ foreach AutoVacuumMode [list 0 1] { } db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql "PRAGMA auto_vacuum = $AutoVacuumMode" @@ -379,7 +379,7 @@ ifcapable vtab { # ifcapable attach { do_test incrblob-5.1 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal set ::size [expr [file size [info script]]] execsql { ATTACH 'test2.db' AS aux; @@ -584,7 +584,7 @@ set ::data [read $fd 14000] close $fd db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test incrblob-7.2.1 { diff --git a/test/incrvacuum.test b/test/incrvacuum.test index d037d8e7d9..91f5c8e1e0 100644 --- a/test/incrvacuum.test +++ b/test/incrvacuum.test @@ -331,7 +331,7 @@ proc compare_dbs {A B tname} { set ::str1 [string repeat abcdefghij 130] set ::str2 [string repeat 1234567890 105] -file delete -force test1.db test1.db-journal test2.db test2.db-journal +forcedelete test1.db test1.db-journal test2.db test2.db-journal sqlite3 db1 test1.db sqlite3 db2 test2.db execsql { PRAGMA auto_vacuum = 'none' } db1 @@ -475,7 +475,7 @@ do_test incrvacuum-8.1 { # do_test incrvacuum-9.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { @@ -593,7 +593,7 @@ do_test incrvacuum-10.8 { # vacuum mode. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db ifcapable default_autovacuum { @@ -651,7 +651,7 @@ do_test incrvacuum-11.7 { # auto_vacuum = XXX" statement is executed. # db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test incrvacuum-12.1 { @@ -692,7 +692,7 @@ do_test incrvacuum-12.5 { # db2 close db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db ; set ::DB [sqlite3_connection_pointer db] sqlite3 db2 test.db @@ -743,7 +743,7 @@ if {[permutation] == ""} { do_test incrvacuum-15.1 { db close db2 close - file delete -force test.db + forcedelete test.db sqlite3 db test.db set str [string repeat "abcdefghij" 500] diff --git a/test/incrvacuum2.test b/test/incrvacuum2.test index 902517c949..e67a086298 100644 --- a/test/incrvacuum2.test +++ b/test/incrvacuum2.test @@ -70,7 +70,7 @@ do_test incrvacuum2-1.4 { # ifcapable attach { do_test incrvacuum2-2.1 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal execsql { ATTACH DATABASE 'test2.db' AS aux; PRAGMA aux.auto_vacuum=incremental; diff --git a/test/incrvacuum_ioerr.test b/test/incrvacuum_ioerr.test index 47027b823b..946925d7dc 100644 --- a/test/incrvacuum_ioerr.test +++ b/test/incrvacuum_ioerr.test @@ -108,7 +108,7 @@ do_ioerr_test incrvacuum-ioerr-3 -start 1 -cksum 1 -tclprep { ifcapable shared_cache { catch { db close } - file delete -force test.db + forcedelete test.db set ::enable_shared_cache [sqlite3_enable_shared_cache 1] # Create two connections to a single shared-cache: diff --git a/test/insert5.test b/test/insert5.test index e48c2c32da..1e58902e07 100644 --- a/test/insert5.test +++ b/test/insert5.test @@ -34,7 +34,7 @@ proc uses_temp_table {sql} { # Construct the sample database. # do_test insert5-1.0 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal execsql { CREATE TABLE MAIN(Id INTEGER, Id1 INTEGER); CREATE TABLE B(Id INTEGER, Id1 INTEGER); diff --git a/test/io.test b/test/io.test index 0cc26eff4c..58caeeebbc 100644 --- a/test/io.test +++ b/test/io.test @@ -225,7 +225,7 @@ do_test io-2.6.2 { } } {1 {unable to open database file}} do_test io-2.6.3 { - file delete -force test.db-journal + forcedelete test.db-journal catchsql { COMMIT } } {0 {}} do_test io-2.6.4 { @@ -237,7 +237,7 @@ do_test io-2.6.4 { # is created during execution of the COMMIT statement, so we have to # use the same technique to check that it is created as in the above # block. -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal ifcapable attach { do_test io-2.7.1 { execsql { @@ -261,7 +261,7 @@ ifcapable attach { catchsql { COMMIT } } {1 {unable to open database file}} do_test io-2.7.5 { - file delete -force test2.db-journal + forcedelete test2.db-journal catchsql { COMMIT } } {1 {cannot commit - no transaction is active}} do_test io-2.7.6 { @@ -304,7 +304,7 @@ do_test io-2.9.1 { do_test io-2.9.2 { execsql { ROLLBACK; } db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db -vfs devsym execsql { PRAGMA auto_vacuum = OFF; @@ -375,7 +375,7 @@ sqlite3_simulate_device -char sequential -sectorsize 0 ifcapable pager_pragmas { do_test io-3.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db -vfs devsym db eval { PRAGMA auto_vacuum=OFF; @@ -544,7 +544,7 @@ foreach {char sectorsize pgsize} { incr tn if {$pgsize>$::SQLITE_MAX_PAGE_SIZE} continue db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3_simulate_device -char $char -sectorsize $sectorsize sqlite3 db test.db -vfs devsym db eval { diff --git a/test/ioerr.test b/test/ioerr.test index f9b95555ca..b237439ea2 100644 --- a/test/ioerr.test +++ b/test/ioerr.test @@ -183,8 +183,8 @@ if {$tcl_platform(platform)!="windows"} { BEGIN; INSERT INTO t1 VALUES(3, 4); } - copy_file test2.db test.db - copy_file test2.db-journal test.db-journal + forcecopy test2.db test.db + forcecopy test2.db-journal test.db-journal db2 close } -tclbody { sqlite3 db test.db @@ -219,11 +219,11 @@ if {$tcl_platform(platform)=="unix"} { BEGIN; INSERT INTO t1 VALUES(randstr(200,200), randstr(1000,1000), 2); } - copy_file test.db-journal test2.db-journal + forcecopy test.db-journal test2.db-journal execsql { COMMIT; } - copy_file test2.db-journal test.db-journal + forcecopy test2.db-journal test.db-journal set f [open test.db-journal a] fconfigure $f -encoding binary puts -nonewline $f "hello" diff --git a/test/ioerr4.test b/test/ioerr4.test index 3a74a88ae3..defa326868 100644 --- a/test/ioerr4.test +++ b/test/ioerr4.test @@ -31,7 +31,7 @@ do_test ioerr4-1.1 { set ::enable_shared_cache [sqlite3_enable_shared_cache 1] } {0} do_test ioerr4-1.2 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db sqlite3 db2 test.db db eval { @@ -79,12 +79,12 @@ do_test ioerr4-1.6 { # db close db2 close -file copy -force test.db test.db-bu +forcecopy test.db test.db-bu do_ioerr_test ioerr4-2 -tclprep { catch {db2 close} db close - file delete -force test.db test.db-journal - file copy -force test.db-bu test.db + forcedelete test.db test.db-journal + forcecopy test.db-bu test.db sqlite3_enable_shared_cache 1 set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db] db eval {PRAGMA auto_vacuum=INCREMENTAL} @@ -94,7 +94,7 @@ do_ioerr_test ioerr4-2 -tclprep { } db2 close -file delete -force test.db-bu +forcedelete test.db-bu sqlite3_enable_shared_cache $::enable_shared_cache finish_test diff --git a/test/journal1.test b/test/journal1.test index a1b17b412a..2fdadfd68c 100644 --- a/test/journal1.test +++ b/test/journal1.test @@ -20,7 +20,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl # These tests will not work on windows because windows uses -# manditory file locking which breaks the file copy command. +# manditory file locking which breaks the copy_file command. # if {$tcl_platform(platform)=="windows"} { finish_test @@ -51,13 +51,13 @@ do_test journal1-1.2 { BEGIN; DELETE FROM t1; } - file copy -force test.db-journal test.db-journal-bu + forcecopy test.db-journal test.db-journal-bu execsql { ROLLBACK; } db close - file delete test.db - file copy test.db-journal-bu test.db-journal + delete_file test.db + copy_file test.db-journal-bu test.db-journal sqlite3 db test.db catchsql { SELECT * FROM sqlite_master diff --git a/test/journal2.test b/test/journal2.test index 2b5d8fa896..25ce941696 100644 --- a/test/journal2.test +++ b/test/journal2.test @@ -167,7 +167,7 @@ do_test journal2-1.13 { } {1 {disk I/O error}} db2 close unset ::tvfs_error_on_write -file copy -force test.db testX.db +forcecopy test.db testX.db do_test journal2-1.14 { file exists test.db-journal } 1 do_test journal2-1.15 { diff --git a/test/journal3.test b/test/journal3.test index 7d29722202..f1bf89f8c7 100644 --- a/test/journal3.test +++ b/test/journal3.test @@ -35,7 +35,7 @@ if {$::tcl_platform(platform) == "unix"} { db close set effective [format %.5o [expr $permissions & ~$umask]] do_test journal3-1.2.$tn.1 { - catch { file delete -force test.db-journal } + catch { forcedelete test.db-journal } file attributes test.db -permissions $permissions file attributes test.db -permissions } $permissions diff --git a/test/jrnlmode.test b/test/jrnlmode.test index eab74d65ac..b1007c4908 100644 --- a/test/jrnlmode.test +++ b/test/jrnlmode.test @@ -200,7 +200,7 @@ ifcapable attach { } ifcapable attach { - file delete -force test2.db + forcedelete test2.db do_test jrnlmode-2.1 { execsql { ATTACH 'test2.db' AS aux; @@ -242,8 +242,8 @@ ifcapable attach { # Test caes jrnlmode-3.X verify that ticket #3127 has been fixed. # db close - file delete -force test2.db - file delete -force test.db + forcedelete test2.db + forcedelete test.db sqlite3 db test.db do_test jrnlmode-3.1 { @@ -270,7 +270,7 @@ ifcapable attach { ifcapable autovacuum&&pragma { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db do_test jrnlmode-4.1 { execsql { @@ -303,7 +303,7 @@ ifcapable autovacuum&&pragma { # pragma. ifcapable pragma { db close - file delete -force test.db test2.db test3.db + forcedelete test.db test2.db test3.db sqlite3 db test.db do_test jrnlmode-5.1 { @@ -511,7 +511,7 @@ ifcapable pragma { ifcapable pragma { catch { db close } do_test jrnlmode-7.1 { - foreach f [glob -nocomplain test.db*] { file delete -force $f } + foreach f [glob -nocomplain test.db*] { forcedelete $f } sqlite3 db test.db execsql { PRAGMA journal_mode = memory; diff --git a/test/jrnlmode2.test b/test/jrnlmode2.test index dc3bc270b4..6ea87d704b 100644 --- a/test/jrnlmode2.test +++ b/test/jrnlmode2.test @@ -112,7 +112,7 @@ do_test jrnlmode2-2.4 { do_test jrnlmode2-2.5 { db close - file delete test.db-journal + delete_file test.db-journal } {} do_test jrnlmode2-2.6 { sqlite3 db2 test.db -readonly 1 diff --git a/test/jrnlmode3.test b/test/jrnlmode3.test index 6ae1346e32..43da6579ab 100644 --- a/test/jrnlmode3.test +++ b/test/jrnlmode3.test @@ -48,7 +48,7 @@ do_test jrnlmode3-1.2 { } {1} db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db do_test jrnlmode3-2.1 { @@ -85,7 +85,7 @@ foreach fromjmode $all_journal_modes { # Start with a fresh database connection an empty database file. # db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db # Initialize the journal mode. diff --git a/test/loadext.test b/test/loadext.test index db5745b45c..8f8339ecb3 100644 --- a/test/loadext.test +++ b/test/loadext.test @@ -134,7 +134,7 @@ sqlite3_enable_load_extension db 1 # Try to load an extension for which the file does not exist. # do_test loadext-2.1 { - file delete -force ${testextension}xx + forcedelete ${testextension}xx set rc [catch { sqlite3_load_extension db "${testextension}xx" } msg] diff --git a/test/lock4.test b/test/lock4.test index 06ee88dff0..b0b1c74fbe 100644 --- a/test/lock4.test +++ b/test/lock4.test @@ -26,7 +26,7 @@ do_test lock4-1.1 { PRAGMA auto_vacuum=OFF; CREATE TABLE t1(x); } - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal sqlite3 db2 test2.db db2 eval { PRAGMA auto_vacuum=OFF; diff --git a/test/lock5.test b/test/lock5.test index 6ec86ba7e4..f0d495508a 100644 --- a/test/lock5.test +++ b/test/lock5.test @@ -24,7 +24,7 @@ if {[catch {sqlite3 db test.db -vfs unix-none} msg]} { return } db close -file delete -force test.db.lock +forcedelete test.db.lock ifcapable lock_proxy_pragmas { set ::using_proxy 0 @@ -100,7 +100,7 @@ do_test lock5-dotfile.X { ##################################################################### -file delete -force test.db +forcedelete test.db if {[catch {sqlite3 db test.db -vfs unix-flock} msg]} { finish_test return diff --git a/test/main.test b/test/main.test index dbf9041062..5bbc52b845 100644 --- a/test/main.test +++ b/test/main.test @@ -301,7 +301,7 @@ ifcapable {trigger} { if {[permutation] == ""} { do_test main-2.0 { catch {db close} - file delete -force test.db + forcedelete test.db set fd [open test.db w] puts $fd hi! close $fd @@ -314,16 +314,16 @@ if {[permutation] == ""} { # do_test main-3.1 { catch {db close} - foreach f [glob -nocomplain testdb/*] {file delete -force $f} - file delete -force testdb + foreach f [glob -nocomplain testdb/*] {forcedelete $f} + forcedelete testdb sqlite3 db testdb set v [catch {execsql {SELECT * from T1 where x!!5}} msg] lappend v $msg } {1 {unrecognized token: "!!"}} do_test main-3.2 { catch {db close} - foreach f [glob -nocomplain testdb/*] {file delete -force $f} - file delete -force testdb + foreach f [glob -nocomplain testdb/*] {forcedelete $f} + forcedelete testdb sqlite3 db testdb set v [catch {execsql {SELECT * from T1 where ^x}} msg] lappend v $msg @@ -442,8 +442,8 @@ do_test main-3.2.30 { do_test main-3.3 { catch {db close} - foreach f [glob -nocomplain testdb/*] {file delete -force $f} - file delete -force testdb + foreach f [glob -nocomplain testdb/*] {forcedelete $f} + forcedelete testdb sqlite3 db testdb execsql { create table T1(X REAL); /* C-style comments allowed */ diff --git a/test/malloc.test b/test/malloc.test index 9bd5314bf1..1041ce8422 100644 --- a/test/malloc.test +++ b/test/malloc.test @@ -270,7 +270,7 @@ do_malloc_test 9 -sqlprep { do_malloc_test 10 -tclprep { catch {db2 close} db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db sqlite3_extended_result_codes db 1 db eval {CREATE TABLE abc(a, b, c)} @@ -341,8 +341,8 @@ if {$tcl_platform(platform)!="windows"} { BEGIN; INSERT INTO t1 VALUES(3, 4); } - copy_file test2.db test.db - copy_file test2.db-journal test.db-journal + forcecopy test2.db test.db + forcecopy test2.db-journal test.db-journal db2 close } -tclbody { sqlite3 db test.db @@ -499,7 +499,7 @@ unset static_string ifcapable attach { do_malloc_test 20 -tclprep { db close - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal sqlite3 db test2.db sqlite3_extended_result_codes db 1 db eval {CREATE TABLE t1(x);} diff --git a/test/malloc3.test b/test/malloc3.test index 73d2d39642..2dfde466a0 100644 --- a/test/malloc3.test +++ b/test/malloc3.test @@ -463,7 +463,7 @@ TEST 29 { # Test a simple multi-file transaction # -file delete -force test2.db +forcedelete test2.db ifcapable attach { SQL {ATTACH 'test2.db' AS aux;} SQL {BEGIN} @@ -650,7 +650,7 @@ run_test $::run_test_script 1 # Close and reopen the db. db close -file delete -force test.db test.db-journal test2.db test2.db-journal +forcedelete test.db test.db-journal test2.db test2.db-journal sqlite3 db test.db sqlite3_extended_result_codes db 1 set ::DB [sqlite3_connection_pointer db] diff --git a/test/malloc5.test b/test/malloc5.test index 73885b22c3..3fe65c8a99 100644 --- a/test/malloc5.test +++ b/test/malloc5.test @@ -275,7 +275,7 @@ proc nPage {db} { set stats(page) } db close -file delete -force test.db test.db-journal test2.db test2.db-journal +forcedelete test.db test.db-journal test2.db test2.db-journal # This block of test-cases (malloc5-6.1.*) prepares two database files # for the subsequent tests. @@ -304,7 +304,7 @@ do_test malloc5-6.1.1 { SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc; COMMIT; } - copy_file test.db test2.db + forcecopy test.db test2.db sqlite3 db2 test2.db list \ [expr ([file size test.db]/1024)>20] [expr ([file size test2.db]/1024)>20] diff --git a/test/mallocA.test b/test/mallocA.test index 08f6930215..89951276f8 100644 --- a/test/mallocA.test +++ b/test/mallocA.test @@ -27,7 +27,7 @@ if {!$MEMDEBUG} { # Construct a test database # -file delete -force test.db.bu +forcedelete test.db.bu db eval { CREATE TABLE t1(a COLLATE NOCASE,b,c); INSERT INTO t1 VALUES(1,2,3); @@ -38,7 +38,7 @@ db eval { CREATE TABLE t2(x,y,z); } db close -file copy test.db test.db.bu +copy_file test.db test.db.bu do_malloc_test mallocA-1 -testdb test.db.bu -sqlbody { @@ -74,5 +74,5 @@ do_test malloc-99.X { set sqlite_open_file_count } {0} -file delete -force test.db.bu +forcedelete test.db.bu finish_test diff --git a/test/malloc_common.tcl b/test/malloc_common.tcl index e7f615648b..7a135aeadb 100644 --- a/test/malloc_common.tcl +++ b/test/malloc_common.tcl @@ -408,7 +408,7 @@ proc do_malloc_test {tn args} { set zRepeat "transient" if {$::iRepeat} {set zRepeat "persistent"} restore_prng_state - foreach file [glob -nocomplain test.db-mj*] {file delete -force $file} + foreach file [glob -nocomplain test.db-mj*] {forcedelete $file} do_test ${tn}.${zRepeat}.${::n} { diff --git a/test/manydb.test b/test/manydb.test index b9a8eaf8d4..974a5b8ebe 100644 --- a/test/manydb.test +++ b/test/manydb.test @@ -44,7 +44,7 @@ foreach fd $filehandles { close $fd } catch { - file delete -force testfile.1 + forcedelete testfile.1 } set N [expr $i / $num_fd_per_openwrite_db] @@ -92,7 +92,7 @@ for {set i 0} {$i<$N} {incr i} { for {set i 0} {$i<$N} {incr i} { do_test manydb-3.$i { db$i close - file delete -force $dbname($i) + forcedelete $dbname($i) } {} } diff --git a/test/memsubsys1.test b/test/memsubsys1.test index 3bb2cc71d4..7eecf083a7 100644 --- a/test/memsubsys1.test +++ b/test/memsubsys1.test @@ -32,7 +32,7 @@ if {[permutation] == "memsubsys1"} { # proc build_test_db {testname pragmas} { catch {db close} - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db sqlite3_db_config_lookaside db 0 0 0 db eval $pragmas diff --git a/test/memsubsys2.test b/test/memsubsys2.test index ec554775d2..a40f4e4f03 100644 --- a/test/memsubsys2.test +++ b/test/memsubsys2.test @@ -24,7 +24,7 @@ sqlite3_reset_auto_extension # proc build_test_db {testname pragmas} { catch {db close} - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db eval $pragmas db eval { diff --git a/test/misc1.test b/test/misc1.test index a78e4884e9..e3f1b9555a 100644 --- a/test/misc1.test +++ b/test/misc1.test @@ -491,7 +491,7 @@ do_test misc1-14.2b { } {1} do_test misc1-14.3 { cd .. - file delete -force tempdir + forcedelete tempdir execsql {COMMIT} file exists ./test.db-journal } {0} diff --git a/test/misc2.test b/test/misc2.test index f6fc3833f9..bb544c5fbb 100644 --- a/test/misc2.test +++ b/test/misc2.test @@ -165,7 +165,7 @@ do_test misc2-6.1 { ifcapable tclvar { do_test misc2-7.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { CREATE TABLE t1(x); @@ -265,7 +265,7 @@ ifcapable tclvar { # do_test misc2-7.11 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { CREATE TABLE t1(x); @@ -361,7 +361,7 @@ ifcapable tclvar { } db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db catchsql { pragma recursive_triggers = off } diff --git a/test/misc5.test b/test/misc5.test index b3832f18ae..14ba44ead0 100644 --- a/test/misc5.test +++ b/test/misc5.test @@ -514,7 +514,7 @@ ifcapable subquery { if {[permutation] == ""} { do_test misc5-4.1 { db close - file delete -force test.db + forcedelete test.db set fd [open test.db w] puts $fd "This is not really a database" close $fd @@ -544,7 +544,7 @@ do_test misc5-5.4 { # a UNION ALL query causes an error, not a crash. # db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db ifcapable subquery&&compound { do_test misc5-6.1 { diff --git a/test/misc7.test b/test/misc7.test index 7d2ba6e852..9dee327877 100644 --- a/test/misc7.test +++ b/test/misc7.test @@ -30,7 +30,7 @@ do_test misc7-3 { # Try to open a directory: # do_test misc7-4 { - file delete mydir + delete_file mydir file mkdir mydir set rc [catch { sqlite3 db2 ./mydir @@ -41,7 +41,7 @@ do_test misc7-4 { # Try to open a file with a directory where its journal file should be. # do_test misc7-5 { - file delete mydir + delete_file mydir file mkdir mydir-journal sqlite3 db2 ./mydir catchsql { @@ -152,8 +152,8 @@ db2 close # after the omit_readlock pragma has been exercised. # do_test misc7-7.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { PRAGMA omit_readlock = 1; ATTACH 'test2.db' AS aux; @@ -254,8 +254,8 @@ ifcapable vtab { } db close -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal sqlite3 db test.db ifcapable explain { @@ -278,8 +278,8 @@ ifcapable explain { } db close -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal sqlite3 db test.db #-------------------------------------------------------------------- @@ -323,8 +323,8 @@ do_test misc7-15.2 { } {} db close -file delete -force test.db -file delete -force test.db-journal +forcedelete test.db +forcedelete test.db-journal sqlite3 db test.db do_ioerr_test misc7-16 -sqlprep { @@ -385,15 +385,15 @@ if {$tcl_platform(platform)!="windows" && $tcl_platform(platform)!="os2"} { BEGIN; DELETE FROM t3 WHERE (oid%3)==0; } - copy_file test.db bak.db - copy_file test.db-journal bak.db-journal + forcecopy test.db bak.db + forcecopy test.db-journal bak.db-journal execsql { COMMIT; } db close - copy_file bak.db test.db - copy_file bak.db-journal test.db-journal + forcecopy bak.db test.db + forcecopy bak.db-journal test.db-journal sqlite3 db test.db catch {file attributes test.db-journal -permissions r--------} @@ -484,6 +484,6 @@ do_test misc7-21.1 { db close -file delete -force test.db +forcedelete test.db finish_test diff --git a/test/misuse.test b/test/misuse.test index 3734aa01c2..71ee0118c8 100644 --- a/test/misuse.test +++ b/test/misuse.test @@ -39,8 +39,8 @@ proc catchsql2 {sql} { # do_test misuse-1.1 { db close - catch {file delete -force test2.db} - catch {file delete -force test2.db-journal} + catch {forcedelete test2.db} + catch {forcedelete test2.db-journal} sqlite3 db test2.db; set ::DB [sqlite3_connection_pointer db] execsql { CREATE TABLE t1(a,b); diff --git a/test/multiplex.test b/test/multiplex.test index 28ce1c77e7..3abdcf4507 100644 --- a/test/multiplex.test +++ b/test/multiplex.test @@ -145,7 +145,7 @@ do_test multiplex-1.13.7 { sqlite3_multiplex_shutdown } sqlite3_multiplex_initialize "" 1 multiplex_set db main 32768 16 -file delete -force test.x +forcedelete test.x do_test multiplex-2.1.2 { sqlite3 db test.x execsql { @@ -514,7 +514,7 @@ do_test multiplex-5.4.1 { file mkdir test.db list [catch { sqlite3 db test.db } msg] $msg } {1 {unable to open database file}} -catch { file delete test.db } +catch { delete_file test.db } do_faultsim_test multiplex-5.5 -prep { catch { sqlite3_multiplex_shutdown } diff --git a/test/notify1.test b/test/notify1.test index 1cfb36fe4a..be6a122585 100644 --- a/test/notify1.test +++ b/test/notify1.test @@ -140,7 +140,7 @@ do_test notify1-2.2.5 { do_test notify1-2.3.1 { db close db2 close - file delete -force test.db test2.db test3.db + forcedelete test.db test2.db test3.db foreach con {db db2 db3} { sqlite3 $con test.db $con eval { ATTACH 'test2.db' AS aux2 } @@ -294,7 +294,7 @@ do_malloc_test notify1-5 -tclprep { # db close do_test notify1-6.1.1 { - file delete -force test.db test2.db + forcedelete test.db test2.db foreach conn {db db2 db3} { sqlite3 $conn test.db execsql { ATTACH 'test2.db' AS two } $conn diff --git a/test/notify2.test b/test/notify2.test index bfb9af813c..4016b6db11 100644 --- a/test/notify2.test +++ b/test/notify2.test @@ -167,7 +167,7 @@ foreach {iTest xStep xPrepare} { 1 sqlite3_blocking_step sqlite3_blocking_prepare_v2 2 sqlite3_step sqlite3_nonblocking_prepare_v2 } { - file delete -force test.db test2.db test3.db + forcedelete test.db test2.db test3.db set ThreadSetup "set xStep $xStep;set xPrepare $xPrepare;set nSecond $nSecond" diff --git a/test/notify3.test b/test/notify3.test index 0d06ce19c0..446f010780 100644 --- a/test/notify3.test +++ b/test/notify3.test @@ -25,7 +25,7 @@ ifcapable !unlock_notify||!shared_cache { set esc [sqlite3_enable_shared_cache 1] sqlite3 db test.db -file delete -force test.db2 test.db2-journal test.db2-wal +forcedelete test.db2 test.db2-journal test.db2-wal sqlite3 db2 test.db2 do_test notify3-1.1 { diff --git a/test/openv2.test b/test/openv2.test index 843f89194b..2a9e22d6b0 100644 --- a/test/openv2.test +++ b/test/openv2.test @@ -17,7 +17,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal do_test openv2-1.1 { set rc [catch {sqlite3 db test.db -create 0} msg] lappend rc $msg diff --git a/test/pager1.test b/test/pager1.test index 136ca05f46..7fccc5f0c0 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -452,7 +452,7 @@ do_test pager1.4.2.2 { } {4 ok} do_test pager1.4.2.3 { faultsim_restore_and_reopen - foreach f [glob test.db-mj*] { file delete -force $f } + foreach f [glob test.db-mj*] { forcedelete $f } execsql { SELECT count(*) FROM t1; PRAGMA integrity_check; @@ -469,7 +469,7 @@ do_test pager1.4.2.4 { do_test pager1.4.2.5 { faultsim_restore_and_reopen hexio_write test.db-journal [expr [file size test.db-journal]-20] 123456 - foreach f [glob test.db-mj*] { file delete -force $f } + foreach f [glob test.db-mj*] { forcedelete $f } execsql { SELECT count(*) FROM t1; PRAGMA integrity_check; @@ -649,7 +649,7 @@ foreach {tn1 tcl} { # do_test pager1-4.4.$tn.7 { faultsim_restore_and_reopen $prefix - foreach f [glob ${prefix}-mj*] { file delete -force $f } + foreach f [glob ${prefix}-mj*] { forcedelete $f } execsql "ATTACH '${prefix}2' AS aux" } {} do_execsql_test pager1-4.4.$tn.8 { @@ -664,7 +664,7 @@ foreach {tn1 tcl} { } db close tv delete -file delete -force $dirname +forcedelete $dirname # Set up a VFS to make a copy of the file-system just before deleting a @@ -882,7 +882,7 @@ do_test pager1.4.7.3 { db close catch {file attributes test.db-journal -permissions rw-rw-rw-} catch {file attributes test.db-journal -readonly 0} - file delete test.db-journal + delete_file test.db-journal file exists test.db-journal } {0} @@ -2368,8 +2368,8 @@ do_test pager1-29.2 { # do_test pager1-30.1 { db close - file delete test.db - file delete test.db-journal + delete_file test.db + delete_file test.db-journal set fd [open test.db-journal w] seek $fd [expr 512+1032*2] puts -nonewline $fd x @@ -2409,8 +2409,8 @@ do_test pager1-31.1 { BEGIN; UPDATE t1 SET y = randomblob(1499); } - file copy test.db test.db2 - file copy test.db-journal test.db2-journal + copy_file test.db test.db2 + copy_file test.db-journal test.db2-journal hexio_write test.db2-journal 24 00000000 sqlite3 db2 test.db2 diff --git a/test/pagerfault.test b/test/pagerfault.test index ced6da3b3c..e04e97e4fc 100644 --- a/test/pagerfault.test +++ b/test/pagerfault.test @@ -233,7 +233,7 @@ do_faultsim_test pagerfault-5.2 -prep { do_faultsim_test pagerfault-5.3 -faults oom-transient -prep { faultsim_restore_and_reopen db func a_string a_string - file delete -force test2.db test2.db-journal test2.db-wal + forcedelete test2.db test2.db-journal test2.db-wal execsql { PRAGMA journal_mode = PERSIST; ATTACH 'test2.db' AS aux; @@ -641,7 +641,7 @@ do_test pagerfault-13-pre1 { COMMIT; } db close - file delete -force test.db + forcedelete test.db faultsim_save } {} do_faultsim_test pagerfault-13 -prep { @@ -1106,7 +1106,7 @@ do_faultsim_test pagerfault-22 -prep { # do_faultsim_test pagerfault-23 -prep { sqlite3 db :memory: - foreach f [glob -nocomplain test.db*] { file delete -force $f } + foreach f [glob -nocomplain test.db*] { forcedelete $f } db eval { ATTACH 'test.db2' AS aux; CREATE TABLE t1(a, b); diff --git a/test/pagesize.test b/test/pagesize.test index af2c017b72..0eebbbb7c9 100644 --- a/test/pagesize.test +++ b/test/pagesize.test @@ -42,7 +42,7 @@ do_test pagesize-1.3 { do_test pagesize-1.4 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { PRAGMA page_size=511; @@ -99,7 +99,7 @@ foreach PGSZ {512 2048 4096 8192} { } do_test pagesize-2.$PGSZ.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql "PRAGMA page_size=$PGSZ" execsql { @@ -190,7 +190,7 @@ foreach PGSZ {512 2048 4096 8192} { integrity_check pagesize-2.$PGSZ.17 db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db do_test pagesize-2.$PGSZ.30 { execsql " @@ -203,7 +203,7 @@ foreach PGSZ {512 2048 4096 8192} { } [list 1024 $PGSZ] db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db do_test pagesize-2.$PGSZ.40 { execsql " diff --git a/test/pcache2.test b/test/pcache2.test index 14df52ebd3..20cb2a8466 100644 --- a/test/pcache2.test +++ b/test/pcache2.test @@ -34,13 +34,13 @@ do_test pcache2-1.1 { # Open up two database connections to separate files. # do_test pcache2-1.2 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db eval {PRAGMA cache_size=10} lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 } {2} do_test pcache2-1.3 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal sqlite3 db2 test2.db db2 eval {PRAGMA cache_size=50} lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 diff --git a/test/pragma.test b/test/pragma.test index 4b4418299c..d2a756f61a 100644 --- a/test/pragma.test +++ b/test/pragma.test @@ -51,8 +51,8 @@ ifcapable !pragma { # that the "all.test" script does. # db close -file delete test.db test.db-journal -file delete test3.db test3.db-journal +delete_file test.db test.db-journal +delete_file test3.db test3.db-journal sqlite3 db test.db; set DB [sqlite3_connection_pointer db] @@ -221,8 +221,8 @@ do_test pragma-1.18 { # Test modifying the safety_level of an attached database. ifcapable pager_pragmas&&attach { do_test pragma-2.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' AS aux; } @@ -255,7 +255,7 @@ ifcapable pager_pragmas&&attach { # do_test pragma-3.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql { PRAGMA auto_vacuum=OFF; @@ -312,7 +312,7 @@ ifcapable attach { # do_test pragma-3.8 { execsql {DETACH t2} - file delete -force testerr.db testerr.db-journal + forcedelete testerr.db testerr.db-journal set out [open testerr.db w] fconfigure $out -translation binary set in [open test.db r] @@ -419,7 +419,7 @@ Page 6 is never used} {rowid 1 missing from index i2}} } do_test pragma-3.19 { catch {db close} - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db eval {PRAGMA integrity_check} } {ok} @@ -741,8 +741,8 @@ do_test pragma-8.1.10 { } SQLITE_SCHEMA # Make sure the schema-version can be manipulated in an attached database. -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal ifcapable attach { do_test pragma-8.1.11 { execsql { @@ -1205,7 +1205,7 @@ do_test pragma-13.1 { ifcapable pager_pragmas { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db do_test pragma-14.1 { @@ -1241,7 +1241,7 @@ ifcapable pager_pragmas { } {2} do_test pragma-14.6 { - file delete -force test2.db + forcedelete test2.db sqlite3 db2 test2.db execsql { PRAGMA auto_vacuum = 0; diff --git a/test/pragma2.test b/test/pragma2.test index 87c3c5d04e..1111a984b4 100644 --- a/test/pragma2.test +++ b/test/pragma2.test @@ -33,8 +33,8 @@ ifcapable !pragma||!schema_pragmas { # that the "all.test" script does. # db close -file delete test.db test.db-journal -file delete test3.db test3.db-journal +delete_file test.db test.db-journal +delete_file test3.db test3.db-journal sqlite3 db test.db; set DB [sqlite3_connection_pointer db] db eval {PRAGMA auto_vacuum=0} @@ -61,8 +61,8 @@ do_test pragma2-1.4 { } } {1} -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal ifcapable attach { do_test pragma2-2.1 { diff --git a/test/quota.test b/test/quota.test index d7601e0e52..55eca2d538 100644 --- a/test/quota.test +++ b/test/quota.test @@ -123,7 +123,7 @@ proc quota_check {filename limitvar size} { } do_test quota-3.1.1 { - file delete -force test.db + forcedelete test.db sqlite3_quota_initialize "" 1 sqlite3_quota_set *test.db 4096 quota_check } {SQLITE_OK} @@ -158,7 +158,7 @@ do_test quota-3.1.6 { } {SQLITE_OK} do_test quota-3.2.1 { - file delete force test.db test2.db + delete_file force test.db test2.db sqlite3_quota_set * 4096 {} sqlite3 db1a test.db @@ -257,7 +257,7 @@ do_test quota-4.1.5 { quota_list } {*test2.db} do_test quota-4.1.6 { - file delete -force test2.db test2.db-journal test2.db-wal + forcedelete test2.db test2.db-journal test2.db-wal sqlite3 db test2.db db eval {CREATE TABLE t2(x); INSERT INTO t2 VALUES('tab-t2');} quota_list @@ -357,7 +357,7 @@ do_faultsim_test quota-5.2 -prep { } catch { db close } -file delete -force test.db +forcedelete test.db do_test quota-5.3.prep { sqlite3 db test.db @@ -377,7 +377,7 @@ do_faultsim_test quota-5.3 -prep { do_test quota-5.4.1 { catch { db close } - file delete -force test.db + forcedelete test.db file mkdir test.db list [catch { sqlite3 db test.db } msg] $msg } {1 {unable to open database file}} diff --git a/test/rollback.test b/test/rollback.test index d462fc48ac..fc123ab938 100644 --- a/test/rollback.test +++ b/test/rollback.test @@ -88,8 +88,8 @@ if {$tcl_platform(platform) == "unix" BEGIN; INSERT INTO t3 VALUES('hello world'); } - file copy -force test.db testA.db - file copy -force test.db-journal testA.db-journal + forcecopy test.db testA.db + forcecopy test.db-journal testA.db-journal execsql { COMMIT; } diff --git a/test/savepoint.test b/test/savepoint.test index 042c555894..3bbbaaae31 100644 --- a/test/savepoint.test +++ b/test/savepoint.test @@ -371,7 +371,7 @@ wal_check_journal_mode savepoint-5.5 # ifcapable {autovacuum && pragma} { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db do_test savepoint-6.1 { @@ -419,7 +419,7 @@ ifcapable {autovacuum && pragma} { # surrounding savepoints by growing and shrinking the database file. # db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test savepoint-7.1 { @@ -490,7 +490,7 @@ wal_check_journal_mode savepoint-7.3.3 do_test savepoint-7.4.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { PRAGMA auto_vacuum = incremental } wal_set_journal_mode @@ -640,8 +640,8 @@ set templockstate [lindex [db eval {PRAGMA lock_status}] 3] if {[wal_is_wal_mode]==0} { do_test savepoint-10.2.1 { - file delete -force test3.db - file delete -force test2.db + forcedelete test3.db + forcedelete test2.db execsql { ATTACH 'test2.db' AS aux1; ATTACH 'test3.db' AS aux2; @@ -762,7 +762,7 @@ if {[wal_is_wal_mode]==0} { # do_test savepoint-11.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { PRAGMA auto_vacuum = full; } wal_set_journal_mode @@ -868,7 +868,7 @@ wal_check_journal_mode savepoint-12.5 if {[wal_is_wal_mode]==0} { do_test savepoint-13.1 { db close - catch {file delete -force test.db} + catch {forcedelete test.db} sqlite3 db test.db execsql { BEGIN; @@ -909,7 +909,7 @@ if {[wal_is_wal_mode]==0} { } db close -file delete test.db +delete_file test.db do_multiclient_test tn { do_test savepoint-14.$tn.1 { sql1 { diff --git a/test/savepoint6.test b/test/savepoint6.test index 60fde4c2df..b1d0d46f5c 100644 --- a/test/savepoint6.test +++ b/test/savepoint6.test @@ -246,7 +246,7 @@ foreach zSetup [list { unset -nocomplain ::aEntry catch { db close } - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal eval $zSetup sql $DATABASE_SCHEMA diff --git a/test/securedel.test b/test/securedel.test index c965069eba..7ff5a628a1 100644 --- a/test/securedel.test +++ b/test/securedel.test @@ -26,7 +26,7 @@ do_test securedel-1.0 { db eval {PRAGMA secure_delete;} } $DEFAULT_SECDEL -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal do_test securedel-1.1 { db eval { ATTACH 'test2.db' AS db2; diff --git a/test/shared.test b/test/shared.test index 35ddf08820..37564e6967 100644 --- a/test/shared.test +++ b/test/shared.test @@ -27,7 +27,7 @@ set ::enable_shared_cache [sqlite3_enable_shared_cache 1] foreach av [list 0 1] { # Open the database connection and execute the auto-vacuum pragma -file delete -force test.db +forcedelete test.db sqlite3 db test.db ifcapable autovacuum { @@ -293,9 +293,9 @@ catch {db3 close} # db2.main -> ./test2.db # db2.test -> ./test.db # -file delete -force test.db -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test.db +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db test.db sqlite3 db2 test2.db do_test shared-$av.4.1.1 { @@ -426,7 +426,7 @@ catch {db close} # Tests shared-5.* # foreach db [list test.db test1.db test2.db test3.db] { - file delete -force $db ${db}-journal + forcedelete $db ${db}-journal } do_test shared-$av.5.1.1 { sqlite3 db1 test.db @@ -557,7 +557,7 @@ do_test shared-$av.6.1.4 { catch {db1 close} catch {db2 close} foreach f [list test.db test2.db] { - file delete -force $f ${f}-journal + forcedelete $f ${f}-journal } #-------------------------------------------------------------------------- @@ -643,7 +643,7 @@ unset -nocomplain contents # The following tests try to trick the shared-cache code into assuming # the wrong encoding for a database. # -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal ifcapable utf16 { do_test shared-$av.8.1.1 { sqlite3 db test.db @@ -675,7 +675,7 @@ ifcapable utf16 { } } {UTF-8} - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal do_test shared-$av.8.2.1 { execsql { ATTACH 'test2.db' AS aux; @@ -693,7 +693,7 @@ ifcapable utf16 { catch {db close} catch {db2 close} - file delete -force test.db test2.db + forcedelete test.db test2.db do_test shared-$av.8.3.2 { sqlite3 db test.db @@ -732,7 +732,7 @@ if 0 { catch {db close} catch {db2 close} -file delete -force test.db test2.db +forcedelete test.db test2.db #--------------------------------------------------------------------------- # The following tests - shared-9.* - test interactions between TEMP triggers @@ -772,7 +772,7 @@ do_test shared-$av.9.3 { # do_test shared-$av.10.1 { # Create a small sample database with two connections to it (db and db2). - file delete -force test.db + forcedelete test.db sqlite3 db test.db sqlite3 db2 test.db execsql { @@ -853,7 +853,7 @@ do_test shared-$av.10.11 { } {} do_test shared-$av.11.1 { - file delete -force test.db + forcedelete test.db sqlite3 db test.db sqlite3 db2 test.db execsql { @@ -916,7 +916,7 @@ do_test shared-$av.11.11 { # This tests that if it is impossible to free any pages, SQLite will # exceed the limit set by PRAGMA cache_size. -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db ifcapable pager_pragmas { do_test shared-$av.12.1 { @@ -963,7 +963,7 @@ do_test shared-$av.12.X { # database handle. This covers an extra line or two. # do_test shared-$av.13.1 { - file delete -force test2.db test3.db test4.db test5.db + forcedelete test2.db test3.db test4.db test5.db sqlite3 db :memory: execsql { ATTACH 'test2.db' AS aux2; @@ -1026,7 +1026,7 @@ do_test shared-$av.14.3 { # assert() statements in the C code. # do_test shared-$av-15.1 { - file delete -force test.db + forcedelete test.db sqlite3 db test.db -fullmutex 1 sqlite3 db2 test.db -fullmutex 1 execsql { diff --git a/test/shared2.test b/test/shared2.test index d2a0d1b0f0..d40c9a271a 100644 --- a/test/shared2.test +++ b/test/shared2.test @@ -129,7 +129,7 @@ do_test shared2-3.2 { sqlite3_enable_shared_cache 1 } {1} -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test shared2-4.1 { diff --git a/test/shared3.test b/test/shared3.test index 8f9eae9b7a..783ae6a885 100644 --- a/test/shared3.test +++ b/test/shared3.test @@ -24,7 +24,7 @@ set ::enable_shared_cache [sqlite3_enable_shared_cache 1] # Ticket #1824 # do_test shared3-1.1 { - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db1 test.db db1 eval { PRAGMA encoding=UTF16; diff --git a/test/shared4.test b/test/shared4.test index f9f0173827..83925b06e4 100644 --- a/test/shared4.test +++ b/test/shared4.test @@ -30,10 +30,10 @@ set ::enable_shared_cache [sqlite3_enable_shared_cache 1] # Prepare multiple databases in shared cache mode. # do_test shared4-1.1 { - file delete -force test1.db test1.db-journal - file delete -force test2.db test2.db-journal - file delete -force test3.db test3.db-journal - file delete -force test4.db test4.db-journal + forcedelete test1.db test1.db-journal + forcedelete test2.db test2.db-journal + forcedelete test3.db test3.db-journal + forcedelete test4.db test4.db-journal sqlite3 db1 test1.db sqlite3 db2 test2.db sqlite3 db3 test3.db diff --git a/test/shared6.test b/test/shared6.test index 4d38b22e3e..499cbb0eb5 100644 --- a/test/shared6.test +++ b/test/shared6.test @@ -235,7 +235,7 @@ do_test shared6-3.X { } {} do_test shared6-4.1 { - #file delete -force test.db test.db-journal + #forcedelete test.db test.db-journal sqlite3 db1 test.db sqlite3 db2 test.db diff --git a/test/shared7.test b/test/shared7.test index d003f0aee3..5c4a1da24c 100644 --- a/test/shared7.test +++ b/test/shared7.test @@ -35,7 +35,7 @@ do_test shared7-1.2 { } {1 {database is already attached}} do_test shared7-1.3 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal db eval { ATTACH 'test2.db' AS test2; CREATE TABLE test2.t2(y); diff --git a/test/speed3.test b/test/speed3.test index a99a6245d5..1beaeb74f3 100644 --- a/test/speed3.test +++ b/test/speed3.test @@ -116,7 +116,7 @@ proc reset_db {} { } } -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal reset_db # Set up a database in auto-vacuum mode and create a database schema. diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 8f2521353f..2cbad3ffb8 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -759,7 +759,7 @@ ifcapable attach { do_test sqllimits1-12.1 { set max $::SQLITE_MAX_ATTACHED for {set i 0} {$i < ($max)} {incr i} { - file delete -force test${i}.db test${i}.db-journal + forcedelete test${i}.db test${i}.db-journal } for {set i 0} {$i < ($max)} {incr i} { execsql "ATTACH 'test${i}.db' AS aux${i}" diff --git a/test/stat.test b/test/stat.test index e1aeaa9e1a..6737f5f4af 100644 --- a/test/stat.test +++ b/test/stat.test @@ -139,7 +139,7 @@ do_execsql_test stat-4.1 { ] db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db register_dbstat_vtab db breakpoint diff --git a/test/sync.test b/test/sync.test index 4b02ad72ab..14252b5c08 100644 --- a/test/sync.test +++ b/test/sync.test @@ -42,8 +42,8 @@ proc cond_incr_sync_count {adj} { do_test sync-1.1 { set sqlite_sync_count 0 - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { PRAGMA fullfsync=OFF; CREATE TABLE t1(a,b); diff --git a/test/table.test b/test/table.test index 5fa9116656..ae6f94c746 100644 --- a/test/table.test +++ b/test/table.test @@ -667,8 +667,8 @@ ifcapable attach { # Now attach a database and ensure that a table can be created in the # attached database whilst in a callback from a query on the main database. do_test table-14.3 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' as aux; } diff --git a/test/temptable.test b/test/temptable.test index d82ea36444..5eeb0f5786 100644 --- a/test/temptable.test +++ b/test/temptable.test @@ -404,7 +404,7 @@ do_test temptable-6.8 { } } {1 {no such table: t9}} -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal ifcapable attach { do_test temptable-7.1 { catchsql { @@ -415,14 +415,14 @@ ifcapable attach { } # Need to do the following for tcl 8.5 on mac. On that configuration, the -# -readonly flag is taken so seriously that a subsequent [file delete -force] +# -readonly flag is taken so seriously that a subsequent [forcedelete] # (required before the next test file can be executed) will fail. # catch {file attributes test.db -readonly 0} do_test temptable-8.0 { db close - catch {file delete -force test.db} + catch {forcedelete test.db} sqlite3 db test.db } {} do_test temptable-8.1 { diff --git a/test/temptrigger.test b/test/temptrigger.test index ececc4a8a8..ed1efb9125 100644 --- a/test/temptrigger.test +++ b/test/temptrigger.test @@ -157,8 +157,8 @@ sqlite3_enable_shared_cache $::enable_shared_cache # temptrigger-3.4: Check that the temp trigger can be dropped without error. # do_test temptrigger-3.1 { - catch { file delete -force test2.db test2.db-journal } - catch { file delete -force test.db test.db-journal } + catch { forcedelete test2.db test2.db-journal } + catch { forcedelete test.db test.db-journal } sqlite3 db test.db sqlite3 db2 test2.db execsql { CREATE TABLE t2(a, b) } db2 diff --git a/test/tester.tcl b/test/tester.tcl index fabb32af52..3c34b45d4e 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -20,7 +20,9 @@ # Commands to manipulate the db and the file-system at a high level: # # copy_file FROM TO +# delete_file FILENAME # drop_all_tables ?DB? +# forcecopy FROM TO # forcedelete FILENAME # # Test the capability of the SQLite version built into the interpreter to @@ -123,6 +125,121 @@ if {[info command sqlite_orig]==""} { } } +proc getFileRetries {} { + if {![info exists ::G(file-retries)]} { + # + # NOTE: Return the default number of retries for [file] operations. A + # value of zero or less here means "disabled". + # + return [expr {$::tcl_platform(platform) eq "windows" ? 10 : 0}] + } + return $::G(file-retries) +} + +proc getFileRetryDelay {} { + if {![info exists ::G(file-retry-delay)]} { + # + # NOTE: Return the default number of milliseconds to wait when retrying + # failed [file] operations. A value of zero or less means "do not + # wait". + # + return 100; # TODO: Good default? + } + return $::G(file-retry-delay) +} + +# Copy file $from into $to. This is used because some versions of +# TCL for windows (notably the 8.4.1 binary package shipped with the +# current mingw release) have a broken "file copy" command. +# +proc copy_file {from to} { + do_copy_file false $from $to +} + +proc forcecopy {from to} { + do_copy_file true $from $to +} + +proc do_copy_file {force from to} { + set nRetry [getFileRetries] ;# Maximum number of retries. + set nDelay [getFileRetryDelay] ;# Delay in ms before retrying. + + # On windows, sometimes even a [file copy -force] can fail. The cause is + # usually "tag-alongs" - programs like anti-virus software, automatic backup + # tools and various explorer extensions that keep a file open a little longer + # than we expect, causing the delete to fail. + # + # The solution is to wait a short amount of time before retrying the copy. + # + if {$nRetry > 0} { + for {set i 0} {$i<$nRetry} {incr i} { + set rc [catch { + if {$force} { + file copy -force $from $to + } else { + file copy $from $to + } + } msg] + if {$rc==0} break + if {$nDelay > 0} { after $nDelay } + } + if {$rc} { error $msg } + } else { + if {$force} { + file copy -force $from $to + } else { + file copy $from $to + } + } +} + +# Delete a file or directory +# +proc delete_file {args} { + do_delete_file false {*}$args +} + +proc forcedelete {args} { + do_delete_file true {*}$args +} + +proc do_delete_file {force args} { + set nRetry [getFileRetries] ;# Maximum number of retries. + set nDelay [getFileRetryDelay] ;# Delay in ms before retrying. + + foreach filename $args { + # On windows, sometimes even a [file delete -force] can fail just after + # a file is closed. The cause is usually "tag-alongs" - programs like + # anti-virus software, automatic backup tools and various explorer + # extensions that keep a file open a little longer than we expect, causing + # the delete to fail. + # + # The solution is to wait a short amount of time before retrying the + # delete. + # + if {$nRetry > 0} { + for {set i 0} {$i<$nRetry} {incr i} { + set rc [catch { + if {$force} { + file delete -force $filename + } else { + file delete $filename + } + } msg] + if {$rc==0} break + if {$nDelay > 0} { after $nDelay } + } + if {$rc} { error $msg } + } else { + if {$force} { + file delete -force $filename + } else { + file delete $filename + } + } + } +} + proc execpresql {handle args} { trace remove execution $handle enter [list execpresql $handle] if {[info exists ::G(perm:presql)]} { @@ -154,6 +271,8 @@ if {[info exists cmdlinearg]==0} { # --backtrace=N # --binarylog=N # --soak=N + # --file-retries=N + # --file-retry-delay=N # --start=[$permutation:]$testfile # set cmdlinearg(soft-heap-limit) 0 @@ -162,6 +281,8 @@ if {[info exists cmdlinearg]==0} { set cmdlinearg(backtrace) 10 set cmdlinearg(binarylog) 0 set cmdlinearg(soak) 0 + set cmdlinearg(file-retries) 0 + set cmdlinearg(file-retry-delay) 0 set cmdlinearg(start) "" set leftover [list] @@ -197,6 +318,14 @@ if {[info exists cmdlinearg]==0} { foreach {dummy cmdlinearg(soak)} [split $a =] break set ::G(issoak) $cmdlinearg(soak) } + {^-+file-retries=.+$} { + foreach {dummy cmdlinearg(file-retries)} [split $a =] break + set ::G(file-retries) $cmdlinearg(file-retries) + } + {^-+file-retry-delay=.+$} { + foreach {dummy cmdlinearg(file-retry-delay)} [split $a =] break + set ::G(file-retry-delay) $cmdlinearg(file-retry-delay) + } {^-+start=.+$} { foreach {dummy cmdlinearg(start)} [split $a =] break @@ -246,9 +375,9 @@ sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit) # proc reset_db {} { catch {db close} - file delete -force test.db - file delete -force test.db-journal - file delete -force test.db-wal + forcedelete test.db + forcedelete test.db-journal + forcedelete test.db-wal sqlite3 db ./test.db set ::DB [sqlite3_connection_pointer db] if {[info exists ::SETUP_SQL]} { @@ -622,10 +751,10 @@ proc finalize_testing {} { } } foreach f [glob -nocomplain test.db-*-journal] { - file delete -force $f + forcedelete $f } foreach f [glob -nocomplain test.db-mj*] { - file delete -force $f + forcedelete $f } exit [expr {$nErr>0}] } @@ -740,30 +869,6 @@ proc stepsql {dbptr sql} { return $r } -# Delete a file or directory -# -proc forcedelete {args} { - foreach filename $args { - # On windows, sometimes even a [file delete -force] can fail just after - # a file is closed. The cause is usually "tag-alongs" - programs like - # anti-virus software, automatic backup tools and various explorer - # extensions that keep a file open a little longer than we expect, causing - # the delete to fail. - # - # The solution is to wait a short amount of time before retrying the - # delete. - # - set nRetry 50 ;# Maximum number of retries. - set nDelay 100 ;# Delay in ms before retrying. - for {set i 0} {$i<$nRetry} {incr i} { - set rc [catch {file delete -force $filename} msg] - if {$rc==0} break - after $nDelay - } - if {$rc} { error $msg } - } -} - # Do an integrity check of the entire database # proc integrity_check {name {db db}} { @@ -964,10 +1069,10 @@ proc do_ioerr_test {testname args} { set ::sqlite_io_error_pending 0 catch {db close} catch {db2 close} - catch {file delete -force test.db} - catch {file delete -force test.db-journal} - catch {file delete -force test2.db} - catch {file delete -force test2.db-journal} + catch {forcedelete test.db} + catch {forcedelete test.db-journal} + catch {forcedelete test2.db} + catch {forcedelete test2.db-journal} set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db] sqlite3_extended_result_codes $::DB $::ioerropts(-erc) if {[info exists ::ioerropts(-tclprep)]} { @@ -1241,24 +1346,6 @@ proc memdebug_log_sql {{filename mallocs.sql}} { close $fd } -# Copy file $from into $to. This is used because some versions of -# TCL for windows (notably the 8.4.1 binary package shipped with the -# current mingw release) have a broken "file copy" command. -# -proc copy_file {from to} { - if {$::tcl_platform(platform)=="unix"} { - file copy -force $from $to - } else { - set f [open $from] - fconfigure $f -translation binary - set t [open $to w] - fconfigure $t -translation binary - puts -nonewline $t [read $f [file size $from]] - close $t - close $f - } -} - # Drop all tables in database [db] proc drop_all_tables {{db db}} { ifcapable trigger&&foreignkey { @@ -1440,7 +1527,7 @@ proc db_save {} { foreach f [glob -nocomplain sv_test.db*] { forcedelete $f } foreach f [glob -nocomplain test.db*] { set f2 "sv_$f" - file copy -force $f $f2 + forcecopy $f $f2 } } proc db_save_and_close {} { @@ -1452,7 +1539,7 @@ proc db_restore {} { foreach f [glob -nocomplain test.db*] { forcedelete $f } foreach f2 [glob -nocomplain sv_test.db*] { set f [string range $f2 3 end] - file copy -force $f2 $f + forcecopy $f2 $f } } proc db_restore_and_reopen {{dbfile test.db}} { @@ -1462,7 +1549,7 @@ proc db_restore_and_reopen {{dbfile test.db}} { } proc db_delete_and_reopen {{file test.db}} { catch { db close } - foreach f [glob -nocomplain test.db*] { file delete -force $f } + foreach f [glob -nocomplain test.db*] { forcedelete $f } sqlite3 db $file } diff --git a/test/thread002.test b/test/thread002.test index b1e5f6368e..60071d9243 100644 --- a/test/thread002.test +++ b/test/thread002.test @@ -27,7 +27,7 @@ set ::NTHREAD 10 do_test thread002.1 { # Create 3 databases with identical schemas: for {set ii 0} {$ii < 3} {incr ii} { - file delete -force test${ii}.db + forcedelete test${ii}.db sqlite3 db test${ii}.db execsql { CREATE TABLE t1(k, v); diff --git a/test/thread003.test b/test/thread003.test index 8aa513af1e..22cd534c88 100644 --- a/test/thread003.test +++ b/test/thread003.test @@ -40,7 +40,7 @@ do_test thread003.1.2 { } {1} do_test thread003.1.3 { db close - file delete -force test2.db + forcedelete test2.db sqlite3 db test2.db } {} do_test thread003.1.4 { diff --git a/test/thread005.test b/test/thread005.test index 9253287d9a..89cbfe76da 100644 --- a/test/thread005.test +++ b/test/thread005.test @@ -121,7 +121,7 @@ for {set ii 2} {$ii < 500} {incr ii} { # switch or something... # -file delete -force test.db test2.db +forcedelete test.db test2.db unset -nocomplain finished do_test thread005-2.1 { diff --git a/test/tkt-2d1a5c67d.test b/test/tkt-2d1a5c67d.test index 278e1d38bc..bf9595f015 100644 --- a/test/tkt-2d1a5c67d.test +++ b/test/tkt-2d1a5c67d.test @@ -118,8 +118,8 @@ do_test 3.5 { # forcedelete test.db2-wal test.db2 do_test 3.6 { - file copy test.db-wal test.db2-wal - file copy test.db test.db2 + copy_file test.db-wal test.db2-wal + copy_file test.db test.db2 sqlite3 db2 test.db2 execsql { SELECT * FROM t4 WHERE a = 'xyz' } db2 } {xyz} diff --git a/test/tkt-5ee23731f.test b/test/tkt-5ee23731f.test index 61c9974179..761382a4d1 100644 --- a/test/tkt-5ee23731f.test +++ b/test/tkt-5ee23731f.test @@ -19,7 +19,7 @@ source $testdir/tester.tcl do_test tkt-5ee237-1.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db db eval { CREATE TABLE t1(x UNIQUE); diff --git a/test/tkt-f3e5abed55.test b/test/tkt-f3e5abed55.test index 241c1612e0..b3f5d5656c 100644 --- a/test/tkt-f3e5abed55.test +++ b/test/tkt-f3e5abed55.test @@ -14,8 +14,8 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl -foreach f [glob -nocomplain test.db*mj*] { file delete -force $f } -file delete -force test.db2 +foreach f [glob -nocomplain test.db*mj*] { forcedelete $f } +forcedelete test.db2 do_test tkt-f3e5abed55-1.1 { execsql { @@ -51,7 +51,7 @@ do_test tkt-f3e5abed55-1.5 { do_test tkt-f3e5abed55-1.6 { glob -nocomplain test.db*mj* } {} -foreach f [glob -nocomplain test.db*mj*] { file delete -force $f } +foreach f [glob -nocomplain test.db*mj*] { forcedelete $f } db close db2 close diff --git a/test/tkt1667.test b/test/tkt1667.test index 9883a208a2..63815061c0 100644 --- a/test/tkt1667.test +++ b/test/tkt1667.test @@ -25,7 +25,7 @@ ifcapable !autovacuum||!tclvar { } db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal # Set the pending byte offset such that the page it is on is # the first autovacuum pointer map page in the file (assume a page diff --git a/test/tkt1873.test b/test/tkt1873.test index 85a52832dd..9930790c74 100644 --- a/test/tkt1873.test +++ b/test/tkt1873.test @@ -24,7 +24,7 @@ ifcapable !attach { return } -file delete -force test2.db test2.db-journal +forcedelete test2.db test2.db-journal do_test tkt1873-1.1 { execsql { diff --git a/test/tkt2686.test b/test/tkt2686.test index c03c6868b9..20447bbaed 100644 --- a/test/tkt2686.test +++ b/test/tkt2686.test @@ -49,7 +49,7 @@ for {set i 1} {$i<2000} {incr i} { } db close -file delete -force test.db test.db-journal +forcedelete test.db test.db-journal sqlite3 db test.db db eval { diff --git a/test/tkt2817.test b/test/tkt2817.test index 46b7fe3662..579cf2f7ba 100644 --- a/test/tkt2817.test +++ b/test/tkt2817.test @@ -48,7 +48,7 @@ integrity_check tkt2817-1.3 # same name. #2817 did not cause a problem with these tests. # db close -file delete -force test.db +forcedelete test.db sqlite3 db test.db do_test tkt2817-2.0 { execsql { diff --git a/test/tkt2820.test b/test/tkt2820.test index 106c1e550d..11c4cd3a0f 100644 --- a/test/tkt2820.test +++ b/test/tkt2820.test @@ -25,7 +25,7 @@ source $testdir/tester.tcl proc test_schema_change {testid init ddl res} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db execsql $init do_test tkt2820-$testid.1 { @@ -70,7 +70,7 @@ test_schema_change 3 { # do_test tkt2820-4.1 { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db db eval { CREATE TABLE t1(a INTEGER PRIMARY KEY); diff --git a/test/tkt2854.test b/test/tkt2854.test index 862524a775..914ddd1b69 100644 --- a/test/tkt2854.test +++ b/test/tkt2854.test @@ -128,7 +128,7 @@ do_test tkt2854-1.18 { # attached db cannot be locked, the internal exclusive flag used by # shared-cache users is correctly cleared. do_test tkt2854-1.19 { - file delete -force test2.db test2.db-journal + forcedelete test2.db test2.db-journal sqlite3 db4 test2.db execsql { CREATE TABLE def(d, e, f) } db4 execsql { ATTACH 'test2.db' AS aux } db diff --git a/test/tkt3457.test b/test/tkt3457.test index 71eb424640..7b9a1b35a3 100644 --- a/test/tkt3457.test +++ b/test/tkt3457.test @@ -46,8 +46,8 @@ do_test tkt3457-1.1 { INSERT INTO t1 VALUES(4, 5, 6); } - file copy -force test.db bak.db - file copy -force test.db-journal bak.db-journal + forcecopy test.db bak.db + forcecopy test.db-journal bak.db-journal # Fix the first journal-header in the journal-file. Because the # journal file has not yet been synced, the 8-byte magic string at the @@ -63,23 +63,23 @@ do_test tkt3457-1.1 { } {} do_test tkt3457-1.2 { - file copy -force bak.db-journal test.db-journal + forcecopy bak.db-journal test.db-journal file attributes test.db-journal -permissions --------- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.3 { - file copy -force bak.db-journal test.db-journal + forcecopy bak.db-journal test.db-journal file attributes test.db-journal -permissions -w--w--w- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.4 { - file copy -force bak.db-journal test.db-journal + forcecopy bak.db-journal test.db-journal file attributes test.db-journal -permissions r--r--r-- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.5 { - file copy -force bak.db-journal test.db-journal + forcecopy bak.db-journal test.db-journal file attributes test.db-journal -permissions rw-rw-rw- catchsql { SELECT * FROM t1 } } {0 {1 2 3 4 5 6}} diff --git a/test/tkt35xx.test b/test/tkt35xx.test index d2a83cdefd..f9d10c3033 100644 --- a/test/tkt35xx.test +++ b/test/tkt35xx.test @@ -50,7 +50,7 @@ do_test tkt35xx-1.1 { # Trigger the problem using statement rollback. # db close -file delete test.db +delete_file test.db sqlite3 db test.db set big [string repeat abcdefghij 22] ;# 220 byte string do_test tkt35xx-1.2.1 { diff --git a/test/trigger1.test b/test/trigger1.test index 622aff2de7..dc344d4d0f 100644 --- a/test/trigger1.test +++ b/test/trigger1.test @@ -534,8 +534,8 @@ ifcapable conflict { # example, that you can drop and re-create tables referenced by triggers. ifcapable tempdb&&attach { do_test trigger1-10.0 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' AS aux; } diff --git a/test/trigger4.test b/test/trigger4.test index 0e44ce6ca7..a05a5e735f 100644 --- a/test/trigger4.test +++ b/test/trigger4.test @@ -130,8 +130,8 @@ do_test trigger4-3.7 { do_test trigger4-4.1 { db close - file delete -force trigtest.db - file delete -force trigtest.db-journal + forcedelete trigtest.db + forcedelete trigtest.db-journal sqlite3 db trigtest.db catchsql {drop table tbl; drop view vw} execsql { @@ -195,6 +195,6 @@ do_test trigger4-7.2 { integrity_check trigger4-99.9 db close -file delete -force trigtest.db trigtest.db-journal +forcedelete trigtest.db trigtest.db-journal finish_test diff --git a/test/triggerA.test b/test/triggerA.test index 9f93db5c99..0bc017ff5e 100644 --- a/test/triggerA.test +++ b/test/triggerA.test @@ -205,16 +205,16 @@ source $testdir/malloc_common.tcl # Save a copy of the current database configuration. # db close -file delete -force test.db-triggerA -file copy test.db test.db-triggerA +forcedelete test.db-triggerA +copy_file test.db test.db-triggerA sqlite3 db test.db # Run malloc tests on the INSTEAD OF trigger firing. # do_malloc_test triggerA-3 -tclprep { db close - file delete -force test.db test.db-journal - file copy -force test.db-triggerA test.db + forcedelete test.db test.db-journal + forcecopy test.db-triggerA test.db sqlite3 db test.db sqlite3_extended_result_codes db 1 db eval {SELECT * FROM v5; -- warm up the cache} @@ -225,6 +225,6 @@ do_malloc_test triggerA-3 -tclprep { # Clean up the saved database copy. # -file delete -force test.db-triggerA +forcedelete test.db-triggerA finish_test diff --git a/test/triggerC.test b/test/triggerC.test index e5a492a412..12a5e4ac08 100644 --- a/test/triggerC.test +++ b/test/triggerC.test @@ -918,7 +918,7 @@ do_test triggerC-11.4 { do_test triggerC-12.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { diff --git a/test/triggerD.test b/test/triggerD.test index 0cce4f3cde..a5dd4bdd58 100644 --- a/test/triggerD.test +++ b/test/triggerD.test @@ -193,7 +193,7 @@ do_test triggerD-3.2 { # do_test triggerD-4.1 { db close - file delete -force test.db test2.db + forcedelete test.db test2.db sqlite3 db test.db db eval { CREATE TABLE t1(x); diff --git a/test/vacuum.test b/test/vacuum.test index 34be57ce7c..9e6f5b2379 100644 --- a/test/vacuum.test +++ b/test/vacuum.test @@ -208,7 +208,7 @@ db3 close do_test vacuum-3.1 { db close db2 close - file delete test.db + delete_file test.db sqlite3 db test.db execsql { PRAGMA empty_result_callbacks=on; @@ -234,7 +234,7 @@ do_test vacuum-4.2 { ifcapable view { do_test vacuum-5.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db catchsql { CREATE TABLE Test (TestID int primary key); @@ -290,10 +290,10 @@ ifcapable {bloblit} { } # Check what happens when an in-memory database is vacuumed. The -# [file delete] command covers us in case the library was compiled +# [delete_file] command covers us in case the library was compiled # without in-memory database support. # -file delete -force :memory: +forcedelete :memory: do_test vacuum-7.0 { sqlite3 db2 :memory: execsql { @@ -337,8 +337,8 @@ db2 close # Ticket #873. VACUUM a database that has ' in its name. # do_test vacuum-8.1 { - file delete -force a'z.db - file delete -force a'z.db-journal + forcedelete a'z.db + forcedelete a'z.db-journal sqlite3 db2 a'z.db execsql { CREATE TABLE t1(t); @@ -383,6 +383,6 @@ ifcapable {autoinc} { } $::cksum } -file delete -force {a'z.db} +forcedelete {a'z.db} finish_test diff --git a/test/vacuum2.test b/test/vacuum2.test index 35524bb26c..b3bfab3022 100644 --- a/test/vacuum2.test +++ b/test/vacuum2.test @@ -135,7 +135,7 @@ db2 close ifcapable autovacuum { do_test vacuum2-4.1 { db close - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { pragma auto_vacuum=1; diff --git a/test/vacuum3.test b/test/vacuum3.test index f6b75d7070..484a7d448a 100644 --- a/test/vacuum3.test +++ b/test/vacuum3.test @@ -196,7 +196,7 @@ foreach {request actual} [list \ do_test vacuum3-4.1 { db close - file delete test.db + delete_file test.db sqlite3 db test.db execsql { PRAGMA page_size=1024; diff --git a/test/view.test b/test/view.test index a87d2770a0..b4440905f9 100644 --- a/test/view.test +++ b/test/view.test @@ -458,7 +458,7 @@ do_test view-12.1 { ifcapable attach { do_test view-13.1 { - file delete -force test2.db + forcedelete test2.db catchsql { ATTACH 'test2.db' AS two; CREATE TABLE two.t2(x,y); diff --git a/test/vtab1.test b/test/vtab1.test index a9aca503c4..c135d83bf0 100644 --- a/test/vtab1.test +++ b/test/vtab1.test @@ -724,8 +724,8 @@ do_test vtab1-6-8.4 { } {} execsql {PRAGMA count_changes=OFF} -file delete -force test2.db -file delete -force test2.db-journal +forcedelete test2.db +forcedelete test2.db-journal sqlite3 db2 test2.db execsql { CREATE TABLE techo(a PRIMARY KEY, b, c); diff --git a/test/vtab7.test b/test/vtab7.test index d1b1f590e2..162bab5e87 100644 --- a/test/vtab7.test +++ b/test/vtab7.test @@ -134,8 +134,8 @@ execsql {DROP TABLE newtab} # Write to an attached database from xSync(). ifcapable attach { do_test vtab7-3.1 { - file delete -force test2.db - file delete -force test2.db-journal + forcedelete test2.db + forcedelete test2.db-journal execsql { ATTACH 'test2.db' AS db2; CREATE TABLE db2.stuff(description, shape, color); diff --git a/test/vtabC.test b/test/vtabC.test index 824d4ca242..ca78b706f6 100644 --- a/test/vtabC.test +++ b/test/vtabC.test @@ -31,7 +31,7 @@ ifcapable !trigger { finish_test ; return } unset -nocomplain N for {set N 1} {$N<=20} {incr N} { db close - file delete -force test.db test.db-journal + forcedelete test.db test.db-journal sqlite3 db test.db register_echo_module [sqlite3_connection_pointer db] diff --git a/test/wal.test b/test/wal.test index 1aa70e0525..056becf7db 100644 --- a/test/wal.test +++ b/test/wal.test @@ -25,7 +25,7 @@ ifcapable !wal {finish_test ; return } proc reopen_db {} { catch { db close } - file delete -force test.db test.db-wal test.db-wal-summary + forcedelete test.db test.db-wal test.db-wal-summary sqlite3_wal db test.db } @@ -211,8 +211,8 @@ do_test wal-4.4.5 { execsql { SELECT count(*) FROM t2 } } {1} do_test wal-4.4.6 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3 db2 test2.db execsql { SELECT count(*) FROM t2 ; SELECT count(*) FROM t1 } db2 } {1 2} @@ -269,8 +269,8 @@ do_test wal-4.5.5 { execsql { SELECT count(*) FROM t2 ; SELECT count(*) FROM t1 } } {1 2} do_test wal-4.5.6 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3 db2 test2.db execsql { SELECT count(*) FROM t2 ; SELECT count(*) FROM t1 } db2 } {1 2} @@ -334,7 +334,7 @@ db close foreach sector {512 4096} { sqlite3_simulate_device -sectorsize $sector foreach pgsz {512 1024 2048 4096} { - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal do_test wal-6.$sector.$pgsz.1 { sqlite3 db test.db -vfs devsym execsql " @@ -357,7 +357,7 @@ foreach sector {512 4096} { } do_test wal-7.1 { - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal sqlite3_wal db test.db execsql { PRAGMA page_size = 1024; @@ -377,7 +377,7 @@ do_test wal-7.2 { do_test wal-8.1 { reopen_db catch { db close } - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal sqlite3 db test.db db function blob blob @@ -435,9 +435,9 @@ do_test wal-9.2 { } {ok} do_test wal-9.3 { - file delete -force test2.db test2.db-wal - file copy test.db test2.db - file copy test.db-wal test2.db-wal + forcedelete test2.db test2.db-wal + copy_file test.db test2.db + copy_file test.db-wal test2.db-wal sqlite3_wal db3 test2.db execsql {PRAGMA integrity_check } db3 } {ok} @@ -786,8 +786,8 @@ do_test wal-12.3 { list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044] } {3 2} do_test wal-12.4 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3_wal db2 test2.db execsql { SELECT * FROM t2 } db2 } {B 1} @@ -804,8 +804,8 @@ do_test wal-12.5 { execsql { SELECT * FROM t2 } } {B 2} do_test wal-12.6 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3_wal db2 test2.db execsql { SELECT * FROM t2 } db2 } {B 2} @@ -909,7 +909,7 @@ do_multiclient_test tn { catch { db close } catch { db2 close } catch { db3 close } -file delete -force test.db test.db-wal +forcedelete test.db test.db-wal sqlite3 db test.db sqlite3 db2 test.db do_test wal-14 { @@ -947,7 +947,7 @@ catch { db2 close } # The following block of tests - wal-15.* - focus on testing the # implementation of the sqlite3_wal_checkpoint() interface. # -file delete -force test.db test.db-wal +forcedelete test.db test.db-wal sqlite3 db test.db do_test wal-15.1 { execsql { @@ -1043,8 +1043,8 @@ foreach {tn ckpt_cmd ckpt_res ckpt_main ckpt_aux} { 9 {db eval "PRAGMA temp.wal_checkpoint"} {0 -1 -1} 0 0 } { do_test wal-16.$tn.1 { - file delete -force test2.db test2.db-wal test2.db-journal - file delete -force test.db test.db-wal test.db-journal + forcedelete test2.db test2.db-wal test2.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { @@ -1116,7 +1116,7 @@ foreach {tn sectorsize logsize} " 6 4096 [wal_file_size 176 512] 7 8192 [wal_file_size 184 512] " { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3_simulate_device -sectorsize $sectorsize sqlite3 db test.db -vfs devsym @@ -1160,7 +1160,7 @@ sqlite3_test_control_pending_byte $old_pending_byte # wal-18.2.* When the page-size field that occurs at the start of a log # file is a power of 2 greater than 16384 or smaller than 512. # -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal do_test wal-18.0 { sqlite3 db test.db execsql { @@ -1178,8 +1178,8 @@ do_test wal-18.0 { INSERT INTO t1 VALUES(5, 6); -- frames 5 and 6 } - file copy -force test.db testX.db - file copy -force test.db-wal testX.db-wal + forcecopy test.db testX.db + forcecopy test.db-wal testX.db-wal db close list [file size testX.db] [file size testX.db-wal] } [list [expr 3*1024] [wal_file_size 6 1024]] @@ -1195,8 +1195,8 @@ foreach {nFrame result} { 6 {0 0 1 2 3 4 5 6} } { do_test wal-18.1.$nFrame { - file copy -force testX.db test.db - file copy -force testX.db-wal test.db-wal + forcecopy testX.db test.db + forcecopy testX.db-wal test.db-wal hexio_write test.db-wal [expr 24 + $nFrame*(24+1024) + 20] 00000000 @@ -1232,7 +1232,7 @@ proc logcksum {ckv1 ckv2 blob} { } } -file copy -force test.db testX.db +forcecopy test.db testX.db foreach {tn pgsz works} { 1 128 0 2 256 0 @@ -1253,8 +1253,8 @@ foreach {tn pgsz works} { } for {set pg 1} {$pg <= 3} {incr pg} { - file copy -force testX.db test.db - file delete -force test.db-wal + forcecopy testX.db test.db + forcedelete test.db-wal # Check that the database now exists and consists of three pages. And # that there is no associated wal file. @@ -1321,7 +1321,7 @@ foreach {tn pgsz works} { # snapshot. # do_test wal-19.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db sqlite3 db2 test.db execsql { @@ -1370,7 +1370,7 @@ do_test wal-19.4 { # do_test wal-20.1 { catch {db close} - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA journal_mode = WAL; @@ -1476,7 +1476,7 @@ foreach pgsz {512 1024 2048 4096 8192 16384 32768 65536} { # set walfile [file nativename [file join [pwd] test.db-wal]] catch {db close} -file delete -force test.db +forcedelete test.db do_test wal-23.1 { faultsim_delete_and_reopen execsql { diff --git a/test/wal2.test b/test/wal2.test index 97966cd94e..51cfadd2d1 100644 --- a/test/wal2.test +++ b/test/wal2.test @@ -164,7 +164,7 @@ foreach {tn iInsert res wal_index_hdr_mod wal_locks} " db close db2 close tvfs delete -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal #------------------------------------------------------------------------- # This test case is very similar to the previous one, except, after @@ -271,7 +271,7 @@ foreach {tn iInsert res0 res1 wal_index_hdr_mod} { db close db2 close tvfs delete -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal if 0 { @@ -344,7 +344,7 @@ do_test wal2-3.5 { } {0 0} db close tvfs delete -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal } @@ -441,7 +441,7 @@ tvfs delete # connection silently remains in exclusive mode. # do_test wal2-6.1.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { Pragma Journal_Mode = Wal; @@ -484,7 +484,7 @@ do_test wal2-6.1.6 { db close do_test wal2-6.2.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { Pragma Locking_Mode = Exclusive; @@ -552,7 +552,7 @@ do_test wal2-6.2.9 { db close do_test wal2-6.3.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA journal_mode = WAL; @@ -597,7 +597,7 @@ db close # as expected when a WAL database is used with locking_mode=exclusive. # do_test wal2-6.4.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal proc tvfs_cb {method args} { set ::shm_file [lindex $args 0] if {$method == "xShmLock"} { lappend ::locks [lindex $args 2] } @@ -792,7 +792,7 @@ T delete # Test a theory about the checksum algorithm. Theory was false and this # test did not provoke a bug. # -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal do_test wal2-7.1.1 { sqlite3 db test.db execsql { @@ -803,8 +803,8 @@ do_test wal2-7.1.1 { file size test.db } {4096} do_test wal2-7.1.2 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal hexio_write test2.db-wal 48 FF } {1} do_test wal2-7.1.3 { @@ -814,7 +814,7 @@ do_test wal2-7.1.3 { } {} db close db2 close -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal do_test wal2-8.1.2 { sqlite3 db test.db execsql { @@ -870,7 +870,7 @@ testvfs tvfs tvfs script get_name tvfs filter xShmOpen -file delete -force test.db test.db-wal test.db-journal +forcedelete test.db test.db-wal test.db-journal do_test wal2-9.1 { sqlite3 db test.db -vfs tvfs execsql { diff --git a/test/wal3.test b/test/wal3.test index f7b55eb9bc..ea5e70571b 100644 --- a/test/wal3.test +++ b/test/wal3.test @@ -94,9 +94,9 @@ for {set i 1} {$i < 50} {incr i} { # Check that the file-system in its current state can be recovered. # - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal - file delete -force test2.db-journal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal + forcedelete test2.db-journal sqlite3 db2 test2.db do_test wal3-1.$i.5 { execsql { SELECT count(*) FROM t1 } db2 @@ -208,7 +208,7 @@ foreach {tn syncmode synccount} { lappend ::syncs [file tail $filename] $flags } do_test wal3-3.$tn { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal testvfs T T filter {} @@ -411,7 +411,7 @@ T delete catch {db close} testvfs T -default 1 do_test wal3-6.1.1 { - file delete -force test.db test.db-journal test.db wal + forcedelete test.db test.db-journal test.db wal sqlite3 db test.db execsql { PRAGMA auto_vacuum = off } execsql { PRAGMA journal_mode = WAL } @@ -492,7 +492,7 @@ db2 close db close do_test wal3-6.2.1 { - file delete -force test.db test.db-journal test.db wal + forcedelete test.db test.db-journal test.db wal sqlite3 db test.db sqlite3 db2 test.db execsql { PRAGMA auto_vacuum = off } @@ -558,7 +558,7 @@ T delete catch {db close} testvfs T -default 1 do_test wal3-7.1.1 { - file delete -force test.db test.db-journal test.db wal + forcedelete test.db test.db-journal test.db wal sqlite3 db test.db execsql { PRAGMA journal_mode = WAL; @@ -615,7 +615,7 @@ T delete #------------------------------------------------------------------------- # do_test wal3-8.1 { - file delete -force test.db test.db-journal test.db wal + forcedelete test.db test.db-journal test.db wal sqlite3 db test.db sqlite3 db2 test.db execsql { @@ -709,7 +709,7 @@ T delete set nConn 50 if { [string match *BSD $tcl_platform(os)] } { set nConn 25 } do_test wal3-9.0 { - file delete -force test.db test.db-journal test.db wal + forcedelete test.db test.db-journal test.db wal sqlite3 db test.db execsql { PRAGMA page_size = 1024; diff --git a/test/wal4.test b/test/wal4.test index 22ccfea72d..c7a4381341 100644 --- a/test/wal4.test +++ b/test/wal4.test @@ -31,7 +31,7 @@ do_test wal4-1.2 { # Save a copy of the file-system containing the wal and wal-index files # only (no database file). faultsim_save_and_close - file delete -force sv_test.db + forcedelete sv_test.db } {} do_test wal4-1.3 { diff --git a/test/walbak.test b/test/walbak.test index fe5b99e1a4..4224c5b48d 100644 --- a/test/walbak.test +++ b/test/walbak.test @@ -48,7 +48,7 @@ do_test walbak-1.0 { } } {wal} do_test walbak-1.1 { - file delete -force bak.db bak.db-journal bak.db-wal + forcedelete bak.db bak.db-journal bak.db-wal db backup bak.db file size bak.db } [expr 3*1024] @@ -106,7 +106,7 @@ proc sig {{db db}} { } } db close -file delete test.db +delete_file test.db sqlite3 db test.db do_test walbak-2.1 { execsql { PRAGMA journal_mode = WAL } @@ -236,7 +236,7 @@ foreach {tn setup} { } } { - foreach f [glob -nocomplain test.db*] { file delete -force $f } + foreach f [glob -nocomplain test.db*] { forcedelete $f } eval $setup diff --git a/test/walcksum.test b/test/walcksum.test index b2c4a90530..08278dd054 100644 --- a/test/walcksum.test +++ b/test/walcksum.test @@ -153,7 +153,7 @@ foreach endian {big little} { # do_test walcksum-1.$endian.1 { catch { db close } - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA page_size = 1024; @@ -172,8 +172,8 @@ foreach endian {big little} { INSERT INTO t1 VALUES(21, 'twentyone'); } - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal db close list [file size test2.db] [file size test2.db-wal] @@ -199,8 +199,8 @@ foreach endian {big little} { } {1} } do_test walcksum-1.$endian.4.1 { - file copy -force test2.db test.db - file copy -force test2.db-wal test.db-wal + forcecopy test2.db test.db + forcecopy test2.db-wal test.db-wal sqlite3 db test.db execsql { SELECT a FROM t1 } } {1 2 3 5 8 13 21} @@ -248,8 +248,8 @@ foreach endian {big little} { # Now that both the recoverer and non-recoverer have added frames to the # log file, check that it can still be recovered. # - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal do_test walcksum-1.$endian.7.11 { sqlite3 db3 test2.db execsql { @@ -294,7 +294,7 @@ foreach endian {big little} { # formatted (and can be recovered by a second process if required). # do_test walcksum-2.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { PRAGMA synchronous = NORMAL; @@ -322,8 +322,8 @@ do_test walcksum-2.1 { COMMIT; } - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3 db2 test2.db execsql { @@ -340,7 +340,7 @@ catch { db2 close } # invalid as a result. # do_test walcksum-3.1 { - file delete -force test.db test.db-wal test.db-journal + forcedelete test.db test.db-wal test.db-journal sqlite3 db test.db execsql { @@ -356,13 +356,13 @@ do_test walcksum-3.1 { file size test.db-wal } [wal_file_size 1 1024] do_test walcksum-3.2 { - file copy -force test.db-wal test2.db-wal - file copy -force test.db test2.db + forcecopy test.db-wal test2.db-wal + forcecopy test.db test2.db sqlite3 db2 test2.db execsql { SELECT a FROM t1 } db2 } {1 2 3} db2 close -file copy -force test.db test2.db +forcecopy test.db test2.db foreach incr {1 2 3 20 40 60 80 100 120 140 160 180 200 220 240 253 254 255} { @@ -370,7 +370,7 @@ foreach incr {1 2 3 20 40 60 80 100 120 140 160 180 200 220 240 253 254 255} { set FAIL 0 for {set iOff 0} {$iOff < [wal_file_size 1 1024]} {incr iOff} { - file copy -force test.db-wal test2.db-wal + forcecopy test.db-wal test2.db-wal set fd [open test2.db-wal r+] fconfigure $fd -encoding binary fconfigure $fd -translation binary diff --git a/test/walcrash.test b/test/walcrash.test index 0ef21fff3a..cfce5fed6d 100644 --- a/test/walcrash.test +++ b/test/walcrash.test @@ -37,7 +37,7 @@ set REPEATS 100 # walcrash-1.* # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal do_test walcrash-1.$i.1 { crashsql -delay 4 -file test.db-wal -seed [incr seed] { PRAGMA journal_mode = WAL; @@ -74,7 +74,7 @@ for {set i 1} {$i < $REPEATS} {incr i} { # walcrash-2.* # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal do_test walcrash-2.$i.1 { crashsql -delay 4 -file test.db-wal -seed [incr seed] { PRAGMA journal_mode = WAL; @@ -111,8 +111,8 @@ for {set i 1} {$i < $REPEATS} {incr i} { # walcrash-3.* # # for {set i 1} {$i < $REPEATS} {incr i} { -# file delete -force test.db test.db-wal -# file delete -force test2.db test2.db-wal +# forcedelete test.db test.db-wal +# forcedelete test2.db test2.db-wal # # do_test walcrash-3.$i.1 { # crashsql -delay 2 -file test2.db-wal -seed [incr seed] { @@ -143,8 +143,8 @@ for {set i 1} {$i < $REPEATS} {incr i} { # walcrash-4.* # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal - file delete -force test2.db test2.db-wal + forcedelete test.db test.db-wal + forcedelete test2.db test2.db-wal do_test walcrash-4.$i.1 { crashsql -delay 3 -file test.db-wal -seed [incr seed] -blocksize 4096 { @@ -171,8 +171,8 @@ for {set i 1} {$i < $REPEATS} {incr i} { # walcrash-5.* # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal - file delete -force test2.db test2.db-wal + forcedelete test.db test.db-wal + forcedelete test2.db test2.db-wal do_test walcrash-5.$i.1 { crashsql -delay 11 -file test.db-wal -seed [incr seed] -blocksize 4096 { @@ -212,8 +212,8 @@ for {set i 1} {$i < $REPEATS} {incr i} { # walcrash-6.* # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal - file delete -force test2.db test2.db-wal + forcedelete test.db test.db-wal + forcedelete test2.db test2.db-wal do_test walcrash-6.$i.1 { crashsql -delay 12 -file test.db-wal -seed [incr seed] -blocksize 512 { @@ -262,7 +262,7 @@ for {set i 1} {$i < $REPEATS} {incr i} { # based on the log file. # for {set i 1} {$i < $REPEATS} {incr i} { - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal # Select a page-size for this test. # diff --git a/test/walfault.test b/test/walfault.test index 3a90f9c693..1b71d78a4c 100644 --- a/test/walfault.test +++ b/test/walfault.test @@ -465,7 +465,7 @@ do_test walfault-13-pre-1 { COMMIT; } faultsim_save_and_close - file delete sv_test.db-shm + delete_file sv_test.db-shm } {} do_faultsim_test walfault-13.1 -prep { diff --git a/test/walmode.test b/test/walmode.test index 11113c6be3..4e14d54d4f 100644 --- a/test/walmode.test +++ b/test/walmode.test @@ -295,7 +295,7 @@ db close # loaded when sqlite3_prepare_v2() is called to compile the statement. # do_test walmode-7.0 { - file delete -force test.db + forcedelete test.db sqlite3 db test.db execsql { PRAGMA journal_mode = WAL; diff --git a/test/walnoshm.test b/test/walnoshm.test index de059dd5ca..d4082178dd 100644 --- a/test/walnoshm.test +++ b/test/walnoshm.test @@ -87,8 +87,8 @@ do_execsql_test 2.1.2 { } {exclusive wal} do_test 2.1.3 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3 db2 test2.db catchsql { SELECT * FROM t2 } db2 } {1 {unable to open database file}} @@ -104,8 +104,8 @@ do_test 2.1.5 { } {exclusive delete a b c d e f g h} do_test 2.2.1 { - file copy -force test.db test2.db - file copy -force test.db-wal test2.db-wal + forcecopy test.db test2.db + forcecopy test.db-wal test2.db-wal sqlite3 db3 test2.db -vfs tvfsshm sqlite3 db2 test2.db execsql { SELECT * FROM t2 } db3 diff --git a/test/walslow.test b/test/walslow.test index d726952804..83f292281a 100644 --- a/test/walslow.test +++ b/test/walslow.test @@ -21,7 +21,7 @@ ifcapable !wal {finish_test ; return } proc reopen_db {} { catch { db close } - file delete -force test.db test.db-wal + forcedelete test.db test.db-wal sqlite3 db test.db execsql { PRAGMA journal_mode = wal } } @@ -53,9 +53,9 @@ for {set seed 1} {$seed<10} {incr seed} { } {ok} do_test walslow-1.seed=$seed.$iTest.3 { - file delete -force testX.db testX.db-wal - file copy test.db testX.db - file copy test.db-wal testX.db-wal + forcedelete testX.db testX.db-wal + copy_file test.db testX.db + copy_file test.db-wal testX.db-wal sqlite3 db2 testX.db execsql { PRAGMA journal_mode = WAL } db2 diff --git a/test/walthread.test b/test/walthread.test index 9817c0e0f5..cbd6371857 100644 --- a/test/walthread.test +++ b/test/walthread.test @@ -129,7 +129,7 @@ proc do_thread_test {args} { puts "Running $P(testname) for $P(seconds) seconds..." catch { db close } - file delete -force test.db test.db-journal test.db-wal + forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db eval $P(init) @@ -508,12 +508,12 @@ do_thread_test walthread-5 -seconds $seconds(walthread-5) -init { COMMIT; } - file copy -force test.db-wal bak.db-wal - file copy -force test.db bak.db + forcecopy test.db-wal bak.db-wal + forcecopy test.db bak.db db close - file copy -force bak.db-wal test.db-wal - file copy -force bak.db test.db + forcecopy bak.db-wal test.db-wal + forcecopy bak.db test.db if {[file size test.db-wal] < [log_file_size [expr 64*1024] 1024]} { error "Somehow failed to create a large log file" From b4256996c4f65a002ba5f9f026be9d983a6fae93 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 2 Aug 2011 01:57:39 +0000 Subject: [PATCH 28/41] Make sure IS NOT NULL constraints work on virtual tables. Fix for ticket [6c14288a473ceff]. FossilOrigin-Name: a55f4ab99952a731e4cd8f6ef17389062e5ed4c5 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/where.c | 2 ++ test/vtabF.test | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 test/vtabF.test diff --git a/manifest b/manifest index 2828036c72..c87f2c9cc0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\s(humorous)\stypo\sin\sthe\slemon\sdocumentation. -D 2011-07-30T23:50:12.095 +C Make\ssure\sIS\sNOT\sNULL\sconstraints\swork\son\svirtual\stables.\nFix\sfor\sticket\s[6c14288a473ceff]. +D 2011-08-02T01:57:39.661 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -250,7 +250,7 @@ F src/vtab.c 901791a47318c0562cd0c676a2c6ff1bc530e582 F src/wal.c 3154756177d6219e233d84291d5b05f4e06ff5e9 F src/wal.h 66b40bd91bc29a5be1c88ddd1f5ade8f3f48728a F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 106cd9ab3eb410dfa7d0598194c277664bb2e9a3 +F src/where.c 7d09f4c1512affb60cc1190a4b33d121d4ce039a F test/8_3_names.test b93687beebd17f6ebf812405a6833bae5d1f4199 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -874,6 +874,7 @@ F test/vtabB.test 04df5dc531b9f44d9ca65b9c1b79f12b5922a796 F test/vtabC.test 1cf7896ab6859bfe3074244b2b0e12de5cbdd766 F test/vtabD.test 74167b1578e5886fe4c886d6bef2fd1406444c42 F test/vtabE.test 7c4693638d7797ce2eda17af74292b97e705cc61 +F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d @@ -953,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 1b56677bdfb102d070a2057a65ba424fec81131d -R 07a1c012e85371e0cbf430cb6bbf3579 +P ed630b012f468d6779b83dd8c4dbf3a8dafee573 +R 171bb090fbd613c7785a72bd19098ec2 U drh -Z 06c1fbb8b37310ceef1a2adde6978995 +Z 642ce1d00dc515b7cad2aa099629b2e0 diff --git a/manifest.uuid b/manifest.uuid index 313ea78ef0..7c80798eac 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed630b012f468d6779b83dd8c4dbf3a8dafee573 \ No newline at end of file +a55f4ab99952a731e4cd8f6ef17389062e5ed4c5 \ No newline at end of file diff --git a/src/where.c b/src/where.c index d312232868..21fb7f45f4 100644 --- a/src/where.c +++ b/src/where.c @@ -2142,6 +2142,7 @@ static sqlite3_index_info *allocateIndexInfo( testcase( pTerm->eOperator==WO_IN ); testcase( pTerm->eOperator==WO_ISNULL ); if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; + if( pTerm->wtFlags & TERM_VNULL ) continue; nTerm++; } @@ -2192,6 +2193,7 @@ static sqlite3_index_info *allocateIndexInfo( testcase( pTerm->eOperator==WO_IN ); testcase( pTerm->eOperator==WO_ISNULL ); if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue; + if( pTerm->wtFlags & TERM_VNULL ) continue; pIdxCons[j].iColumn = pTerm->u.leftColumn; pIdxCons[j].iTermOffset = i; pIdxCons[j].op = (u8)pTerm->eOperator; diff --git a/test/vtabF.test b/test/vtabF.test new file mode 100644 index 0000000000..b9341ea597 --- /dev/null +++ b/test/vtabF.test @@ -0,0 +1,45 @@ +# 2011 Aug 1 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# This file checks to make sure IS NOT NULL constraints work on +# virtual tables. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +ifcapable !vtab||!schema_pragmas { finish_test ; return } + +# Register the echo module +register_echo_module [sqlite3_connection_pointer db] + +do_test vtabE-1.1 { + execsql { + CREATE TABLE t1(a, b); + CREATE INDEX i1 ON t1(a); + CREATE INDEX i2 ON t1(b); + INSERT INTO t1 VALUES(10,110); + INSERT INTO t1 VALUES(11,111); + INSERT INTO t1 SELECT a+2, b+2 FROM t1; + INSERT INTO t1 SELECT null, b+4 FROM t1; + INSERT INTO t1 SELECT null, b+8 FROM t1; + INSERT INTO t1 SELECT null, b+16 FROM t1; + ANALYZE; + CREATE VIRTUAL TABLE tv1 USING echo(t1); + SELECT b FROM t1 WHERE a IS NOT NULL; + } +} {110 111 112 113} +do_test vtabE-1.2 { + execsql {SELECT b FROM tv1 WHERE a IS NOT NULL} +} {110 111 112 113} + + +finish_test From d88d10566ccd2652ba04f9b3333e4db17268e471 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 2 Aug 2011 19:30:20 +0000 Subject: [PATCH 29/41] Omit backcompat.test from the journaltest permutation because it uses WAL mode which is incompatible with journaltest. FossilOrigin-Name: 2bbf3150a4b7108e88ed81c1d40af6f06089e148 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c87f2c9cc0..b2ac744925 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sIS\sNOT\sNULL\sconstraints\swork\son\svirtual\stables.\nFix\sfor\sticket\s[6c14288a473ceff]. -D 2011-08-02T01:57:39.661 +C Omit\sbackcompat.test\sfrom\sthe\sjournaltest\spermutation\sbecause\sit\suses\sWAL\nmode\swhich\sis\sincompatible\swith\sjournaltest. +D 2011-08-02T19:30:20.260 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -616,7 +616,7 @@ F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16 -F test/permutations.test aae89941ca0968b53633c97b5dd0d6f9f9899d27 +F test/permutations.test 434b3c91168969cee1385663748106f5f13b2f9c F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P ed630b012f468d6779b83dd8c4dbf3a8dafee573 -R 171bb090fbd613c7785a72bd19098ec2 +P a55f4ab99952a731e4cd8f6ef17389062e5ed4c5 +R 2ce41a9c949729a862f5ca8012f8f07d U drh -Z 642ce1d00dc515b7cad2aa099629b2e0 +Z 9aaddca534c660973358cb12c28015e6 diff --git a/manifest.uuid b/manifest.uuid index 7c80798eac..92e2001b23 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a55f4ab99952a731e4cd8f6ef17389062e5ed4c5 \ No newline at end of file +2bbf3150a4b7108e88ed81c1d40af6f06089e148 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 57f69462a5..f9414263d1 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -726,7 +726,7 @@ test_suite "journaltest" -description { unregister_jt_vfs } -files [test_set $::allquicktests -exclude { wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test - async4.test bigfile.test + async4.test bigfile.test backcompat.test }] if {[info commands register_demovfs] != ""} { @@ -865,4 +865,3 @@ if {[info script] == $argv0} { main $argv finish_test } - From 82be3b03a82d9aa86faf0923751315c298be4f43 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 2 Aug 2011 19:59:39 +0000 Subject: [PATCH 30/41] Also exclude backcompat.test from inmemory_journal since inmemory_journal is not compatible with WAL mode. FossilOrigin-Name: 861a5b62430d0ada07a46d0e394fcf0b0faab1cd --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b2ac744925..b694564c7b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\sbackcompat.test\sfrom\sthe\sjournaltest\spermutation\sbecause\sit\suses\sWAL\nmode\swhich\sis\sincompatible\swith\sjournaltest. -D 2011-08-02T19:30:20.260 +C Also\sexclude\sbackcompat.test\sfrom\sinmemory_journal\ssince\sinmemory_journal\nis\snot\scompatible\swith\sWAL\smode. +D 2011-08-02T19:59:39.002 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -616,7 +616,7 @@ F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16 -F test/permutations.test 434b3c91168969cee1385663748106f5f13b2f9c +F test/permutations.test 2caebe3ac9c227b076fd58a9fbd818715ec59379 F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P a55f4ab99952a731e4cd8f6ef17389062e5ed4c5 -R 2ce41a9c949729a862f5ca8012f8f07d +P 2bbf3150a4b7108e88ed81c1d40af6f06089e148 +R f51d9dedae8eb970656d48fdd226276d U drh -Z 9aaddca534c660973358cb12c28015e6 +Z 87c30e1f6a8a2a4afd8eef59cabe937d diff --git a/manifest.uuid b/manifest.uuid index 92e2001b23..cfaaff0447 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2bbf3150a4b7108e88ed81c1d40af6f06089e148 \ No newline at end of file +861a5b62430d0ada07a46d0e394fcf0b0faab1cd \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index f9414263d1..49ad1ac72c 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -529,7 +529,7 @@ test_suite "inmemory_journal" -description { stmt.test # WAL mode is different. - wal* tkt-2d1a5c67d.test + wal* tkt-2d1a5c67d.test backcompat.test }] ifcapable mem3 { From 5ea4298c812a010a2c1691f718d5cdb3d447a6c4 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2011 20:03:36 +0000 Subject: [PATCH 31/41] Replace the missed 'file copy' in malloc_common.tcl with copy_file. FossilOrigin-Name: cd20b4ef6020c0cffe918362afc2b491fb95eb92 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/malloc_common.tcl | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index e172838233..8d774565a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sin\sthe\spermutation\schanges\sfrom\strunk. -D 2011-08-02T20:01:06.809 +C Replace\sthe\smissed\s'file\scopy'\sin\smalloc_common.tcl\swith\scopy_file. +D 2011-08-02T20:03:36.125 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -577,7 +577,7 @@ F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6 F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9 -F test/malloc_common.tcl 9a329bb7fd3723ee508542be8ff428bf33cccc92 +F test/malloc_common.tcl 2930895b0962823ec679853e67e58dd6d8198b3c F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test 708a028d6d373e5b3842e4bdc8ba80998c9a4da6 @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 8bef97a0eb2f56d0ac374d97e97e0a44c7f99aee 2bbf3150a4b7108e88ed81c1d40af6f06089e148 861a5b62430d0ada07a46d0e394fcf0b0faab1cd -R 71d14b2778e99286bdae280684de342f -U drh -Z dc3b5053c70dc32d5e9154bd65bfd193 +P b30a5e307fd5485d23e4c4f8ed1c47525a0fe6d3 +R b771650dd0d348534e7a0e458639f43f +U mistachkin +Z b38b345a5f7b867577bd2e55767a9c11 diff --git a/manifest.uuid b/manifest.uuid index c81095cac9..67327d5960 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b30a5e307fd5485d23e4c4f8ed1c47525a0fe6d3 \ No newline at end of file +cd20b4ef6020c0cffe918362afc2b491fb95eb92 \ No newline at end of file diff --git a/test/malloc_common.tcl b/test/malloc_common.tcl index 7a135aeadb..5937b958f8 100644 --- a/test/malloc_common.tcl +++ b/test/malloc_common.tcl @@ -425,7 +425,7 @@ proc do_malloc_test {tn args} { forcedelete test2.db-journal forcedelete test2.db-wal if {[info exists ::mallocopts(-testdb)]} { - file copy $::mallocopts(-testdb) test.db + copy_file $::mallocopts(-testdb) test.db } catch { sqlite3 db test.db } if {[info commands db] ne ""} { From 8b0228f1a68f085a117b6c6fc82d32fc34d8d83d Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 2 Aug 2011 20:14:55 +0000 Subject: [PATCH 32/41] Exclude the 8_3_names.test script from the inmemory_journal permutation. FossilOrigin-Name: 78fc94c8d1229a8bdc9390e98b53c57aeef7fc46 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/permutations.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index b694564c7b..1ed597e14c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Also\sexclude\sbackcompat.test\sfrom\sinmemory_journal\ssince\sinmemory_journal\nis\snot\scompatible\swith\sWAL\smode. -D 2011-08-02T19:59:39.002 +C Exclude\sthe\s8_3_names.test\sscript\sfrom\sthe\sinmemory_journal\spermutation. +D 2011-08-02T20:14:55.667 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -616,7 +616,7 @@ F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806 F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16 -F test/permutations.test 2caebe3ac9c227b076fd58a9fbd818715ec59379 +F test/permutations.test 2c845b5c8cd2abb32f07076734d10e6a9fd19f26 F test/pragma.test fdfc09067ea104a0c247a1a79d8093b56656f850 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 2bbf3150a4b7108e88ed81c1d40af6f06089e148 -R f51d9dedae8eb970656d48fdd226276d +P 861a5b62430d0ada07a46d0e394fcf0b0faab1cd +R 0ac986e6982ac12d722abe7bcb3da618 U drh -Z 87c30e1f6a8a2a4afd8eef59cabe937d +Z 3a732f4c9d85bdfbca1dba2584684292 diff --git a/manifest.uuid b/manifest.uuid index cfaaff0447..9e9af6b5d0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -861a5b62430d0ada07a46d0e394fcf0b0faab1cd \ No newline at end of file +78fc94c8d1229a8bdc9390e98b53c57aeef7fc46 \ No newline at end of file diff --git a/test/permutations.test b/test/permutations.test index 49ad1ac72c..98af57c27f 100644 --- a/test/permutations.test +++ b/test/permutations.test @@ -520,7 +520,7 @@ test_suite "inmemory_journal" -description { # the number of fsync() calls. pager.test exclusive.test jrnlmode.test sync.test misc1.test journal1.test conflict.test crash8.test tkt3457.test io.test - journal3.test + journal3.test 8_3_names.test pager1.test async4.test corrupt.test filefmt.test pager2.test corrupt5.test corruptA.test pageropt.test From 1b466a605dd3270c68d623254bcf5c8a02bd2ade Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2011 20:19:48 +0000 Subject: [PATCH 33/41] Fix missing info exists check for win32lock-2.2 (the one previously applied to win32lock-1.2). FossilOrigin-Name: 8a52698e642f40a32d09a6a00b63f25ac38f3fda --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/win32lock.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 8d774565a2..c460c26c05 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Replace\sthe\smissed\s'file\scopy'\sin\smalloc_common.tcl\swith\scopy_file. -D 2011-08-02T20:03:36.125 +C Fix\smissing\sinfo\sexists\scheck\sfor\swin32lock-2.2\s(the\sone\spreviously\sapplied\sto\swin32lock-1.2). +D 2011-08-02T20:19:48.906 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -913,7 +913,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test e12fe40524705cde9a4f5af4668e811807807b84 +F test/win32lock.test cc90e3a73591b6e480b18ce864474908cccfb0d7 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P b30a5e307fd5485d23e4c4f8ed1c47525a0fe6d3 -R b771650dd0d348534e7a0e458639f43f +P cd20b4ef6020c0cffe918362afc2b491fb95eb92 +R 2c64effa9318d3db741b9bcbc99c8349 U mistachkin -Z b38b345a5f7b867577bd2e55767a9c11 +Z 8b2de65f0513dc9d6a9c2ea9b8d5fabb diff --git a/manifest.uuid b/manifest.uuid index 67327d5960..c7fcddf90f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cd20b4ef6020c0cffe918362afc2b491fb95eb92 \ No newline at end of file +8a52698e642f40a32d09a6a00b63f25ac38f3fda \ No newline at end of file diff --git a/test/win32lock.test b/test/win32lock.test index 8ed467cfc8..b6f993f062 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -89,7 +89,7 @@ while {1} { do_test win32lock-2.2-$delay1 { set ::msg } {1 100000 2 50000 3 25000 4 12500} - if {$::log!=""} { + if {[info exists ::log] && $::log!=""} { do_test win32lock-2.2-$delay1-log1 { regsub {\d+} $::log # x set x From 176f1b47e509d588db24db3fb475372eac653aa4 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2011 23:34:00 +0000 Subject: [PATCH 34/41] Correct subtle timing issues in the win32lock test cases and in the lock_win32_file Tcl command. Also, eliminate superfluous MSVC compiler warnings. FossilOrigin-Name: 7baf02946e14eb889d864984ff3b3822aad8a3c9 --- Makefile.msc | 5 +++++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/test1.c | 26 ++++++++++++++++++++++++-- test/win32lock.test | 38 +++++++++++++++++++++++--------------- 5 files changed, 61 insertions(+), 26 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 799970d5f9..88a2af7c92 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -43,6 +43,11 @@ TCC = $(TCC) -I$(TOP)\ext\rtree # TCC = $(TCC) -DNDEBUG +# +# Prevent warnings about "insecure" runtime library functions being used. +# +TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS + # The locations of the Tcl header and library files. Also, the library that # non-stubs enabled programs using Tcl must link against. These variables # (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment diff --git a/manifest b/manifest index c460c26c05..f69eab9273 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\smissing\sinfo\sexists\scheck\sfor\swin32lock-2.2\s(the\sone\spreviously\sapplied\sto\swin32lock-1.2). -D 2011-08-02T20:19:48.906 +C Correct\ssubtle\stiming\sissues\sin\sthe\swin32lock\stest\scases\sand\sin\sthe\slock_win32_file\sTcl\scommand.\s\sAlso,\seliminate\ssuperfluous\sMSVC\scompiler\swarnings. +D 2011-08-02T23:34:00.968 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 8e04f517922b9e31a5bf975f07bb66df79ae7076 +F Makefile.msc 9fd0401b0134b565a9c7d8ed49dc044cc89f2096 F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54 @@ -188,7 +188,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c c355b33803fb756dc09297ec84d19604301fa622 -F src/test1.c e7ea726d26b9007bae7907d8b40280c70ec6c504 +F src/test1.c 9952abd6dc729eb1c011b71ee26a8b49d0aa7c10 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -913,7 +913,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test cc90e3a73591b6e480b18ce864474908cccfb0d7 +F test/win32lock.test 7144fb147f7096807b22c98a44c4f2d9649b1175 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P cd20b4ef6020c0cffe918362afc2b491fb95eb92 -R 2c64effa9318d3db741b9bcbc99c8349 +P 8a52698e642f40a32d09a6a00b63f25ac38f3fda +R e99f54a15d751a5d0d488d9edef3a843 U mistachkin -Z 8b2de65f0513dc9d6a9c2ea9b8d5fabb +Z a80ca8d406d4afb3329eb0410ed145e3 diff --git a/manifest.uuid b/manifest.uuid index c7fcddf90f..e5078b1ddd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8a52698e642f40a32d09a6a00b63f25ac38f3fda \ No newline at end of file +7baf02946e14eb889d864984ff3b3822aad8a3c9 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index 9a5a50103f..3b933ba686 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5645,6 +5645,7 @@ static int test_test_control( ** background thread. */ struct win32FileLocker { + char *evName; /* Name of event to signal thread startup */ HANDLE h; /* Handle of the file to be locked */ int delay1; /* Delay before locking */ int delay2; /* Delay before unlocking */ @@ -5660,6 +5661,13 @@ struct win32FileLocker { */ static void win32_file_locker(void *pAppData){ struct win32FileLocker *p = (struct win32FileLocker*)pAppData; + if( p->evName ){ + HANDLE ev = OpenEvent(EVENT_MODIFY_STATE, FALSE, p->evName); + if ( ev ){ + SetEvent(ev); + CloseHandle(ev); + } + } if( p->delay1 ) Sleep(p->delay1); if( LockFile(p->h, 0, 0, 100000000, 0) ){ Sleep(p->delay2); @@ -5688,16 +5696,18 @@ static int win32_file_lock( int objc, Tcl_Obj *CONST objv[] ){ - static struct win32FileLocker x = { 0, 0, 0 }; + static struct win32FileLocker x = { "win32_file_lock", 0, 0, 0, 0, 0 }; const char *zFilename; + char zBuf[200]; int retry = 0; + HANDLE ev; + DWORD wResult; if( objc!=4 && objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME DELAY1 DELAY2"); return TCL_ERROR; } if( objc==1 ){ - char zBuf[200]; sqlite3_snprintf(sizeof(zBuf), zBuf, "%d %d %d %d %d", x.ok, x.err, x.delay1, x.delay2, x.h); Tcl_AppendResult(interp, zBuf, (char*)0); @@ -5721,8 +5731,20 @@ static int win32_file_lock( Tcl_AppendResult(interp, "cannot open file: ", zFilename, (char*)0); return TCL_ERROR; } + ev = CreateEvent(NULL, TRUE, FALSE, x.evName); + if ( !ev ){ + Tcl_AppendResult(interp, "cannot create event: ", x.evName, (char*)0); + return TCL_ERROR; + } _beginthread(win32_file_locker, 0, (void*)&x); Sleep(0); + if ( (wResult = WaitForSingleObject(ev, 10000))!=WAIT_OBJECT_0 ){ + sqlite3_snprintf(sizeof(zBuf), zBuf, "0x%x", wResult); + Tcl_AppendResult(interp, "wait failed: ", zBuf, (char*)0); + CloseHandle(ev); + return TCL_ERROR; + } + CloseHandle(ev); return TCL_OK; } #endif diff --git a/test/win32lock.test b/test/win32lock.test index b6f993f062..5390222a0c 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -41,20 +41,23 @@ do_test win32lock-1.1 { } {1 100000 2 50000 3 25000 4 12500} unset -nocomplain delay1 rc msg -set delay1 50 -set rc 0 set old_pending_byte [sqlite3_test_control_pending_byte 0x40000000] + +set win32_lock_ok [list] +set win32_lock_error [list] +set delay1 25 while {1} { - sqlite3_sleep 10 lock_win32_file test.db 0 $::delay1 + set ::log {} set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg] if {$rc} { - do_test win32lock-1.2-$delay1-fin { + lappend win32_lock_error $::delay1 + do_test win32lock-1.2-$delay1-error { set ::msg } {disk I/O error} - break } else { - do_test win32lock-1.2-$delay1 { + lappend win32_lock_ok $::delay1 + do_test win32lock-1.2-$delay1-ok { set ::msg } {1 100000 2 50000 3 25000 4 12500} if {[info exists ::log] && $::log!=""} { @@ -63,9 +66,10 @@ while {1} { set x } {{delayed #ms for lock/sharing conflict}} } - incr delay1 50 } - set ::log {} + if {[llength $win32_lock_ok] && [llength $win32_lock_error]} break + incr delay1 25 + sqlite3_sleep 10 } do_test win32lock-2.0 { @@ -75,18 +79,21 @@ do_test win32lock-2.1 { file_control_win32_av_retry db 1 1 } {0 1 1} -set delay1 50 +set win32_lock_ok [list] +set win32_lock_error [list] +set delay1 1 while {1} { - sqlite3_sleep 10 lock_win32_file test.db 0 $::delay1 + set ::log {} set rc [catch {db eval {SELECT x, length(y) FROM t1 ORDER BY rowid}} msg] if {$rc} { - do_test win32lock-2.2-$delay1-fin { + lappend win32_lock_error $::delay1 + do_test win32lock-2.2-$delay1-error { set ::msg } {disk I/O error} - break } else { - do_test win32lock-2.2-$delay1 { + lappend win32_lock_ok $::delay1 + do_test win32lock-2.2-$delay1-ok { set ::msg } {1 100000 2 50000 3 25000 4 12500} if {[info exists ::log] && $::log!=""} { @@ -95,9 +102,10 @@ while {1} { set x } {{delayed #ms for lock/sharing conflict}} } - incr delay1 50 } - set ::log {} + if {[llength $win32_lock_ok] && [llength $win32_lock_error]} break + incr delay1 1 + sqlite3_sleep 10 } file_control_win32_av_retry db 10 25 From 85e444cab43e5e648a6f95935713f3b54e89627f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 2 Aug 2011 23:45:53 +0000 Subject: [PATCH 35/41] Add explanatory comment to the win32lock-2.2 test case. FossilOrigin-Name: 4cb17881d9676fa3359394391b9ba53f08e5809a --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/win32lock.test | 8 ++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index f69eab9273..880ff3ba85 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Correct\ssubtle\stiming\sissues\sin\sthe\swin32lock\stest\scases\sand\sin\sthe\slock_win32_file\sTcl\scommand.\s\sAlso,\seliminate\ssuperfluous\sMSVC\scompiler\swarnings. -D 2011-08-02T23:34:00.968 +C Add\sexplanatory\scomment\sto\sthe\swin32lock-2.2\stest\scase. +D 2011-08-02T23:45:53.187 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -913,7 +913,7 @@ F test/where9.test 24f19ad14bb1b831564ced5273e681e495662848 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 -F test/win32lock.test 7144fb147f7096807b22c98a44c4f2d9649b1175 +F test/win32lock.test d60b39c53c68617524429be27bf239f0b11673f2 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -954,7 +954,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 8a52698e642f40a32d09a6a00b63f25ac38f3fda -R e99f54a15d751a5d0d488d9edef3a843 +P 7baf02946e14eb889d864984ff3b3822aad8a3c9 +R 47b1cf7826a3e63c594957b3cfc97529 U mistachkin -Z a80ca8d406d4afb3329eb0410ed145e3 +Z 7b594a9d83a13099dd5de5b0bd599b2c diff --git a/manifest.uuid b/manifest.uuid index e5078b1ddd..7e6bee9e52 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7baf02946e14eb889d864984ff3b3822aad8a3c9 \ No newline at end of file +4cb17881d9676fa3359394391b9ba53f08e5809a \ No newline at end of file diff --git a/test/win32lock.test b/test/win32lock.test index 5390222a0c..7fed2e0c08 100644 --- a/test/win32lock.test +++ b/test/win32lock.test @@ -79,6 +79,14 @@ do_test win32lock-2.1 { file_control_win32_av_retry db 1 1 } {0 1 1} +# +# NOTE: It is known that the win32lock-2.2-* tests may fail if the system is +# experiencing heavy load (i.e. they are very timing sensitive). This is +# primarily due to the AV retry delay being set to 1 millisecond in the +# win32lock-2.1 test (above). While it is important to test this corner +# case for the AV retry logic, a failure of this test should probably not +# be interpreted as a bug in SQLite or these test cases. +# set win32_lock_ok [list] set win32_lock_error [list] set delay1 1 From 52043d7d456cede16b51f2f5f77dd7a3bb1ac59d Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 3 Aug 2011 16:40:15 +0000 Subject: [PATCH 36/41] Update the OP_Move opcode to shift the pScopyFrom pointer of aliases when compiled with SQLITE_DEBUG. Ticket [d63523637517386191]. FossilOrigin-Name: a2135ad13049c170b33315a949b1544e6a136183 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/vdbe.c | 5 +++++ test/tkt-d635236375.test | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 test/tkt-d635236375.test diff --git a/manifest b/manifest index 1ed597e14c..f8aebc816c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Exclude\sthe\s8_3_names.test\sscript\sfrom\sthe\sinmemory_journal\spermutation. -D 2011-08-02T20:14:55.667 +C Update\sthe\sOP_Move\sopcode\sto\sshift\sthe\spScopyFrom\spointer\sof\saliases\swhen\ncompiled\swith\sSQLITE_DEBUG.\s\sTicket\s[d63523637517386191]. +D 2011-08-03T16:40:15.202 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -238,7 +238,7 @@ F src/update.c 74a6cfb34e9732c1e2a86278b229913b4b51eeec F src/utf.c c53eb7404b3eb5c1cbb5655c6a7a0e0ce6bd50f0 F src/util.c 06302ffd2b80408d4f6c7af71f7090e0cf8d8ff7 F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e -F src/vdbe.c a9ced64f380bbd8b04da3a1c3a9602d3942704b5 +F src/vdbe.c 49d834f0fe49d305e07f9c212e94007fda2028e9 F src/vdbe.h 5cf09e7ee8a3f7d93bc51f196a96550786afe7a1 F src/vdbeInt.h ad84226cc0adcb1185c22b70696b235a1678bb45 F src/vdbeapi.c 11dc47987abacb76ad016dcf5abc0dc422482a98 @@ -735,6 +735,7 @@ F test/tkt-b72787b1.test e6b62b2b2785c04d0d698d6a603507e384165049 F test/tkt-bd484a090c.test 60460bf946f79a79712b71f202eda501ca99b898 F test/tkt-cbd054fa6b.test f14f97ea43662e6f70c9e63287081e8be5d9d589 F test/tkt-d11f09d36e.test fb44f7961aa6d4b632fb7b9768239832210b5fc7 +F test/tkt-d635236375.test 9d37e988b47d87505bc9445be0ca447002df5d09 F test/tkt-d82e3f3721.test 731359dfdcdb36fea0559cd33fec39dd0ceae8e6 F test/tkt-f3e5abed55.test 19fb59268da6f20a69a181b9c14154132d1c65e3 F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87 @@ -954,7 +955,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 861a5b62430d0ada07a46d0e394fcf0b0faab1cd -R 0ac986e6982ac12d722abe7bcb3da618 +P 78fc94c8d1229a8bdc9390e98b53c57aeef7fc46 +R bf0be95f6edb13861054cdf974a28d09 U drh -Z 3a732f4c9d85bdfbca1dba2584684292 +Z 63c3906617d97d8acb37208d4ff59628 diff --git a/manifest.uuid b/manifest.uuid index 9e9af6b5d0..fe62bb02b3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -78fc94c8d1229a8bdc9390e98b53c57aeef7fc46 \ No newline at end of file +a2135ad13049c170b33315a949b1544e6a136183 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index bec422a988..6b817ab6d6 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -1027,6 +1027,11 @@ case OP_Move: { zMalloc = pOut->zMalloc; pOut->zMalloc = 0; sqlite3VdbeMemMove(pOut, pIn1); +#ifdef SQLITE_DEBUG + if( pOut->pScopyFrom>=&aMem[p1] && pOut->pScopyFrom<&aMem[p1+pOp->p3] ){ + pOut->pScopyFrom += p1 - pOp->p2; + } +#endif pIn1->zMalloc = zMalloc; REGISTER_TRACE(p2++, pOut); pIn1++; diff --git a/test/tkt-d635236375.test b/test/tkt-d635236375.test new file mode 100644 index 0000000000..3fc782265e --- /dev/null +++ b/test/tkt-d635236375.test @@ -0,0 +1,38 @@ +# 2011 August 3 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The +# focus of this file is testing that bug [d63523637517386191d634e] +# has been fixed. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +set ::testprefix tkt-d635236375 + +do_test 1.0 { + execsql { + CREATE TABLE t1(id1 INTEGER PRIMARY KEY); + INSERT INTO t1 VALUES(9999); + CREATE TABLE t2(id2 INTEGER PRIMARY KEY); + INSERT INTO t2 VALUES(12345); + INSERT INTO t2 VALUES(54321); + SELECT DISTINCT id1 AS x, id1 AS y FROM t1, t2; + } +} {9999 9999} +do_test 1.1 { + execsql { + SELECT count(*) FROM t1, t2 GROUP BY id1, id1; + } +} {2} + + +finish_test From a5ae4c330b57fd41db7de2de5a0d18c6efa60e98 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 7 Aug 2011 01:31:52 +0000 Subject: [PATCH 37/41] Remove relevant elements from the sqlite_stat2 table when doing a DROP INDEX or DROP TABLE. FossilOrigin-Name: 3c8f97ae527e380bf2583c7cf8ceac9509f29bfe --- manifest | 14 ++++++------ manifest.uuid | 2 +- src/build.c | 42 +++++++++++++++++++++------------- test/analyze.test | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 24 deletions(-) diff --git a/manifest b/manifest index 6ca37535c3..c7387e5946 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\swinopen-retry-logic\sbranch\sinto\strunk.\s\sThe\sbiggest\schange\shere\nis\sto\stest\sscripts,\swhich\sshould\snow\suse\ssuch\sas\scopy_file\sand\ndelete_file\sfrom\stester.tcl\srather\sthan\sthe\sraw\sfile\scommands\sof\sTCL. -D 2011-08-03T22:06:39.312 +C Remove\srelevant\selements\sfrom\sthe\ssqlite_stat2\stable\swhen\sdoing\sa\sDROP\nINDEX\sor\sDROP\sTABLE. +D 2011-08-07T01:31:52.877 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -127,7 +127,7 @@ F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 F src/btree.c 8c46f0ab69ad9549c75a3a91fed87abdaa743e2f F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3 -F src/build.c 5e614e586d9f8a81c16c80b545b9e1747f96c1bb +F src/build.c 19a8957a442d922a0d6ed1a5dd67b63202fc3260 F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c 7deec4534f3b5a0c3b4a4cbadf809d321f64f9c4 @@ -260,7 +260,7 @@ F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060 F test/alter3.test 49c9d9fba2b8fcdce2dedeca97bbf1f369cc548d F test/alter4.test b2debc14d8cbe4c1d12ccd6a41eef88a8c1f15d5 F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc -F test/analyze.test c8cb89e8736336f1f0646c8123e6028a14c7b55e +F test/analyze.test 68b43c1f9cd6ffc3bbb30d27a23712b38c413eca F test/analyze2.test 8f2b1534d43f5547ce9a6b736c021d4192c75be3 F test/analyze3.test d61f55d8b472fc6e713160b1e577f7a68e63f38b F test/analyze4.test 757b37875cf9bb528d46f74497bc789c88365045 @@ -955,7 +955,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P a2135ad13049c170b33315a949b1544e6a136183 4cb17881d9676fa3359394391b9ba53f08e5809a -R 69e73a0d833d24111d142317de3be42c +P b90c28be3840169651022ef36cd7cf416bc22305 +R 73598e00e938e090a06d21036269e1f1 U drh -Z e1999267404d37fe86d90d3e80b00531 +Z 41423adf91510090095a57365c2e79b2 diff --git a/manifest.uuid b/manifest.uuid index c95e730993..5575d8da98 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b90c28be3840169651022ef36cd7cf416bc22305 \ No newline at end of file +3c8f97ae527e380bf2583c7cf8ceac9509f29bfe \ No newline at end of file diff --git a/src/build.c b/src/build.c index 455b35b56e..f609ed8379 100644 --- a/src/build.c +++ b/src/build.c @@ -1980,6 +1980,29 @@ static void destroyTable(Parse *pParse, Table *pTab){ #endif } +/* +** Remove entries from the sqlite_stat1 and sqlite_stat2 tables +** after a DROP INDEX or DROP TABLE command. +*/ +static void sqlite3ClearStatTables( + Parse *pParse, /* The parsing context */ + int iDb, /* The database number */ + const char *zType, /* "idx" or "tbl" */ + const char *zName /* Name of index or table */ +){ + static const char *azStatTab[] = { "sqlite_stat1", "sqlite_stat2" }; + int i; + const char *zDbName = pParse->db->aDb[iDb].zName; + for(i=0; idb, azStatTab[i], zDbName) ){ + sqlite3NestedParse(pParse, + "DELETE FROM %Q.%s WHERE %s=%Q", + zDbName, azStatTab[i], zType, zName + ); + } + } +} + /* ** This routine is called to do the work of a DROP TABLE statement. ** pName is the name of the table to be dropped. @@ -2119,14 +2142,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ sqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'", pDb->zName, SCHEMA_TABLE(iDb), pTab->zName); - - /* Drop any statistics from the sqlite_stat1 table, if it exists */ - if( sqlite3FindTable(db, "sqlite_stat1", db->aDb[iDb].zName) ){ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q", pDb->zName, pTab->zName - ); - } - + sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName); if( !isView && !IsVirtual(pTab) ){ destroyTable(pParse, pTab); } @@ -2949,15 +2965,9 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){ sqlite3BeginWriteOperation(pParse, 1, iDb); sqlite3NestedParse(pParse, "DELETE FROM %Q.%s WHERE name=%Q AND type='index'", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), - pIndex->zName + db->aDb[iDb].zName, SCHEMA_TABLE(iDb), pIndex->zName ); - if( sqlite3FindTable(db, "sqlite_stat1", db->aDb[iDb].zName) ){ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.sqlite_stat1 WHERE idx=%Q", - db->aDb[iDb].zName, pIndex->zName - ); - } + sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName); sqlite3ChangeCookie(pParse, iDb); destroyRootPage(pParse, pIndex->tnum, iDb); sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0); diff --git a/test/analyze.test b/test/analyze.test index 766cd50d1f..6bb8cc363c 100644 --- a/test/analyze.test +++ b/test/analyze.test @@ -287,6 +287,64 @@ do_test analyze-4.3 { } } {} +# Verify that DROP TABLE and DROP INDEX remove entries from the +# sqlite_stat1 and sqlite_stat2 tables. +# +do_test analyze-5.0 { + execsql { + DELETE FROM t3; + DELETE FROM t4; + INSERT INTO t3 VALUES(1,2,3,4); + INSERT INTO t3 VALUES(5,6,7,8); + INSERT INTO t3 SELECT a+8, b+8, c+8, d+8 FROM t3; + INSERT INTO t3 SELECT a+16, b+16, c+16, d+16 FROM t3; + INSERT INTO t3 SELECT a+32, b+32, c+32, d+32 FROM t3; + INSERT INTO t3 SELECT a+64, b+64, c+64, d+64 FROM t3; + INSERT INTO t4 SELECT a, b, c FROM t3; + ANALYZE; + SELECT DISTINCT idx FROM sqlite_stat1 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat1 ORDER BY 1; + } +} {t3i1 t3i2 t3i3 t4i1 t4i2 t3 t4} +ifcapable stat2 { + do_test analyze-5.1 { + execsql { + SELECT DISTINCT idx FROM sqlite_stat2 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat2 ORDER BY 1; + } + } {t3i1 t3i2 t3i3 t4i1 t4i2 t3 t4} +} +do_test analyze-5.2 { + execsql { + DROP INDEX t3i2; + SELECT DISTINCT idx FROM sqlite_stat1 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat1 ORDER BY 1; + } +} {t3i1 t3i3 t4i1 t4i2 t3 t4} +ifcapable stat2 { + do_test analyze-5.3 { + execsql { + SELECT DISTINCT idx FROM sqlite_stat2 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat2 ORDER BY 1; + } + } {t3i1 t3i3 t4i1 t4i2 t3 t4} +} +do_test analyze-5.4 { + execsql { + DROP TABLE t3; + SELECT DISTINCT idx FROM sqlite_stat1 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat1 ORDER BY 1; + } +} {t4i1 t4i2 t4} +ifcapable stat2 { + do_test analyze-5.5 { + execsql { + SELECT DISTINCT idx FROM sqlite_stat2 ORDER BY 1; + SELECT DISTINCT tbl FROM sqlite_stat2 ORDER BY 1; + } + } {t4i1 t4i2 t4} +} + # This test corrupts the database file so it must be the last test # in the series. # From 036ac7fa90afe12eb267e76fbfd94c239a871ac6 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 8 Aug 2011 23:18:05 +0000 Subject: [PATCH 38/41] Allow the unlink() system call to be overridden in os_unix.c. FossilOrigin-Name: 8d1b5c3ac027ac00d57a250aad45230a09645617 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 19 +++++++++++-------- test/syscall.test | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index c7387e5946..43f92ee863 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\srelevant\selements\sfrom\sthe\ssqlite_stat2\stable\swhen\sdoing\sa\sDROP\nINDEX\sor\sDROP\sTABLE. -D 2011-08-07T01:31:52.877 +C Allow\sthe\sunlink()\ssystem\scall\sto\sbe\soverridden\sin\sos_unix.c. +D 2011-08-08T23:18:05.791 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c 51caec436f811fa387a85cf7b05f13962c7fe0dc +F src/os_unix.c 597c854d9428b547717bcc9d2fc885a8030d7f86 F src/os_win.c 4eb6fa00ee28f6d7bad0526edcbe5a60d297c67a F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -688,7 +688,7 @@ F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/superlock.test 5d7a4954b0059c903f82c7b67867bc5451a7c082 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85 -F test/syscall.test 707c95e4ab7863e13f1293c6b0c76bead30249b3 +F test/syscall.test a9d065ad1ef5f32446b1cb585a0e085b4e0996f5 F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f F test/table.test 50c47f5fe9c112e92723af27cd735e6c92de6f85 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 @@ -955,7 +955,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P b90c28be3840169651022ef36cd7cf416bc22305 -R 73598e00e938e090a06d21036269e1f1 +P 3c8f97ae527e380bf2583c7cf8ceac9509f29bfe +R 88d01aec65e2a86c5fc8acbdba857107 U drh -Z 41423adf91510090095a57365c2e79b2 +Z 304dbede0b6b9e99a78b17b48d6b9a6b diff --git a/manifest.uuid b/manifest.uuid index 5575d8da98..3af0ec37d0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3c8f97ae527e380bf2583c7cf8ceac9509f29bfe \ No newline at end of file +8d1b5c3ac027ac00d57a250aad45230a09645617 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 9e7b458214..eca9905189 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -394,6 +394,9 @@ static struct unix_syscall { #endif #define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent) + { "unlink", (sqlite3_syscall_ptr)unlink, 0 }, +#define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent) + }; /* End of the overrideable system calls */ /* @@ -1761,7 +1764,7 @@ static int closeUnixFile(sqlite3_file *id){ #if OS_VXWORKS if( pFile->pId ){ if( pFile->isDelete ){ - unlink(pFile->pId->zCanonicalName); + osUnlink(pFile->pId->zCanonicalName); } vxworksReleaseFileId(pFile->pId); pFile->pId = 0; @@ -2010,7 +2013,7 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) { /* To fully unlock the database, delete the lock file */ assert( eFileLock==NO_LOCK ); - if( unlink(zLockFile) ){ + if( osUnlink(zLockFile) ){ int rc = 0; int tErrno = errno; if( ENOENT != tErrno ){ @@ -4162,7 +4165,7 @@ static int unixShmUnmap( assert( pShmNode->nRef>0 ); pShmNode->nRef--; if( pShmNode->nRef==0 ){ - if( deleteFlag && pShmNode->h>=0 ) unlink(pShmNode->zFilename); + if( deleteFlag && pShmNode->h>=0 ) osUnlink(pShmNode->zFilename); unixShmPurge(pDbFd); } unixLeaveMutex(); @@ -4642,7 +4645,7 @@ static int fillInUnixFile( if( rc!=SQLITE_OK ){ if( h>=0 ) robust_close(pNew, h, __LINE__); h = -1; - unlink(zFilename); + osUnlink(zFilename); isDelete = 0; } pNew->isDelete = isDelete; @@ -5049,7 +5052,7 @@ static int unixOpen( #if OS_VXWORKS zPath = zName; #else - unlink(zName); + osUnlink(zName); #endif } #if SQLITE_ENABLE_LOCKING_STYLE @@ -5164,7 +5167,7 @@ static int unixDelete( int rc = SQLITE_OK; UNUSED_PARAMETER(NotUsed); SimulateIOError(return SQLITE_IOERR_DELETE); - if( unlink(zPath)==(-1) && errno!=ENOENT ){ + if( osUnlink(zPath)==(-1) && errno!=ENOENT ){ return unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath); } #ifndef SQLITE_DISABLE_DIRSYNC @@ -5921,7 +5924,7 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){ end_breaklock: if( rc ){ if( fd>=0 ){ - unlink(tPath); + osUnlink(tPath); robust_close(pFile, fd, __LINE__); } fprintf(stderr, "failed to break stale lock on %s, %s\n", cPath, errmsg); @@ -6744,7 +6747,7 @@ int sqlite3_os_init(void){ /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==16 ); + assert( ArraySize(aSyscall)==17 ); /* Register all VFSes defined in the aVfs[] array */ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ diff --git a/test/syscall.test b/test/syscall.test index 4442612ab0..024c4db0c1 100644 --- a/test/syscall.test +++ b/test/syscall.test @@ -59,7 +59,7 @@ do_test 2.1.2 { test_syscall exists nosuchcall } 0 foreach s { open close access getcwd stat fstat ftruncate fcntl read pread write pwrite fchmod fallocate - pread64 pwrite64 + pread64 pwrite64 unlink } { if {[test_syscall exists $s]} {lappend syscall_list $s} } From 0059eae3674c68826d9037c6fac8be271e0a991b Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 8 Aug 2011 23:48:40 +0000 Subject: [PATCH 39/41] In os_unix.c, do not open the directory containing the database file when the database file is opened. Instead, wait until time to fsync() the directory. And do not report an error if the open fails, since some systems (Ex: AIX and a chromium sandbox) are unable to open and fsync directories. FossilOrigin-Name: 713b1b7dc1296e9cee42aeaad8c85528155f721d --- manifest | 12 ++--- manifest.uuid | 2 +- src/os_unix.c | 138 ++++++++++++++++++++------------------------------ 3 files changed, 62 insertions(+), 90 deletions(-) diff --git a/manifest b/manifest index 43f92ee863..c6f5371c1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allow\sthe\sunlink()\ssystem\scall\sto\sbe\soverridden\sin\sos_unix.c. -D 2011-08-08T23:18:05.791 +C In\sos_unix.c,\sdo\snot\sopen\sthe\sdirectory\scontaining\sthe\sdatabase\sfile\swhen\nthe\sdatabase\sfile\sis\sopened.\s\sInstead,\swait\suntil\stime\sto\sfsync()\sthe\ndirectory.\s\sAnd\sdo\snot\sreport\san\serror\sif\sthe\sopen\sfails,\ssince\ssome\nsystems\s(Ex:\sAIX\sand\sa\schromium\ssandbox)\sare\sunable\sto\sopen\sand\sfsync\ndirectories. +D 2011-08-08T23:48:40.886 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c 597c854d9428b547717bcc9d2fc885a8030d7f86 +F src/os_unix.c d059bd9c8b72b41316d6af803cac6a0501fa0a43 F src/os_win.c 4eb6fa00ee28f6d7bad0526edcbe5a60d297c67a F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -955,7 +955,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 3c8f97ae527e380bf2583c7cf8ceac9509f29bfe -R 88d01aec65e2a86c5fc8acbdba857107 +P 8d1b5c3ac027ac00d57a250aad45230a09645617 +R 0f87b14e27e19fe9ccf3a0f4bda64412 U drh -Z 304dbede0b6b9e99a78b17b48d6b9a6b +Z 78ef8639c983997441ad2d451ca4d175 diff --git a/manifest.uuid b/manifest.uuid index 3af0ec37d0..32600e1509 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8d1b5c3ac027ac00d57a250aad45230a09645617 \ No newline at end of file +713b1b7dc1296e9cee42aeaad8c85528155f721d \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index eca9905189..567dcf90c5 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -208,7 +208,6 @@ struct unixFile { sqlite3_io_methods const *pMethod; /* Always the first entry */ unixInodeInfo *pInode; /* Info about locks on this inode */ int h; /* The file descriptor */ - int dirfd; /* File descriptor for the directory */ unsigned char eFileLock; /* The type of lock held on this fd */ unsigned char ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */ int lastErrno; /* The unix errno from last I/O error */ @@ -253,6 +252,7 @@ struct unixFile { #define UNIXFILE_EXCL 0x01 /* Connections from one process only */ #define UNIXFILE_RDONLY 0x02 /* Connection is read only */ #define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ +#define UNIXFILE_DIRSYNC 0x08 /* Directory sync needed */ /* ** Include code that is common to all os_*.c files @@ -1753,10 +1753,6 @@ static int unixUnlock(sqlite3_file *id, int eFileLock){ */ static int closeUnixFile(sqlite3_file *id){ unixFile *pFile = (unixFile*)id; - if( pFile->dirfd>=0 ){ - robust_close(pFile, pFile->dirfd, __LINE__); - pFile->dirfd=-1; - } if( pFile->h>=0 ){ robust_close(pFile, pFile->h, __LINE__); pFile->h = -1; @@ -3249,6 +3245,37 @@ static int full_fsync(int fd, int fullSync, int dataOnly){ return rc; } +/* +** Open a file descriptor to the directory containing file zFilename. +** If successful, *pFd is set to the opened file descriptor and +** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM +** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined +** value. +** +** If SQLITE_OK is returned, the caller is responsible for closing +** the file descriptor *pFd using close(). +*/ +static int openDirectory(const char *zFilename, int *pFd){ + int ii; + int fd = -1; + char zDirname[MAX_PATHNAME+1]; + + sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename); + for(ii=(int)strlen(zDirname); ii>1 && zDirname[ii]!='/'; ii--); + if( ii>0 ){ + zDirname[ii] = '\0'; + fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0); + if( fd>=0 ){ +#ifdef FD_CLOEXEC + osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); +#endif + OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname)); + } + } + *pFd = fd; + return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, "open", zDirname)); +} + /* ** Make sure all writes to a particular file are committed to disk. ** @@ -3289,28 +3316,22 @@ static int unixSync(sqlite3_file *id, int flags){ pFile->lastErrno = errno; return unixLogError(SQLITE_IOERR_FSYNC, "full_fsync", pFile->zPath); } - if( pFile->dirfd>=0 ){ - OSTRACE(("DIRSYNC %-3d (have_fullfsync=%d fullsync=%d)\n", pFile->dirfd, + + /* Also fsync the directory containing the file if the DIRSYNC flag + ** is set. This is a one-time occurrance. Many systems (examples: AIX + ** or any process running inside a chromium sandbox) are unable to fsync a + ** directory, so ignore errors. + */ + if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){ + int dirfd; + OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath, HAVE_FULLFSYNC, isFullsync)); -#ifndef SQLITE_DISABLE_DIRSYNC - /* The directory sync is only attempted if full_fsync is - ** turned off or unavailable. If a full_fsync occurred above, - ** then the directory sync is superfluous. - */ - if( (!HAVE_FULLFSYNC || !isFullsync) && full_fsync(pFile->dirfd,0,0) ){ - /* - ** We have received multiple reports of fsync() returning - ** errors when applied to directories on certain file systems. - ** A failed directory sync is not a big deal. So it seems - ** better to ignore the error. Ticket #1657 - */ - /* pFile->lastErrno = errno; */ - /* return SQLITE_IOERR; */ + openDirectory(pFile->zPath, &dirfd); + if( dirfd>=0 ){ + full_fsync(dirfd, 0, 0); + robust_close(pFile, dirfd, __LINE__); } -#endif - /* Only need to sync once, so close the directory when we are done */ - robust_close(pFile, pFile->dirfd, __LINE__); - pFile->dirfd = -1; + pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC; } return rc; } @@ -4478,7 +4499,7 @@ typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*); static int fillInUnixFile( sqlite3_vfs *pVfs, /* Pointer to vfs object */ int h, /* Open file descriptor of file being opened */ - int dirfd, /* Directory file descriptor */ + int syncDir, /* True to sync directory on first sync */ sqlite3_file *pId, /* Write to the unixFile structure here */ const char *zFilename, /* Name of the file being opened */ int noLock, /* Omit locking if true */ @@ -4509,7 +4530,6 @@ static int fillInUnixFile( OSTRACE(("OPEN %-3d %s\n", h, zFilename)); pNew->h = h; - pNew->dirfd = dirfd; pNew->zPath = zFilename; if( memcmp(pVfs->zName,"unix-excl",10)==0 ){ pNew->ctrlFlags = UNIXFILE_EXCL; @@ -4519,6 +4539,9 @@ static int fillInUnixFile( if( isReadOnly ){ pNew->ctrlFlags |= UNIXFILE_RDONLY; } + if( syncDir ){ + pNew->ctrlFlags |= UNIXFILE_DIRSYNC; + } #if OS_VXWORKS pNew->pId = vxworksFindFileId(zFilename); @@ -4651,7 +4674,6 @@ static int fillInUnixFile( pNew->isDelete = isDelete; #endif if( rc!=SQLITE_OK ){ - if( dirfd>=0 ) robust_close(pNew, dirfd, __LINE__); if( h>=0 ) robust_close(pNew, h, __LINE__); }else{ pNew->pMethod = pLockingStyle; @@ -4660,37 +4682,6 @@ static int fillInUnixFile( return rc; } -/* -** Open a file descriptor to the directory containing file zFilename. -** If successful, *pFd is set to the opened file descriptor and -** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM -** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined -** value. -** -** If SQLITE_OK is returned, the caller is responsible for closing -** the file descriptor *pFd using close(). -*/ -static int openDirectory(const char *zFilename, int *pFd){ - int ii; - int fd = -1; - char zDirname[MAX_PATHNAME+1]; - - sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename); - for(ii=(int)strlen(zDirname); ii>1 && zDirname[ii]!='/'; ii--); - if( ii>0 ){ - zDirname[ii] = '\0'; - fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0); - if( fd>=0 ){ -#ifdef FD_CLOEXEC - osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); -#endif - OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname)); - } - } - *pFd = fd; - return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, "open", zDirname)); -} - /* ** Return the name of a directory in which to put temporary files. ** If no suitable temporary file directory can be found, return NULL. @@ -4923,7 +4914,6 @@ static int unixOpen( ){ unixFile *p = (unixFile *)pFile; int fd = -1; /* File descriptor returned by open() */ - int dirfd = -1; /* Directory file descriptor */ int openFlags = 0; /* Flags to pass to open() */ int eType = flags&0xFFFFFF00; /* Type of file to open */ int noLock; /* True to omit locking primitives */ @@ -4942,7 +4932,7 @@ static int unixOpen( ** a file-descriptor on the directory too. The first time unixSync() ** is called the directory file descriptor will be fsync()ed and close()d. */ - int isOpenDirectory = (isCreate && ( + int syncDir = (isCreate && ( eType==SQLITE_OPEN_MASTER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_WAL @@ -4996,7 +4986,7 @@ static int unixOpen( p->pUnused = pUnused; }else if( !zName ){ /* If zName is NULL, the upper layer is requesting a temp file. */ - assert(isDelete && !isOpenDirectory); + assert(isDelete && !syncDir); rc = unixGetTempname(MAX_PATHNAME+1, zTmpname); if( rc!=SQLITE_OK ){ return rc; @@ -5061,19 +5051,6 @@ static int unixOpen( } #endif - if( isOpenDirectory ){ - rc = openDirectory(zPath, &dirfd); - if( rc!=SQLITE_OK ){ - /* It is safe to close fd at this point, because it is guaranteed not - ** to be open on a database file. If it were open on a database file, - ** it would not be safe to close as this would release any locks held - ** on the file by this process. */ - assert( eType!=SQLITE_OPEN_MAIN_DB ); - robust_close(p, fd, __LINE__); - goto open_finished; - } - } - #ifdef FD_CLOEXEC osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); #endif @@ -5085,7 +5062,6 @@ static int unixOpen( struct statfs fsInfo; if( fstatfs(fd, &fsInfo) == -1 ){ ((unixFile*)pFile)->lastErrno = errno; - if( dirfd>=0 ) robust_close(p, dirfd, __LINE__); robust_close(p, fd, __LINE__); return SQLITE_IOERR_ACCESS; } @@ -5117,9 +5093,6 @@ static int unixOpen( ** not while other file descriptors opened by the same process on ** the same file are working. */ p->lastErrno = errno; - if( dirfd>=0 ){ - robust_close(p, dirfd, __LINE__); - } robust_close(p, fd, __LINE__); rc = SQLITE_IOERR_ACCESS; goto open_finished; @@ -5127,7 +5100,7 @@ static int unixOpen( useProxy = !(fsInfo.f_flags&MNT_LOCAL); } if( useProxy ){ - rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock, + rc = fillInUnixFile(pVfs, fd, syncDir, pFile, zPath, noLock, isDelete, isReadonly); if( rc==SQLITE_OK ){ rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:"); @@ -5145,7 +5118,7 @@ static int unixOpen( } #endif - rc = fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock, + rc = fillInUnixFile(pVfs, fd, syncDir, pFile, zPath, noLock, isDelete, isReadonly); open_finished: if( rc!=SQLITE_OK ){ @@ -5745,7 +5718,6 @@ static int proxyCreateUnixFile( int islockfile /* if non zero missing dirs will be created */ ) { int fd = -1; - int dirfd = -1; unixFile *pNew; int rc = SQLITE_OK; int openFlags = O_RDWR | O_CREAT; @@ -5810,7 +5782,7 @@ static int proxyCreateUnixFile( pUnused->flags = openFlags; pNew->pUnused = pUnused; - rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0, 0); + rc = fillInUnixFile(&dummyVfs, fd, 0, (sqlite3_file*)pNew, path, 0, 0, 0); if( rc==SQLITE_OK ){ *ppFile = pNew; return SQLITE_OK; From f6cee7d1001b0d92a07943873670e40f77135684 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 9 Aug 2011 18:14:36 +0000 Subject: [PATCH 40/41] Add command-line utilities "offsets.c" and "extract.c" for use in low-level analyzsis of database files. FossilOrigin-Name: dfa22ed4387f9526b74d5265503c7c8e9d559903 --- manifest | 12 +- manifest.uuid | 2 +- tool/extract.c | 46 +++++++ tool/offsets.c | 329 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 383 insertions(+), 6 deletions(-) create mode 100644 tool/extract.c create mode 100644 tool/offsets.c diff --git a/manifest b/manifest index c6f5371c1f..f45162b281 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sos_unix.c,\sdo\snot\sopen\sthe\sdirectory\scontaining\sthe\sdatabase\sfile\swhen\nthe\sdatabase\sfile\sis\sopened.\s\sInstead,\swait\suntil\stime\sto\sfsync()\sthe\ndirectory.\s\sAnd\sdo\snot\sreport\san\serror\sif\sthe\sopen\sfails,\ssince\ssome\nsystems\s(Ex:\sAIX\sand\sa\schromium\ssandbox)\sare\sunable\sto\sopen\sand\sfsync\ndirectories. -D 2011-08-08T23:48:40.886 +C Add\scommand-line\sutilities\s"offsets.c"\sand\s"extract.c"\sfor\suse\sin\nlow-level\sanalyzsis\sof\sdatabase\sfiles. +D 2011-08-09T18:14:36.327 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -918,6 +918,7 @@ F test/win32lock.test d60b39c53c68617524429be27bf239f0b11673f2 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F tool/build-shell.sh 12aa4391073a777fcb6dcc490b219a018ae98bac F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b +F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2 F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 @@ -930,6 +931,7 @@ F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c.tcl 1fa0ed9cfdc768bf5de7e65fda8d97a46dd2a7e6 F tool/mksqlite3h.tcl 78013ad79a5e492e5f764f3c7a8ef834255061f8 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 +F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 8086c014cbae90f1f2b564d59d05a5e4ac1783c9 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a @@ -955,7 +957,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 8d1b5c3ac027ac00d57a250aad45230a09645617 -R 0f87b14e27e19fe9ccf3a0f4bda64412 +P 713b1b7dc1296e9cee42aeaad8c85528155f721d +R 2b57d3d9e69c84bb70b8008d7b543857 U drh -Z 78ef8639c983997441ad2d451ca4d175 +Z 0ae7593144f65695d7975cca33773c01 diff --git a/manifest.uuid b/manifest.uuid index 32600e1509..1f303a17be 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -713b1b7dc1296e9cee42aeaad8c85528155f721d \ No newline at end of file +dfa22ed4387f9526b74d5265503c7c8e9d559903 \ No newline at end of file diff --git a/tool/extract.c b/tool/extract.c new file mode 100644 index 0000000000..5bf5caa31c --- /dev/null +++ b/tool/extract.c @@ -0,0 +1,46 @@ +/* +** Extract a range of bytes from a file. +** +** Usage: +** +** extract FILENAME OFFSET AMOUNT +** +** The bytes are written to standard output. +*/ +#include +#include + +int main(int argc, char **argv){ + FILE *f; + char *zBuf; + int ofst; + int n; + size_t got; + + if( argc!=4 ){ + fprintf(stderr, "Usage: %s FILENAME OFFSET AMOUNT\n", *argv); + return 1; + } + f = fopen(argv[1], "rb"); + if( f==0 ){ + fprintf(stderr, "cannot open \"%s\"\n", argv[1]); + return 1; + } + ofst = atoi(argv[2]); + n = atoi(argv[3]); + zBuf = malloc( n ); + if( zBuf==0 ){ + fprintf(stderr, "out of memory\n"); + return 1; + } + fseek(f, ofst, SEEK_SET); + got = fread(zBuf, 1, n, f); + fclose(f); + if( got +#include +#include +#include + +typedef unsigned char u8; +typedef struct GState GState; + +#define ArraySize(X) (sizeof(X)/sizeof(X[0])) + +/* +** Global state information for this program. +*/ +struct GState { + char *zErr; /* Error message text */ + FILE *f; /* Open database file */ + int szPg; /* Page size for the database file */ + int iRoot; /* Root page of the table */ + int iCol; /* Column number for the column */ + int pgno; /* Current page number */ + u8 *aPage; /* Current page content */ + u8 *aStack[20]; /* Page stack */ + int aPgno[20]; /* Page number stack */ + int nStack; /* Depth of stack */ + int bTrace; /* True for tracing output */ +}; + +/* +** Write an error. +*/ +static void ofstError(GState *p, const char *zFormat, ...){ + va_list ap; + sqlite3_free(p->zErr); + va_start(ap, zFormat); + p->zErr = sqlite3_vmprintf(zFormat, ap); + va_end(ap); +} + +/* +** Write a trace message +*/ +static void ofstTrace(GState *p, const char *zFormat, ...){ + va_list ap; + if( p->bTrace ){ + va_start(ap, zFormat); + vprintf(zFormat, ap); + va_end(ap); + } +} + +/* +** Find the root page of the table and the column number of the column. +*/ +static void ofstRootAndColumn( + GState *p, /* Global state */ + const char *zFile, /* Name of the database file */ + const char *zTable, /* Name of the table */ + const char *zColumn /* Name of the column */ +){ + sqlite3 *db = 0; + sqlite3_stmt *pStmt = 0; + char *zSql = 0; + int rc; + if( p->zErr ) return; + rc = sqlite3_open(zFile, &db); + if( rc ){ + ofstError(p, "cannot open database file \"%s\"", zFile); + goto rootAndColumn_exit; + } + zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master WHERE name=%Q", + zTable); + rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + if( rc ) ofstError(p, "%s: [%s]", sqlite3_errmsg(db), zSql); + sqlite3_free(zSql); + if( p->zErr ) goto rootAndColumn_exit; + if( sqlite3_step(pStmt)!=SQLITE_ROW ){ + ofstError(p, "cannot find table [%s]\n", zTable); + sqlite3_finalize(pStmt); + goto rootAndColumn_exit; + } + p->iRoot = sqlite3_column_int(pStmt , 0); + sqlite3_finalize(pStmt); + + p->iCol = -1; + zSql = sqlite3_mprintf("PRAGMA table_info(%Q)", zTable); + rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + if( rc ) ofstError(p, "%s: [%s}", sqlite3_errmsg(db), zSql); + sqlite3_free(zSql); + if( p->zErr ) goto rootAndColumn_exit; + while( sqlite3_step(pStmt)==SQLITE_ROW ){ + const char *zCol = sqlite3_column_text(pStmt, 1); + if( strlen(zCol)==strlen(zColumn) + && sqlite3_strnicmp(zCol, zColumn, strlen(zCol))==0 + ){ + p->iCol = sqlite3_column_int(pStmt, 0); + break; + } + } + sqlite3_finalize(pStmt); + if( p->iCol<0 ){ + ofstError(p, "no such column: %s.%s", zTable, zColumn); + goto rootAndColumn_exit; + } + + zSql = sqlite3_mprintf("PRAGMA page_size"); + rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + if( rc ) ofstError(p, "%s: [%s]", sqlite3_errmsg(db), zSql); + sqlite3_free(zSql); + if( p->zErr ) goto rootAndColumn_exit; + if( sqlite3_step(pStmt)!=SQLITE_ROW ){ + ofstError(p, "cannot find page size"); + }else{ + p->szPg = sqlite3_column_int(pStmt, 0); + } + sqlite3_finalize(pStmt); + +rootAndColumn_exit: + sqlite3_close(db); + return; +} + +/* +** Pop a page from the stack +*/ +static void ofstPopPage(GState *p){ + if( p->nStack<=0 ) return; + p->nStack--; + sqlite3_free(p->aStack[p->nStack]); + p->pgno = p->aPgno[p->nStack-1]; + p->aPage = p->aStack[p->nStack-1]; +} + + +/* +** Push a new page onto the stack. +*/ +static void ofstPushPage(GState *p, int pgno){ + u8 *pPage; + size_t got; + if( p->zErr ) return; + if( p->nStack >= ArraySize(p->aStack) ){ + ofstError(p, "page stack overflow"); + return; + } + p->aPgno[p->nStack] = pgno; + p->aStack[p->nStack] = pPage = sqlite3_malloc( p->szPg ); + if( pPage==0 ){ + fprintf(stderr, "out of memory\n"); + exit(1); + } + p->nStack++; + p->aPage = pPage; + p->pgno = pgno; + fseek(p->f, (pgno-1)*p->szPg, SEEK_SET); + got = fread(pPage, 1, p->szPg, p->f); + if( got!=p->szPg ){ + ofstError(p, "unable to read page %d", pgno); + ofstPopPage(p); + } +} + +/* Read a two-byte integer at the given offset into the current page */ +static int ofst2byte(GState *p, int ofst){ + int x = p->aPage[ofst]; + return (x<<8) + p->aPage[ofst+1]; +} + +/* Read a four-byte integer at the given offset into the current page */ +static int ofst4byte(GState *p, int ofst){ + int x = p->aPage[ofst]; + x = (x<<8) + p->aPage[ofst+1]; + x = (x<<8) + p->aPage[ofst+2]; + x = (x<<8) + p->aPage[ofst+3]; + return x; +} + +/* Read a variable-length integer. Update the offset */ +static sqlite3_int64 ofstVarint(GState *p, int *pOfst){ + sqlite3_int64 x = 0; + u8 *a = &p->aPage[*pOfst]; + int n = 0; + while( n<8 && (a[0] & 0x80)!=0 ){ + x = (x<<7) + (a[0] & 0x7f); + n++; + a++; + } + if( n==8 ){ + x = (x<<8) + a[0]; + }else{ + x = (x<<7) + a[0]; + } + *pOfst += (n+1); + return x; +} + +/* Return the absolute offset into a file for the given offset +** into the current page */ +static int ofstInFile(GState *p, int ofst){ + return p->szPg*(p->pgno-1) + ofst; +} + +/* Return the size (in bytes) of the data corresponding to the +** given serial code */ +static int ofstSerialSize(int scode){ + if( scode<5 ) return scode; + if( scode==5 ) return 6; + if( scode<8 ) return 8; + if( scode<12 ) return 0; + return (scode-12)/2; +} + +/* Forward reference */ +static void ofstWalkPage(GState*, int); + +/* Walk an interior btree page */ +static void ofstWalkInteriorPage(GState *p){ + int nCell; + int i; + int ofst; + int iChild; + + nCell = ofst2byte(p, 3); + for(i=0; izErr ) return; + } + ofstWalkPage(p, ofst4byte(p, 8)); +} + +/* Walk a leaf btree page */ +static void ofstWalkLeafPage(GState *p){ + int nCell; + int i; + int ofst; + int nPayload; + sqlite3_int64 rowid; + int nHdr; + int j; + int scode; + int sz; + int dataOfst; + char zMsg[200]; + + nCell = ofst2byte(p, 3); + for(i=0; i p->szPg-35 ){ + sqlite3_snprintf(sizeof(zMsg), zMsg, + "# overflow rowid %lld", rowid); + printf("%s\n", zMsg); + continue; + } + dataOfst = ofst; + nHdr = ofstVarint(p, &ofst); + dataOfst += nHdr; + for(j=0; jiCol; j++){ + scode = ofstVarint(p, &ofst); + dataOfst += ofstSerialSize(scode); + } + scode = ofstVarint(p, &ofst); + sz = ofstSerialSize(scode); + sqlite3_snprintf(sizeof(zMsg), zMsg, + "rowid %12lld size %5d offset %8d", + rowid, sz, ofstInFile(p, dataOfst)); + printf("%s\n", zMsg); + } +} + +/* +** Output results from a single page. +*/ +static void ofstWalkPage(GState *p, int pgno){ + if( p->zErr ) return; + ofstPushPage(p, pgno); + if( p->zErr ) return; + if( p->aPage[0]==5 ){ + ofstWalkInteriorPage(p); + }else if( p->aPage[0]==13 ){ + ofstWalkLeafPage(p); + }else{ + ofstError(p, "page %d has a faulty type byte: %d", pgno, p->aPage[0]); + } + ofstPopPage(p); +} + +int main(int argc, char **argv){ + GState g; + memset(&g, 0, sizeof(g)); + if( argc>2 && strcmp(argv[1],"--trace")==0 ){ + g.bTrace = 1; + argc--; + argv++; + } + if( argc!=4 ){ + fprintf(stderr, "Usage: %s DATABASE TABLE COLUMN\n", *argv); + exit(1); + } + ofstRootAndColumn(&g, argv[1], argv[2], argv[3]); + if( g.zErr ){ + fprintf(stderr, "%s\n", g.zErr); + exit(1); + } + ofstTrace(&g, "# szPg = %d\n", g.szPg); + ofstTrace(&g, "# iRoot = %d\n", g.iRoot); + ofstTrace(&g, "# iCol = %d\n", g.iCol); + g.f = fopen(argv[1], "rb"); + if( g.f==0 ){ + fprintf(stderr, "cannot open \"%s\"\n", argv[1]); + exit(1); + } + ofstWalkPage(&g, g.iRoot); + if( g.zErr ){ + fprintf(stderr, "%s\n", g.zErr); + exit(1); + } + return 0; +} From 90315a24179a23538b9a906a066d484cd782e3d8 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 10 Aug 2011 01:52:12 +0000 Subject: [PATCH 41/41] Make the openDirectory routine in os_unix.c overrideable so that it can be turned into a harmless no-op for the chromium sandbox. FossilOrigin-Name: 6b236069e1ea3c99ff0a007a790d4baebda70b13 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 32 +++++++++++++++++++++++++------- test/syscall.test | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/manifest b/manifest index f45162b281..83e86d4850 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\scommand-line\sutilities\s"offsets.c"\sand\s"extract.c"\sfor\suse\sin\nlow-level\sanalyzsis\sof\sdatabase\sfiles. -D 2011-08-09T18:14:36.327 +C Make\sthe\sopenDirectory\sroutine\sin\sos_unix.c\soverrideable\sso\sthat\sit\scan\nbe\sturned\sinto\sa\sharmless\sno-op\sfor\sthe\schromium\ssandbox. +D 2011-08-10T01:52:12.736 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1e6988b3c11dee9bd5edc0c804bd4468d74a9cdc F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -165,7 +165,7 @@ F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c d059bd9c8b72b41316d6af803cac6a0501fa0a43 +F src/os_unix.c 0177d9f411d96f99218c69759a98393baa674b76 F src/os_win.c 4eb6fa00ee28f6d7bad0526edcbe5a60d297c67a F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 @@ -688,7 +688,7 @@ F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/superlock.test 5d7a4954b0059c903f82c7b67867bc5451a7c082 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85 -F test/syscall.test a9d065ad1ef5f32446b1cb585a0e085b4e0996f5 +F test/syscall.test 966addf703faee6a5d509abe6d8885e393e552fd F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f F test/table.test 50c47f5fe9c112e92723af27cd735e6c92de6f85 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 @@ -957,7 +957,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 -P 713b1b7dc1296e9cee42aeaad8c85528155f721d -R 2b57d3d9e69c84bb70b8008d7b543857 +P dfa22ed4387f9526b74d5265503c7c8e9d559903 +R bf22196e9aa98f18724e5d2624f7dcbf U drh -Z 0ae7593144f65695d7975cca33773c01 +Z 2ec35109792cc0dc5d4f7cebd4d85034 diff --git a/manifest.uuid b/manifest.uuid index 1f303a17be..ec7b7e54a0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dfa22ed4387f9526b74d5265503c7c8e9d559903 \ No newline at end of file +6b236069e1ea3c99ff0a007a790d4baebda70b13 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 567dcf90c5..857ed58a9f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -298,6 +298,9 @@ static int posixOpen(const char *zFile, int flags, int mode){ return open(zFile, flags, mode); } +/* Forward reference */ +static int openDirectory(const char*, int*); + /* ** Many system calls are accessed through pointer-to-functions so that ** they may be overridden at runtime to facilitate fault injection during @@ -397,6 +400,9 @@ static struct unix_syscall { { "unlink", (sqlite3_syscall_ptr)unlink, 0 }, #define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent) + { "openDirectory", (sqlite3_syscall_ptr)openDirectory, 0 }, +#define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent) + }; /* End of the overrideable system calls */ /* @@ -3252,6 +3258,19 @@ static int full_fsync(int fd, int fullSync, int dataOnly){ ** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined ** value. ** +** The directory file descriptor is used for only one thing - to +** fsync() a directory to make sure file creation and deletion events +** are flushed to disk. Such fsyncs are not needed on newer +** journaling filesystems, but are required on older filesystems. +** +** This routine can be overridden using the xSetSysCall interface. +** The ability to override this routine was added in support of the +** chromium sandbox. Opening a directory is a security risk (we are +** told) so making it overrideable allows the chromium sandbox to +** replace this routine with a harmless no-op. To make this routine +** a no-op, replace it with a stub that returns SQLITE_OK but leaves +** *pFd set to a negative number. +** ** If SQLITE_OK is returned, the caller is responsible for closing ** the file descriptor *pFd using close(). */ @@ -3318,16 +3337,15 @@ static int unixSync(sqlite3_file *id, int flags){ } /* Also fsync the directory containing the file if the DIRSYNC flag - ** is set. This is a one-time occurrance. Many systems (examples: AIX - ** or any process running inside a chromium sandbox) are unable to fsync a - ** directory, so ignore errors. + ** is set. This is a one-time occurrance. Many systems (examples: AIX) + ** are unable to fsync a directory, so ignore errors on the fsync. */ if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){ int dirfd; OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath, HAVE_FULLFSYNC, isFullsync)); - openDirectory(pFile->zPath, &dirfd); - if( dirfd>=0 ){ + rc = osOpenDirectory(pFile->zPath, &dirfd); + if( rc==SQLITE_OK && dirfd>=0 ){ full_fsync(dirfd, 0, 0); robust_close(pFile, dirfd, __LINE__); } @@ -5146,7 +5164,7 @@ static int unixDelete( #ifndef SQLITE_DISABLE_DIRSYNC if( dirSync ){ int fd; - rc = openDirectory(zPath, &fd); + rc = osOpenDirectory(zPath, &fd); if( rc==SQLITE_OK ){ #if OS_VXWORKS if( fsync(fd)==-1 ) @@ -6719,7 +6737,7 @@ int sqlite3_os_init(void){ /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==17 ); + assert( ArraySize(aSyscall)==18 ); /* Register all VFSes defined in the aVfs[] array */ for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ diff --git a/test/syscall.test b/test/syscall.test index 024c4db0c1..201bd63647 100644 --- a/test/syscall.test +++ b/test/syscall.test @@ -59,7 +59,7 @@ do_test 2.1.2 { test_syscall exists nosuchcall } 0 foreach s { open close access getcwd stat fstat ftruncate fcntl read pread write pwrite fchmod fallocate - pread64 pwrite64 unlink + pread64 pwrite64 unlink openDirectory } { if {[test_syscall exists $s]} {lappend syscall_list $s} }