Merge all changes from trunk, and disable a pair of corruption tests that are

no longer valid since sqlite_master.rootpage can now be NULL for tables.

FossilOrigin-Name: dd5d57b9a1b25fb6c9e20024e519b58630cf1fd0
This commit is contained in:
drh
2013-11-01 17:21:29 +00:00
10 changed files with 139 additions and 88 deletions
+1
View File
@@ -27,4 +27,5 @@
>60 belong =0x5f4d544e Monotone source repository -
>68 belong =0x47504b47 OGC GeoPackage file -
>68 belong =0x47503130 OGC GeoPackage version 1.0 file -
>68 belong =0x45737269 Esri Spatially-Enabled Database -
>0 string =SQLite SQLite3 database
+13 -13
View File
@@ -1,5 +1,5 @@
C Change\sthe\sinterface\sto\ssqlite3GenerateConstraintChecks()\sfor\simproved\slucidity\nand\sto\sfix\sissues\sin\sdealing\swith\sUPDATEs\sfor\sWITHOUT\sROWID\stables.\s\sMake\ssure\niDataCur\sand\siIdxCur\sare\sinitialized\swhen\sprocessing\sDELETEs\sof\sa\sVIEW.\nUPDATE\sprocessing\sdistinguishes\sbetween\schanges\sto\sROWID\sand\sPRIMARY\sKEY.
D 2013-11-01T17:08:56.112
C Merge\sall\schanges\sfrom\strunk,\sand\sdisable\sa\spair\sof\scorruption\stests\sthat\sare\nno\slonger\svalid\ssince\ssqlite_master.rootpage\scan\snow\sbe\sNULL\sfor\stables.
D 2013-11-01T17:21:29.771
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -140,7 +140,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 814d3de5ec227817ff2ad26cbc73159c968a2a58
F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff
F main.mk c6a433cb334bbb019625c137ab5d5e7568b47cff
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
@@ -204,7 +204,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be
F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 243fb37f47dc072fc59839ea241ff0a17c8d76e6
F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9
F src/os_win.c b159b5249d9f70607d961bbdd1dbba789c75812c
F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8
F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c
@@ -219,7 +219,7 @@ F src/random.c 0b2dbc37fdfbfa6bd455b091dfcef5bdb32dba68
F src/resolve.c e729889b2c7a680ba4aa7296efa72c09369956d8
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c 8290456f2a516abaf8cbbed5e61944d3082e497e
F src/shell.c d5eebdc6034014103de2b9d58e1d3f6f7de0fb50
F src/shell.c 03d8d9b4052430343ff30d646334621f980f1202
F src/sqlite.h.in 547a44dd4ff4d975e92a645ea2d609e543a83d0f
F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
@@ -233,7 +233,7 @@ F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
F src/test5.c a6d1ac55ac054d0b2b8f37b5e655b6c92645a013
F src/test6.c 00af0fe1947305222b8ed488a69c76c5a2b632e2
F src/test6.c 4f958b71334695e65746d357dac77709732b28db
F src/test7.c 72b732baa5642f795655ba1126ea032af46ecfd2
F src/test8.c c7aab1d9fbbf54fc33d43b73aa24aa55f9eaf534
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
@@ -241,7 +241,7 @@ F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8
F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
F src/test_backup.c 3875e899222b651e18b662f86e0e50daa946344e
F src/test_btree.c 5b89601dcb42a33ba8b820a6b763cc9cb48bac16
F src/test_config.c 3d148e338b575bd937f7746824f36a9c6682d238
F src/test_config.c e825cd6a4a8f498be246fc5934fe5fd702b9441f
F src/test_demovfs.c 69b2085076654ebc18014cbc6386f04409c959a9
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
@@ -387,7 +387,7 @@ F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
F test/conflict.test 0b3922d2304a14a47e3ccd61bbd6824327af659b
F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4
F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e
F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0
F test/corrupt2.test b8174976fab5bc000e58539ceb3bb9f31b4813f8
F test/corrupt3.test 889d7cdb811800303aa722d7813fe8a4299cf726
F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a
F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff
@@ -411,7 +411,7 @@ F test/crash4.test fe2821baf37168dc59dd733dcf7dba2a401487bc
F test/crash5.test 05dd3aa9dbb751a22d5cdaf22a9c49b6667aa219
F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba
F test/crash7.test 1a194c4900a255258cf94b7fcbfd29536db572df
F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f
F test/crash8.test 61442a9964ab6b124fc5254e4258b45747842e6f
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
@@ -1079,7 +1079,7 @@ F test/win32longpath.test e2aafc07e6990fe86c69be22a3d1a0e210cd329b
F test/without_rowid1.test ad5764bbe2784a91f7106143e7d1bd8ccfb61ffd
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test 209d7ed441f44cc5299e4ebffbef06fd5aabfefd
F tool/build-all-msvc.bat 38623a30fd58288fda5cc7f7df2682aaab75c9d5 x
F tool/build-all-msvc.bat 1bac6adc3fdb4d9204f21d17b14be25778370e48 x
F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
@@ -1128,7 +1128,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 3bed599e74d354bf1513e4fb0e8665376ba44d0b
R 67b4771869ffd7159304bf29f7d68635
P c525ac5630d6bcd51842cfc84f2c2c50be9cec1c 090db8c81d8ca216277d11c8c4751c0a37801524
R 29f428af34633f43240a60101a70dc64
U drh
Z f06e68ba1ad92e0ce7abe5fdcd557daa
Z c404b4cfe0d89cb06bbfd0f6d2a5b5d1
+1 -1
View File
@@ -1 +1 @@
c525ac5630d6bcd51842cfc84f2c2c50be9cec1c
dd5d57b9a1b25fb6c9e20024e519b58630cf1fd0
+2
View File
@@ -1890,7 +1890,9 @@ end_unlock:
** the requested locking level, this routine is a no-op.
*/
static int unixUnlock(sqlite3_file *id, int eFileLock){
#if SQLITE_MAX_MMAP_SIZE>0
assert( eFileLock==SHARED_LOCK || ((unixFile *)id)->nFetchOut==0 );
#endif
return posixUnlock(id, eFileLock, 0);
}
+30 -6
View File
@@ -86,21 +86,38 @@ extern int pclose(FILE*);
#define isatty(x) 1
#endif
/* True if the timer is enabled */
static int enableTimer = 0;
/* ctype macros that work with signed characters */
#define IsSpace(X) isspace((unsigned char)X)
#define IsDigit(X) isdigit((unsigned char)X)
#define ToLower(X) (char)tolower((unsigned char)X)
/* True if the timer is enabled */
static int enableTimer = 0;
/* Return the current wall-clock time */
static sqlite3_int64 timeOfDay(void){
static sqlite3_vfs *clockVfs = 0;
sqlite3_int64 t;
if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){
clockVfs->xCurrentTimeInt64(clockVfs, &t);
}else{
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t;
}
#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL) \
&& !defined(__minux)
#include <sys/time.h>
#include <sys/resource.h>
/* Saved resource information for the beginning of an operation */
static struct rusage sBegin;
static struct rusage sBegin; /* CPU time at start */
static sqlite3_int64 iBegin; /* Wall-clock time at start */
/*
** Begin timing an operation
@@ -108,6 +125,7 @@ static struct rusage sBegin;
static void beginTimer(void){
if( enableTimer ){
getrusage(RUSAGE_SELF, &sBegin);
iBegin = timeOfDay();
}
}
@@ -123,8 +141,10 @@ static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
static void endTimer(void){
if( enableTimer ){
struct rusage sEnd;
sqlite3_int64 iEnd = timeOfDay();
getrusage(RUSAGE_SELF, &sEnd);
printf("CPU Time: user %f sys %f\n",
printf("Run Time: real %.3f user %f sys %f\n",
(iEnd - iBegin)*0.001,
timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
}
@@ -142,6 +162,7 @@ static void endTimer(void){
static HANDLE hProcess;
static FILETIME ftKernelBegin;
static FILETIME ftUserBegin;
static sqlite3_int64 ftWallBegin;
typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
static GETPROCTIMES getProcessTimesAddr = NULL;
@@ -179,6 +200,7 @@ static void beginTimer(void){
if( enableTimer && getProcessTimesAddr ){
FILETIME ftCreation, ftExit;
getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
ftWallBegin = timeOfDay();
}
}
@@ -195,8 +217,10 @@ static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
static void endTimer(void){
if( enableTimer && getProcessTimesAddr){
FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
sqlite3_int64 ftWallEnd = timeOfDay();
getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
printf("CPU Time: user %f sys %f\n",
printf("Run Time: real %.3f user %f sys %f\n",
(ftWallEnd - ftWallBegin)*0.001,
timeDiff(&ftUserBegin, &ftUserEnd),
timeDiff(&ftKernelBegin, &ftKernelEnd));
}
+2 -2
View File
@@ -621,7 +621,7 @@ static int cfOpen(
pWrapper->flags = flags;
}
if( rc==SQLITE_OK ){
pWrapper->nData = (4096 + pWrapper->iSize);
pWrapper->nData = (int)(4096 + pWrapper->iSize);
pWrapper->zData = crash_malloc(pWrapper->nData);
if( pWrapper->zData ){
/* os_unix.c contains an assert() that fails if the caller attempts
@@ -637,7 +637,7 @@ static int cfOpen(
memset(pWrapper->zData, 0, pWrapper->nData);
for(iOff=0; iOff<pWrapper->iSize; iOff += 512){
int nRead = pWrapper->iSize - (int)iOff;
int nRead = (int)(pWrapper->iSize - iOff);
if( nRead>512 ) nRead = 512;
if( isDb && iOff==PENDING_BYTE ) continue;
rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], nRead, iOff);
-5
View File
@@ -252,12 +252,7 @@ static void set_options(Tcl_Interp *interp){
#endif
Tcl_SetVar2(interp, "sqlite_options", "conflict", "1", TCL_GLOBAL_ONLY);
#if SQLITE_OS_UNIX
Tcl_SetVar2(interp, "sqlite_options", "crashtest", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "crashtest", "0", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_DATETIME_FUNCS
Tcl_SetVar2(interp, "sqlite_options", "datetime", "0", TCL_GLOBAL_ONLY);
+6
View File
@@ -466,6 +466,11 @@ corruption_test -sqlprep {
} {1 {database disk image is malformed}}
}
# Since the introduction of WITHOUT ROWID tables, having a table entry in
# the sqlite_master table with a NULL rootpage is no longer a sign of
# corruption.
#
if 0 {
corruption_test -sqlprep {
CREATE TABLE t1(a, b, c);
CREATE TABLE t2(a, b, c);
@@ -479,6 +484,7 @@ corruption_test -sqlprep {
sqlite3_errcode db
} {SQLITE_CORRUPT}
}
} ;# Disabled rootpage==NULL corruption test
corruption_test -sqlprep {
PRAGMA auto_vacuum = incremental;
+59 -53
View File
@@ -341,62 +341,68 @@ ifcapable pragma {
} {jkl}
}
for {set i 1} {$i < 10} {incr i} {
catch { db close }
forcedelete test.db test.db-journal
sqlite3 db test.db
do_test crash8-5.$i.1 {
execsql {
CREATE TABLE t1(x PRIMARY KEY);
INSERT INTO t1 VALUES(randomblob(900));
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
}
crashsql -file test.db -delay [expr ($::i%2) + 1] {
PRAGMA cache_size = 10;
BEGIN;
UPDATE t1 SET x = randomblob(900);
ROLLBACK;
INSERT INTO t1 VALUES(randomblob(900));
}
execsql { PRAGMA integrity_check }
} {ok}
#
# Since the following tests (crash8-5.*) rely upon being able
# to copy a file while open, they will not work on Windows.
#
if {$::tcl_platform(platform)=="unix"} {
for {set i 1} {$i < 10} {incr i} {
catch { db close }
forcedelete test.db test.db-journal
sqlite3 db test.db
do_test crash8-5.$i.1 {
execsql {
CREATE TABLE t1(x PRIMARY KEY);
INSERT INTO t1 VALUES(randomblob(900));
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
}
crashsql -file test.db -delay [expr ($::i%2) + 1] {
PRAGMA cache_size = 10;
BEGIN;
UPDATE t1 SET x = randomblob(900);
ROLLBACK;
INSERT INTO t1 VALUES(randomblob(900));
}
execsql { PRAGMA integrity_check }
} {ok}
catch { db close }
forcedelete test.db test.db-journal
sqlite3 db test.db
do_test crash8-5.$i.2 {
execsql {
PRAGMA cache_size = 10;
CREATE TABLE t1(x PRIMARY KEY);
INSERT INTO t1 VALUES(randomblob(900));
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
BEGIN;
UPDATE t1 SET x = randomblob(900);
}
forcedelete testX.db testX.db-journal testX.db-wal
forcecopy test.db testX.db
forcecopy test.db-journal testX.db-journal
db close
catch { db close }
forcedelete test.db test.db-journal
sqlite3 db test.db
do_test crash8-5.$i.2 {
execsql {
PRAGMA cache_size = 10;
CREATE TABLE t1(x PRIMARY KEY);
INSERT INTO t1 VALUES(randomblob(900));
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1;
INSERT INTO t1 SELECT randomblob(900) FROM t1; /* 64 rows */
BEGIN;
UPDATE t1 SET x = randomblob(900);
}
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] {
SELECT * FROM sqlite_master;
INSERT INTO t1 VALUES(randomblob(900));
}
crashsql -file test.db -delay [expr ($::i%2) + 1] {
SELECT * FROM sqlite_master;
INSERT INTO t1 VALUES(randomblob(900));
}
sqlite3 db2 testX.db
execsql { PRAGMA integrity_check } db2
} {ok}
sqlite3 db2 testX.db
execsql { PRAGMA integrity_check } db2
} {ok}
}
catch {db2 close}
}
catch {db2 close}
finish_test
+25 -8
View File
@@ -252,7 +252,7 @@ FOR %%P IN (%PLATFORMS%) DO (
CALL :fn_CopyVariable %%P_NAME PLATFORMNAME
REM
REM NOTE: This is the inner loop. There should be exactly one iteration.
REM NOTE: This is the second loop. There should be exactly one iteration.
REM This loop is necessary because the PlatformName environment
REM variable was set above and that value is needed by some of the
REM commands contained in the inner loop. If these commands were
@@ -289,6 +289,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM
SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%
REM
REM NOTE: This is the inner loop. There are normally two iterations, one
REM for each supported build configuration, e.g. Debug or Retail.
REM
FOR %%B IN (%CONFIGURATIONS%) DO (
REM
REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
@@ -318,6 +322,10 @@ FOR %%P IN (%PLATFORMS%) DO (
REM platform to the platform-specific directory beneath the
REM binary directory.
REM
REM 5. Unless prevented from doing so, copy the "sqlite3.pdb"
REM symbols file for this platform to the platform-specific
REM directory beneath the binary directory.
REM
"%ComSpec%" /C (
REM
REM NOTE: Attempt to setup the MSVC environment for this platform.
@@ -345,21 +353,30 @@ FOR %%P IN (%PLATFORMS%) DO (
)
REM
REM NOTE: When using MSVC 2012, the native SDK path cannot simply use
REM the "lib" sub-directory beneath the location specified in the
REM WindowsSdkDir environment variable because that location does
REM not actually contain the necessary library files for x86.
REM This must be done for each iteration because it relies upon
REM the WindowsSdkDir environment variable being set by the batch
REM file used to setup the MSVC environment.
REM NOTE: When using MSVC 2012 and/or 2013, the native SDK path cannot
REM simply use the "lib" sub-directory beneath the location
REM specified in the WindowsSdkDir environment variable because
REM that location does not actually contain the necessary library
REM files for x86. This must be done for each iteration because
REM it relies upon the WindowsSdkDir environment variable being
REM set by the batch file used to setup the MSVC environment.
REM
IF DEFINED SET_NSDKLIBPATH (
REM
REM NOTE: The Windows Phone SDK has a slightly different directory
REM structure and must be handled specially here.
REM
IF DEFINED WindowsPhoneKitDir (
CALL :fn_CopyVariable WindowsPhoneKitDir NSDKLIBPATH
CALL :fn_AppendVariable NSDKLIBPATH \lib\x86
) ELSE IF DEFINED WindowsSdkDir (
CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH
REM
REM NOTE: The Windows 8.1 SDK has a slightly different directory
REM naming convention. Currently, this tool assumes that
REM the Windows 8.1 SDK should only be used with MSVC 2013.
REM
IF "%VisualStudioVersion%" == "12.0" (
CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86
) ELSE (