Cherry-pick the correct changes out of the recent "mistake" branch while

omitting the bogus changes.

FossilOrigin-Name: 48bf309391c32e7860c293acd13f3dda14212d39
This commit is contained in:
drh 2010-07-03 12:31:34 +00:00
commit b0ab011dc5
22 changed files with 233 additions and 79 deletions

View File

@ -607,6 +607,9 @@ static int fts3CreateTables(Fts3Table *p){
** An sqlite3_exec() callback for fts3TableExists.
*/
static int fts3TableExistsCallback(void *pArg, int n, char **pp1, char **pp2){
UNUSED_PARAMETER(n);
UNUSED_PARAMETER(pp1);
UNUSED_PARAMETER(pp2);
*(int*)pArg = 1;
return 1;
}
@ -632,7 +635,7 @@ static void fts3TableExists(
);
rc = sqlite3_exec(db, zSql, fts3TableExistsCallback, &res, 0);
sqlite3_free(zSql);
*pResult = res & 0xff;
*pResult = (u8)(res & 0xff);
if( rc!=SQLITE_ABORT ) *pRc = rc;
}

View File

@ -1,5 +1,8 @@
C Add\sinitializers\sfor\sthe\sxShmXXX()\smembers\sto\san\ssqlite3_io_methods\sstructure\sin\sjournal.c.\sThis\sdoesn't\sfix\sany\sreal\sproblem,\sjust\sprevents\sa\scompiler\swarning.
D 2010-07-02T16:36:18
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Cherry-pick\sthe\scorrect\schanges\sout\sof\sthe\srecent\s"mistake"\sbranch\swhile\nomitting\sthe\sbogus\schanges.
D 2010-07-03T12:31:35
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -60,7 +63,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 20c55bed37307a2cd590387d33a9c8127b354ab4
F ext/fts3/fts3.c 51948505e018316cf0b76d249cdd87e409254e8f
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 70528ba8c33991699f96ecc64112122833cdbdb5
F ext/fts3/fts3_expr.c f4ff02ebe854e97ac03ff00b38b728a9ab57fd4b
@ -113,7 +116,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c 51d83300fe0baee39405c416ceb19a58ed30a8ed
F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0
F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff
F src/btree.c ac51d077487df990de502cd0649e486a1a6cc458
F src/btree.c 9a214e6141555b183216b73ace058c7a499cdbe2
F src/btree.h dd83041eda10c17daf023257c1fc883b5f71f85a
F src/btreeInt.h b0c87f6725b06a0aa194a6d25d54b16ce9d6e291
F src/build.c 31830208adbd6f97bef2517531ed70954a306fde
@ -150,13 +153,13 @@ F src/mutex_os2.c 6a62583e374ba3ac1a3fcc0da2bfdac7d3942689
F src/mutex_unix.c cf84466b4fdd2baa0d5a10bb19f08b2abc1ce42e
F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb
F src/notify.c cbfa66a836da3a51567209636e6a94059c137930
F src/os.c 1b3a1edf20587639d9d88bfebe018f7a6e7ba0ec
F src/os.c c34882169b2f8ee0942c4f6aff9ee705e6110cdf
F src/os.h d7775504a51e6e0d40315aa427b3e229ff9ff9ca
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c ec7c7f7ca224ce2ff58736eebf804b48a75f9946
F src/os_win.c 48f67798969ba983487fed5691059ade7fff2ef7
F src/pager.c 95068d8b0f8a161ea364aa41af85d220a1be23df
F src/os_unix.c d7910391a4c9fa6898f7c9abbbb821d5d7edb78f
F src/os_win.c dd4c6f238fe464e01dab5e4bc9158187ae305fe8
F src/pager.c eee7ac31ce893ed6b7e28f907fe99144c0696953
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@ -209,7 +212,7 @@ F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c aa9919c885a1fe53eafc73492f0898ee6c0a0726
F src/test_vfs.c 88ca1326c124cc81396dd3ad752018c0e68711df
F src/test_vfs.c f7e4d92be80bcc885123f0b1733672c71d1708ac
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/tokenize.c 25ceb0f0a746ea1d0f9553787f3f0a56853cfaeb
F src/trigger.c 67e95c76d625b92d43409ace771c8e0d02a09ac2
@ -217,19 +220,19 @@ F src/update.c 19c899c23cd29fd102c9068e0b0ff5b087204beb
F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685
F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b
F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f
F src/vdbe.c 8b3bae957a874891361e4b5ada373e6f49e18630
F src/vdbe.c 046cd38df1ac63545ab1439eecf02d7b0222fb2c
F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3
F src/vdbeInt.h 19ebc8c2a2e938340051ee65af3f377fb99102d1
F src/vdbeapi.c dc3138f10afbc95ed3c21dd25abb154504b1db9d
F src/vdbeaux.c 4e96a5169b988a8697d4a417f902277b4152e43e
F src/vdbeaux.c 7f99c1f00e4b31e8b28d8a87ecc2322bb46ae99c
F src/vdbeblob.c 258a6010ba7a82b72b327fb24c55790655689256
F src/vdbemem.c 5e579abf6532001dfbee0e640dc34eae897a9807
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
F src/wal.c 7666c113e99fb510ecd3043490798cec5a771e73
F src/wal.c 737408e8e6f2386e6318cd01dfaa534c45ffe3ed
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
F src/where.c 1c895bef33d0dfc7ed90fb1f74120435d210ea56
F src/where.c 926c83c6394e132a1c62b6b12ceeba7d55a34c19
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
@ -489,7 +492,7 @@ F test/lock_common.tcl e7013c6208f5fa818735c324eb0249b4c0f317cf
F test/lookaside.test 1dd350dc6dff015c47c07fcc5a727a72fc5bae02
F test/main.test 2be2352ac77ac5b238c6337a5469aeeef57677e6
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test d23580e15c33ee0353717129421b077541e910dc
F test/malloc.test 927e6c8668a1d48c23aa6189bda02aff5a1b83de
F test/malloc3.test 4bc57f850b212f706f3e1b37c4eced1d5a727cd1
F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
F test/malloc5.test 4d16d1bb26d2deddd7c4f480deec341f9b2d0e22
@ -531,19 +534,19 @@ F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test f3a0bcc6ca1acaa370efc5a7571e89507fb5927d
F test/notify1.test 8433bc74bd952fb8a6e3f8d7a4c2b28dfd69e310
F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
F test/notify3.test b923ff67728f363378698fb27b5f41a5a1b4d9e0
F test/notify3.test feb03d697f4a5327c1beb158c3e7e51c5e400703
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/pager1.test 14c8e43287b0f241745cd08fa74631f71303f688
F test/pager1.test b345014ce33efcc28a8810c476090068b279ee30
F test/pager2.test f5c757c271ce642d36a393ecbfb3aef1c240dcef
F test/pagerfault.test 743952c5509244a71d66d67bf960d920793bb847
F test/pagerfault2.test be9088b0daff0e63983138e0bde2311eb734f900
F test/pagerfault.test 17e51d1570c00df4a1902e6d500387017c87e74a
F test/pagerfault2.test 2d2d4373b1365d693ba185323d0766feeacdb4dd
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
F test/pcache.test 4118a183908ecaed343a06fcef3ba82e87e0129d
F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16
F test/permutations.test 66cd9a3d17753e74a2dc1a791af2ddf5edb08af7
F test/permutations.test 371507d1c5ee8ce60d5dc7d0c16618c2c7c9ee4a
F test/pragma.test a869b428b861f9dbbdb25461a104e8e830fc3026
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
@ -615,7 +618,7 @@ F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
F test/tester.tcl a4e8953bbe39ce8e366b211ee679c01564b5522c
F test/tester.tcl b533b875487f9ebb5fa9d60dfea9220c2fdfa9d0
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
@ -775,10 +778,10 @@ F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
F test/wal.test 1891e6f72dd437a1c2a48091aa9182ba17a8f780
F test/wal2.test 9f2c2a00358b1466bc38feda85f105a4fb52f251
F test/wal3.test bb3bc0be06411c2d147c1d1d636b6208fbe0349d
F test/wal3.test d2ae7e66f973bd6b58ce49e546b2c00f44fe0485
F test/wal4.test 640be93f5422df37203aa5e7c06b24fb5e4a2439
F test/wal_common.tcl 875ee2118cd7b292ba22fb9bfa66a984b5226b13
F test/walbak.test e5632adde03fbb0533b9928a89468566ef78a710
F test/walbak.test 4df1c7369da0301caeb9a48fa45997fd592380e4
F test/walcksum.test a37b36375c595e61bdb7e1ec49b5f0979b6fc7ce
F test/walcrash.test f6d5fb2bb108876f04848720a488065d9deef69f
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
@ -830,7 +833,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 01c1278263fdd8454763be15bddd2558e720e6e0
R f945708978bd6e2d6ef2b7036668ceb3
U dan
Z 365ea1ba861987a397d4382540eb2770
P dafb3577a2d5fbeebb17c8176af837f0aebf6ee5 7cbe175a69738499f9218ec56f1a39f040aea9dc
R d0b007e2ef9688923f10274954448b62
U drh
Z 9ed89a67888dd059d0adfcf46fe44cff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD4DBQFMLy2qoxKgR168RlERAgB/AJjRY22W8BVzKcuM5rE4E50Yg6ZtAKCKl5Ee
AuDXrVc9U2hm2JSf79toLw==
=6dms
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
dafb3577a2d5fbeebb17c8176af837f0aebf6ee5
48bf309391c32e7860c293acd13f3dda14212d39

View File

@ -2525,7 +2525,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);
if( SQLITE_OK!=rc ) goto trans_begun;
pBt->initiallyEmpty = pBt->nPage==0;
pBt->initiallyEmpty = (u8)(pBt->nPage==0);
do {
/* Call lockBtree() until either pBt->pPage1 is populated or
** lockBtree() returns something other than SQLITE_OK. lockBtree()
@ -4248,7 +4248,6 @@ int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
if( pCur->eState==CURSOR_INVALID ){
assert( pCur->apPage[pCur->iPage]->nCell==0 );
*pRes = 1;
rc = SQLITE_OK;
}else{
assert( pCur->apPage[pCur->iPage]->nCell>0 );
*pRes = 0;
@ -8013,7 +8012,7 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
/* If setting the version fields to 1, do not automatically open the
** WAL connection, even if the version fields are currently set to 2.
*/
pBt->doNotUseWAL = (iVersion==1);
pBt->doNotUseWAL = (u8)(iVersion==1);
rc = sqlite3BtreeBeginTrans(pBtree, 0);
if( rc==SQLITE_OK ){

View File

@ -34,7 +34,7 @@
** sqlite3OsLock()
**
*/
#if defined(SQLITE_TEST) && (SQLITE_OS_WIN==0)
#if defined(SQLITE_TEST)
int sqlite3_memdebug_vfs_oom_test = 1;
#define DO_OS_MALLOC_TEST(x) \
if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3IsMemJournal(x))) { \

View File

@ -5067,7 +5067,7 @@ static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){
/* transform the db path to a unique cache name */
dbLen = (int)strlen(dbPath);
for( i=0; i<dbLen && (i+len+7)<maxLen; i++){
for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){
char c = dbPath[i];
lPath[i+len] = (c=='/')?'_':c;
}
@ -5208,6 +5208,9 @@ int sqlite3_hostid_num = 0;
#define PROXY_HOSTIDLEN 16 /* conch file host id length */
/* Not always defined in the headers as it ought to be */
extern int gethostuuid(uuid_t id, const struct timespec *wait);
/* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN
** bytes of writable memory.
*/
@ -5257,6 +5260,7 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
char errmsg[64] = "";
int fd = -1;
int rc = -1;
UNUSED_PARAMETER(myHostID);
/* create a new path by replace the trailing '-conch' with '-break' */
pathLen = strlcpy(tPath, cPath, MAXPATHLEN);
@ -5277,7 +5281,7 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
sprintf(errmsg, "create failed (%d)", errno);
goto end_breaklock;
}
if( pwrite(fd, buf, readLen, 0) != readLen ){
if( pwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){
sprintf(errmsg, "write failed (%d)", errno);
goto end_breaklock;
}

View File

@ -1431,6 +1431,9 @@ static int winShmOpen(
*/
if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){
rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0);
if( rc!=SQLITE_OK ){
rc = SQLITE_IOERR_SHMOPEN;
}
}
if( rc==SQLITE_OK ){
winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1);
@ -1657,6 +1660,7 @@ static int winShmLock(
static void winShmBarrier(
sqlite3_file *fd /* Database holding the shared memory */
){
UNUSED_PARAMETER(fd);
/* MemoryBarrier(); // does not work -- do not know why not */
winShmEnterMutex();
winShmLeaveMutex();

View File

@ -2852,7 +2852,7 @@ int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
}
if( pPager->state!=PAGER_UNLOCK ){
sqlite3PagerPagecount(pPager, &nPage);
assert( pPager->mxPgno>=nPage );
assert( (int)pPager->mxPgno>=nPage );
}
return pPager->mxPgno;
}
@ -5649,7 +5649,7 @@ int sqlite3PagerNosync(Pager *pPager){
/*
** Set or retrieve the codec for this pager
*/
static void sqlite3PagerSetCodec(
void sqlite3PagerSetCodec(
Pager *pPager,
void *(*xCodec)(void*,void*,Pgno,int),
void (*xCodecSizeChng)(void*,int,int),
@ -5663,7 +5663,7 @@ static void sqlite3PagerSetCodec(
pPager->pCodec = pCodec;
pagerReportSize(pPager);
}
static void *sqlite3PagerGetCodec(Pager *pPager){
void *sqlite3PagerGetCodec(Pager *pPager){
return pPager->pCodec;
}
#endif
@ -6044,17 +6044,30 @@ int sqlite3PagerWalSupported(Pager *pPager){
}
/*
** Open a connection to the write-ahead log file for pager pPager. If
** the log connection is already open, this function is a no-op.
**
** The caller must be holding a SHARED lock on the database file to call
** this function.
**
** If the pager passed as the first argument is open on a real database
** file (not a temp file or an in-memory database), and the WAL file
** is not already open, make an attempt to open it now. If successful,
** return SQLITE_OK. If an error occurs or the VFS used by the pager does
** not support the xShmXXX() methods, return an error code. *pisOpen is
** not modified in either case.
**
** If the pager is open on a temp-file (or in-memory database), or if
** the WAL file is already open, set *pisOpen to 1 and return SQLITE_OK
** without doing anything.
*/
int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen){
int sqlite3PagerOpenWal(
Pager *pPager, /* Pager object */
int *pisOpen /* OUT: Set to true if call is a no-op */
){
int rc = SQLITE_OK; /* Return code */
assert( pPager->state>=PAGER_SHARED );
if( !pPager->pWal ){
assert( (pisOpen==0 && !pPager->tempFile && !pPager->pWal) || *pisOpen==0 );
if( !pPager->tempFile && !pPager->pWal ){
if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;
/* Open the connection to the log file. If this operation fails,

View File

@ -910,6 +910,7 @@ static int tvfsShmClose(
for(ppFd=&pBuffer->pFile; *ppFd!=pFd; ppFd=&((*ppFd)->pNext));
assert( (*ppFd)==pFd );
*ppFd = pFd->pNext;
pFd->pNext = 0;
if( pBuffer->pFile==0 ){
int i;

View File

@ -4138,14 +4138,13 @@ case OP_Rewind: { /* jump */
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
res = 1;
if( (pCrsr = pC->pCursor)!=0 ){
rc = sqlite3BtreeFirst(pCrsr, &res);
pC->atFirst = res==0 ?1:0;
pC->deferredMoveto = 0;
pC->cacheStatus = CACHE_STALE;
pC->rowidIsValid = 0;
}else{
res = 1;
}
pC->nullRow = (u8)res;
assert( pOp->p2>0 && pOp->p2<p->nOp );
@ -5155,6 +5154,7 @@ case OP_Checkpoint: {
};
#endif
#ifndef SQLITE_OMIT_PRAGMA
/* Opcode: JournalMode P1 P2 P3 * P5
**
** Change the journal mode of database P1 to P3. P3 must be one of the
@ -5279,7 +5279,8 @@ case OP_JournalMode: { /* out2-prerelease */
pOut->enc = SQLITE_UTF8;
sqlite3VdbeChangeEncoding(pOut, encoding);
break;
};
};
#endif /* SQLITE_OMIT_PRAGMA */
#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
/* Opcode: Vacuum * * * * *

View File

@ -830,7 +830,9 @@ void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
** check the value of p->nOp-1 before continuing.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
static const VdbeOp dummy;
/* C89 specifies that the constant "dummy" will be initialized to all
** zeros, which is correct. MSVC generates a warning, nevertheless. */
static const VdbeOp dummy; /* Ignore the MSVC warning about no initializer */
assert( p->magic==VDBE_MAGIC_INIT );
if( addr<0 ){
#ifdef SQLITE_OMIT_TRACE

View File

@ -497,12 +497,12 @@ static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
if( pWal->nWiData<=iPage ){
int nByte = sizeof(u32 *)*(iPage+1);
volatile u32 **apNew;
apNew = (volatile u32 **)sqlite3_realloc(pWal->apWiData, nByte);
apNew = (volatile u32 **)sqlite3_realloc((void *)pWal->apWiData, nByte);
if( !apNew ){
*ppPage = 0;
return SQLITE_NOMEM;
}
memset(&apNew[pWal->nWiData], 0, sizeof(u32 *)*(iPage+1-pWal->nWiData));
memset((void *)&apNew[pWal->nWiData], 0, sizeof(u32 *)*(iPage+1-pWal->nWiData));
pWal->apWiData = apNew;
pWal->nWiData = iPage+1;
}
@ -737,7 +737,7 @@ static int walLockShared(Wal *pWal, int lockIdx){
SQLITE_SHM_LOCK | SQLITE_SHM_SHARED);
WALTRACE(("WAL%p: acquire SHARED-%s %s\n", pWal,
walLockName(lockIdx), rc ? "failed" : "ok"));
VVA_ONLY( pWal->lockError = (rc!=SQLITE_OK && rc!=SQLITE_BUSY); )
VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )
return rc;
}
static void walUnlockShared(Wal *pWal, int lockIdx){
@ -753,7 +753,7 @@ static int walLockExclusive(Wal *pWal, int lockIdx, int n){
SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE);
WALTRACE(("WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\n", pWal,
walLockName(lockIdx), n, rc ? "failed" : "ok"));
VVA_ONLY( pWal->lockError = (rc!=SQLITE_OK && rc!=SQLITE_BUSY); )
VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )
return rc;
}
static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){
@ -901,7 +901,7 @@ static void walCleanupHash(Wal *pWal){
/* Zero the entries in the aPgno array that correspond to frames with
** frame numbers greater than pWal->hdr.mxFrame.
*/
nByte = ((char *)aHash - (char *)&aPgno[iLimit+1]);
nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]);
memset((void *)&aPgno[iLimit+1], 0, nByte);
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
@ -949,7 +949,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){
** entire hash table and aPgno[] array before proceding.
*/
if( idx==1 ){
int nByte = (u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1];
int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]);
memset((void*)&aPgno[1], 0, nByte);
}
@ -969,7 +969,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){
assert( nCollide++ < idx );
}
aPgno[idx] = iPage;
aHash[iKey] = idx;
aHash[iKey] = (ht_slot)idx;
#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
/* Verify that the number of entries in the hash table exactly equals
@ -1077,8 +1077,8 @@ static int walIndexRecover(Wal *pWal){
){
goto finished;
}
pWal->hdr.bigEndCksum = (magic&0x00000001);
pWal->szPage = szPage;
pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);
pWal->szPage = (u16)szPage;
pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);
memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);
@ -1128,7 +1128,7 @@ static int walIndexRecover(Wal *pWal){
if( nTruncate ){
pWal->hdr.mxFrame = iFrame;
pWal->hdr.nPage = nTruncate;
pWal->hdr.szPage = szPage;
pWal->hdr.szPage = (u16)szPage;
aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
aFrameCksum[1] = pWal->hdr.aFrameCksum[1];
}
@ -1456,12 +1456,12 @@ static int walIteratorInit(Wal *pWal, WalIterator **pp){
ht_slot *aIndex; /* Sorted index for this segment */
aPgno++;
nEntry = ((i+1)==nSegment)?(int)(iLast-iZero):(u32 *)aHash-(u32 *)aPgno;
nEntry = (int)(((i+1)==nSegment)?(int)(iLast-iZero):(u32 *)aHash-(u32 *)aPgno);
aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[iZero];
iZero++;
for(j=0; j<nEntry; j++){
aIndex[j] = j;
aIndex[j] = (ht_slot)j;
}
walMergesort((u32 *)aPgno, aTmp, aIndex, &nEntry);
p->aSegment[i].iZero = iZero;
@ -1648,7 +1648,7 @@ int sqlite3WalClose(
sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0);
}
WALTRACE(("WAL%p: closed\n", pWal));
sqlite3_free(pWal->apWiData);
sqlite3_free((void *)pWal->apWiData);
sqlite3_free(pWal);
}
return rc;
@ -1984,7 +1984,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
return WAL_RETRY;
}else{
assert( mxReadMark<=pWal->hdr.mxFrame );
pWal->readLock = mxI;
pWal->readLock = (i16)mxI;
}
}
return rc;
@ -2397,7 +2397,7 @@ int sqlite3WalFrames(
sqlite3Put4byte(&aWalHdr[24], aCksum[0]);
sqlite3Put4byte(&aWalHdr[28], aCksum[1]);
pWal->szPage = szPage;
pWal->szPage = (u16)szPage;
pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;
pWal->hdr.aFrameCksum[0] = aCksum[0];
pWal->hdr.aFrameCksum[1] = aCksum[1];
@ -2491,7 +2491,7 @@ int sqlite3WalFrames(
if( rc==SQLITE_OK ){
/* Update the private copy of the header. */
pWal->hdr.szPage = szPage;
pWal->hdr.szPage = (u16)szPage;
pWal->hdr.mxFrame = iFrame;
if( isCommit ){
pWal->hdr.iChange++;

View File

@ -1841,7 +1841,7 @@ static void constructAutomaticIndex(
}
}
}
assert( n==pLevel->plan.nEq );
assert( (u32)n==pLevel->plan.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
@ -3435,7 +3435,7 @@ static Bitmask codeOneLoopStart(
** a forward order scan on a descending index, interchange the
** start and end terms (pRangeStart and pRangeEnd).
*/
if( bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC) ){
if( nEq<pIdx->nColumn && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC) ){
SWAP(WhereTerm *, pRangeEnd, pRangeStart);
}

View File

@ -334,6 +334,7 @@ if {$tcl_platform(platform)!="windows"} {
sqlite3 db2 test2.db
sqlite3_extended_result_codes db2 1
db2 eval {
PRAGMA journal_mode = DELETE; /* For inmemory_journal permutation */
PRAGMA synchronous = 0;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);

View File

@ -15,6 +15,13 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# This script only runs if shared-cache and unlock-notify are available.
#
ifcapable !unlock_notify||!shared_cache {
finish_test
return
}
set esc [sqlite3_enable_shared_cache 1]
sqlite3 db test.db

View File

@ -1015,6 +1015,7 @@ do_test pager1-5.5.2 {
do_test pager1-6.1 {
faultsim_delete_and_reopen
execsql {
PRAGMA auto_vacuum = none;
PRAGMA max_page_count = 10;
CREATE TABLE t2(a, b);
CREATE TABLE t3(a, b);
@ -1357,6 +1358,7 @@ tv sectorsize 4096
do_test pager1.10.x.1 {
faultsim_delete_and_reopen
execsql {
PRAGMA auto_vacuum = none;
PRAGMA page_size = 1024;
CREATE TABLE t1(x);
}
@ -1429,11 +1431,21 @@ tv delete
#-------------------------------------------------------------------------
# Test "PRAGMA page_size"
#
testvfs tv -default 1
tv sectorsize 1024
foreach pagesize {
512 1024 2048 4096 8192 16384 32768
} {
faultsim_delete_and_reopen
# The sector-size (according to the VFS) is 1024 bytes. So if the
# page-size requested using "PRAGMA page_size" is greater than the
# compile time value of SQLITE_MAX_PAGE_SIZE, then the effective
# page-size remains 1024 bytes.
#
set eff $pagesize
if {$eff > $::SQLITE_MAX_PAGE_SIZE} { set eff 1024 }
do_test pager1-12.$pagesize.1 {
sqlite3 db2 test.db
execsql "
@ -1441,22 +1453,24 @@ foreach pagesize {
CREATE VIEW v AS SELECT * FROM sqlite_master;
" db2
file size test.db
} $pagesize
} $eff
do_test pager1-12.$pagesize.2 {
sqlite3 db2 test.db
execsql {
SELECT count(*) FROM v;
PRAGMA main.page_size;
} db2
} [list 1 $pagesize]
} [list 1 $eff]
do_test pager1-12.$pagesize.3 {
execsql {
SELECT count(*) FROM v;
PRAGMA main.page_size;
}
} [list 1 $pagesize]
} [list 1 $eff]
db2 close
}
db close
tv delete
#-------------------------------------------------------------------------
# Test specal "PRAGMA journal_mode=PERSIST" test cases.

View File

@ -241,8 +241,11 @@ do_faultsim_test pagerfault-5.3 -faults oom-transient -prep {
}
} -test {
faultsim_test_result {0 {}}
faultsim_integrity_check
catchsql { COMMIT }
catchsql { ROLLBACK }
faultsim_integrity_check
set res ""
set rc [catch { set res [db one { PRAGMA aux.integrity_check }] }]
if {$rc!=0 || $res != "ok"} {error "integrity-check problem:$rc $res"}

View File

@ -36,6 +36,7 @@ do_test pagerfault2-1-pre1 {
faultsim_delete_and_reopen
db func a_string a_string
execsql {
PRAGMA auto_vacuum = 0;
PRAGMA journal_mode = DELETE;
PRAGMA page_size = 1024;
CREATE TABLE t1(a, b);

View File

@ -160,22 +160,16 @@ lappend ::testsuitelist xxx
test_suite "coverage-wal" -description {
Coverage tests for file wal.c.
} -files {
wal.test wal2.test wal3.test walmode.test
walbak.test walhook.test walcrash2.test walcksum.test
wal.test wal2.test wal3.test walmode.test
walbak.test walhook.test walcrash2.test walcksum.test
walfault.test
}
test_suite "coverage-pager" -description {
Coverage tests for file pager.c.
} -files {
pager1.test
pager2.test
pagerfault.test
pagerfault2.test
walfault.test
walbak.test
journal2.test
tkt-9d68c883.test
pager1.test pager2.test pagerfault.test pagerfault2.test
walfault.test walbak.test journal2.test tkt-9d68c883.test
}

View File

@ -371,6 +371,10 @@ proc speed_trial_tcl {name numstmt units script} {
proc speed_trial_init {name} {
global total_time
set total_time 0
sqlite3 versdb :memory:
set vers [versdb one {SELECT sqlite_source_id()}]
versdb close
puts "SQLite $vers"
}
proc speed_trial_summary {name} {
global total_time

View File

@ -119,7 +119,6 @@ do_multiclient_test i {
do_test wal3-2.$tn.1 {
sql1 {
PRAGMA page_size = 1024;
PRAGMA auto_vacuum = OFF;
PRAGMA journal_mode = WAL;
}
sql1 {

View File

@ -16,6 +16,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/wal_common.tcl
source $testdir/malloc_common.tcl
do_not_use_codec
@ -25,8 +26,12 @@ ifcapable !wal {finish_test ; return }
# Test organization:
#
# walback-1.*: Simple tests.
#
# walback-2.*: Test backups when the source db is modified mid-backup.
#
# walback-3.*: Backup of WAL sources into rollback destinations, and
# vice-versa.
#
# Make sure a simple backup from a WAL database works.
#
@ -181,5 +186,94 @@ do_test walbak-2.12 {
string compare [sig db] [sig db2]
} {0}
db2 close
db close
#-------------------------------------------------------------------------
# Run some backup operations to copy back and forth between WAL and:
#
# walbak-3.1.*: an in-memory database
#
# walbak-3.2.*: a temporary database
#
# walbak-3.3.*: a database in rollback mode.
#
# walbak-3.4.*: a database in rollback mode that (initially) uses a
# different page-size.
#
# Check that this does not confuse any connected clients.
#
foreach {tn setup} {
1 {
sqlite3 db test.db
sqlite3 db2 :memory:
db eval { PRAGMA page_size = 1024 ; PRAGMA journal_mode = WAL }
db2 eval { PRAGMA page_size = 1024 }
}
2 {
sqlite3 db test.db
sqlite3 db2 ""
db eval { PRAGMA page_size = 1024 ; PRAGMA journal_mode = WAL }
db2 eval { PRAGMA page_size = 1024 }
}
3 {
sqlite3 db test.db
sqlite3 db2 test.db2
db eval { PRAGMA page_size = 1024 ; PRAGMA journal_mode = WAL }
db2 eval { PRAGMA page_size = 1024 ; PRAGMA journal_mode = PERSIST }
}
4 {
sqlite3 db test.db
sqlite3 db2 test.db2
db eval { PRAGMA page_size = 1024 ; PRAGMA journal_mode = WAL }
db2 eval {
PRAGMA page_size = 2048;
PRAGMA journal_mode = PERSIST;
CREATE TABLE xx(x);
}
}
} {
foreach f [glob -nocomplain test.db*] { file delete -force $f }
eval $setup
do_test walbak-3.$tn.1 {
execsql {
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
SELECT * FROM t1;
}
} {1 2 3 4}
do_test walbak-3.$tn.2 {
sqlite3_backup B db2 main db main
B step 10000
B finish
execsql { SELECT * FROM t1 } db2
} {1 2 3 4}
do_test walbak-3.$tn.3 {
execsql {
INSERT INTO t1 VALUES(5, 6);
INSERT INTO t1 VALUES(7, 8);
SELECT * FROM t1;
} db2
} {1 2 3 4 5 6 7 8}
do_test walbak-3.$tn.4 {
sqlite3_backup B db main db2 main
B step 10000
B finish
execsql { SELECT * FROM t1 }
} {1 2 3 4 5 6 7 8}
db close
db2 close
}
finish_test