From 532f179cabf9af8facf244648776f8b17f98f846 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 14 Jul 2015 17:18:05 +0000 Subject: [PATCH 01/20] Fix some harmless compiler warnings. FossilOrigin-Name: 3de030c904d125ccf41fa1929646b8a002b5341b --- ext/fts5/fts5_aux.c | 14 +++++++------- ext/fts5/fts5_index.c | 10 ++++------ ext/fts5/fts5_main.c | 4 ++-- ext/fts5/fts5_storage.c | 6 +++--- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/btree.c | 2 +- 7 files changed, 29 insertions(+), 31 deletions(-) diff --git a/ext/fts5/fts5_aux.c b/ext/fts5/fts5_aux.c index 3f9c227e6a..818dfcf297 100644 --- a/ext/fts5/fts5_aux.c +++ b/ext/fts5/fts5_aux.c @@ -255,7 +255,7 @@ static void fts5SnippetFunction( int iCol; /* 1st argument to snippet() */ const char *zEllips; /* 4th argument to snippet() */ int nToken; /* 5th argument to snippet() */ - int nInst; /* Number of instance matches this row */ + int nInst = 0; /* Number of instance matches this row */ int i; /* Used to iterate through instances */ int nPhrase; /* Number of phrases in query */ unsigned char *aSeen; /* Array of "seen instance" flags */ @@ -263,7 +263,7 @@ static void fts5SnippetFunction( int iBestStart = 0; /* First token of best snippet */ int iBestLast; /* Last token of best snippet */ int nBestScore = 0; /* Score of best snippet */ - int nColSize; /* Total size of iBestCol in tokens */ + int nColSize = 0; /* Total size of iBestCol in tokens */ if( nVal!=5 ){ const char *zErr = "wrong number of arguments to function snippet()"; @@ -407,8 +407,8 @@ static int fts5Bm25GetData( p = pApi->xGetAuxdata(pFts, 0); if( p==0 ){ int nPhrase; /* Number of phrases in query */ - sqlite3_int64 nRow; /* Number of rows in table */ - sqlite3_int64 nToken; /* Number of tokens in table */ + sqlite3_int64 nRow = 0; /* Number of rows in table */ + sqlite3_int64 nToken = 0; /* Number of tokens in table */ int nByte; /* Bytes of space to allocate */ int i; @@ -481,9 +481,9 @@ static void fts5Bm25Function( double score = 0.0; /* SQL function return value */ Fts5Bm25Data *pData; /* Values allocated/calculated once only */ int i; /* Iterator variable */ - int nInst; /* Value returned by xInstCount() */ - double D; /* Total number of tokens in row */ - double *aFreq; /* Array of phrase freq. for current row */ + int nInst = 0; /* Value returned by xInstCount() */ + double D = 0.0; /* Total number of tokens in row */ + double *aFreq = 0; /* Array of phrase freq. for current row */ /* Calculate the phrase frequency (symbol "f(qi,D)" in the documentation) ** for each phrase in the query for the current row. */ diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index 0b8f137ebf..dc664aab71 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -738,7 +738,7 @@ static Fts5Data *fts5DataReadOrBuffer( if( rc==SQLITE_ERROR ) rc = FTS5_CORRUPT; if( rc==SQLITE_OK ){ - u8 *aOut; /* Read blob data into this buffer */ + u8 *aOut = 0; /* Read blob data into this buffer */ int nByte = sqlite3_blob_bytes(p->pReader); if( pBuf ){ fts5BufferSize(pBuf, MAX(nByte, p->pConfig->pgsz) + 20); @@ -1198,7 +1198,7 @@ static void fts5StructurePromote( if( p->rc==SQLITE_OK ){ int iTst; int iPromote = -1; - int szPromote; /* Promote anything this size or smaller */ + int szPromote = 0; /* Promote anything this size or smaller */ Fts5StructureSegment *pSeg; /* Segment just written */ int szSeg; /* Size of segment just written */ @@ -1863,8 +1863,8 @@ static void fts5SegIterNext( } }else if( pIter->pSeg==0 ){ const u8 *pList = 0; - const char *zTerm; - int nList; + const char *zTerm = 0; + int nList = 0; if( 0==(pIter->flags & FTS5_SEGITER_ONETERM) ){ sqlite3Fts5HashScanNext(p->pHash); sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); @@ -2215,7 +2215,6 @@ static void fts5LeafSeek( while( 1 ){ int i; int nCmp; - i64 rowid; /* Figure out how many new bytes are in this term */ fts5IndexGetVarint32(a, iOff, nNew); @@ -2324,7 +2323,6 @@ static void fts5SegIterSeekInit( int h; int bGe = (flags & FTS5INDEX_QUERY_SCAN); int bDlidx = 0; /* True if there is a doclist-index */ - Fts5Data *pLeaf; static int nCall = 0; nCall++; diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index ccb94bd8d6..87902935b4 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -361,7 +361,7 @@ static int fts5InitVtab( Fts5Global *pGlobal = (Fts5Global*)pAux; const char **azConfig = (const char**)argv; int rc = SQLITE_OK; /* Return code */ - Fts5Config *pConfig; /* Results of parsing argc/argv */ + Fts5Config *pConfig = 0; /* Results of parsing argc/argv */ Fts5Table *pTab = 0; /* New virtual table object */ /* Allocate the new vtab object and parse the configuration */ @@ -756,7 +756,7 @@ static int fts5CursorReseek(Fts5Cursor *pCsr, int *pbSkip){ */ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; - int rc; + int rc = SQLITE_OK; assert( (pCsr->ePlan<2)== (pCsr->ePlan==FTS5_PLAN_MATCH || pCsr->ePlan==FTS5_PLAN_SOURCE) diff --git a/ext/fts5/fts5_storage.c b/ext/fts5/fts5_storage.c index 601f85713e..da822ffad2 100644 --- a/ext/fts5/fts5_storage.c +++ b/ext/fts5/fts5_storage.c @@ -501,7 +501,7 @@ static int fts5StorageSaveTotals(Fts5Storage *p){ int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel){ Fts5Config *pConfig = p->pConfig; int rc; - sqlite3_stmt *pDel; + sqlite3_stmt *pDel = 0; rc = fts5StorageLoadTotals(p, 1); @@ -545,7 +545,7 @@ int sqlite3Fts5StorageSpecialDelete( ){ Fts5Config *pConfig = p->pConfig; int rc; - sqlite3_stmt *pDel; + sqlite3_stmt *pDel = 0; assert( pConfig->eContent!=FTS5_CONTENT_NORMAL ); rc = fts5StorageLoadTotals(p, 1); @@ -719,7 +719,7 @@ int sqlite3Fts5StorageInsert( ){ Fts5Config *pConfig = p->pConfig; int rc = SQLITE_OK; /* Return code */ - sqlite3_stmt *pInsert; /* Statement used to write %_content table */ + sqlite3_stmt *pInsert = 0; /* Statement used to write %_content table */ int eStmt = 0; /* Type of statement used on %_content */ int i; /* Counter variable */ Fts5InsertCtx ctx; /* Tokenization callback context object */ diff --git a/manifest b/manifest index a07ab9a0dd..9780c6d113 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Always\sinvoke\sthe\sprofile\scallback\seven\sif\sthe\sstatement\sdoes\snot\srun\sto\ncompletion. -D 2015-07-14T14:48:50.217 +C Fix\ssome\sharmless\scompiler\swarnings. +D 2015-07-14T17:18:05.834 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2a4a94d9c6ad8cde388b672d89d1463e6f38a6da F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -107,14 +107,14 @@ F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95 F ext/fts5/extract_api_docs.tcl 06583c935f89075ea0b32f85efa5dd7619fcbd03 F ext/fts5/fts5.h 81d1a92fc2b4bd477af7e4e0b38b456f3e199fba F ext/fts5/fts5Int.h 8d9bce1847a10df2e4ed9492ea4f3868276748fb -F ext/fts5/fts5_aux.c 7cd0e2858171dacf505fea4e2e84ee6126854c3d +F ext/fts5/fts5_aux.c 044cb176a815f4388308738437f6e130aa384fb0 F ext/fts5/fts5_buffer.c 80f9ba4431848cb857e3d2158f5280093dcd8015 F ext/fts5/fts5_config.c b2456e9625bca41c51d54c363e369c6356895c90 F ext/fts5/fts5_expr.c d2e148345639c5a5583e0daa39a639bf298ae6a7 F ext/fts5/fts5_hash.c 219f4edd72e5cf95b19c33f1058809a18fad5229 -F ext/fts5/fts5_index.c 1a1fd996dfe2d632df1dd00689553bc0d205497d -F ext/fts5/fts5_main.c 2e43726b3ef40b3d5efc0adc7c279d857b1c74fe -F ext/fts5/fts5_storage.c 4cae85b5287b159d9d98174a4e70adf872b0930a +F ext/fts5/fts5_index.c cfd41d49591e4e4ce2a5f84de35512f59fbb360d +F ext/fts5/fts5_main.c 8f279999deb204b0c7760464f60f88666046398b +F ext/fts5/fts5_storage.c 1c35a38a564ee9cadcbd7ae0b13a806bdda722bd F ext/fts5/fts5_tcl.c 85eb4e0d0fefa9420b78151496ad4599a1783e20 F ext/fts5/fts5_tokenize.c 30f97a8c74683797b4cd233790444fbefb3b0708 F ext/fts5/fts5_unicode2.c 78273fbd588d1d9bd0a7e4e0ccc9207348bae33c @@ -269,7 +269,7 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240 F src/backup.c 4d9134dc988a87838c06056c89c0e8c4700a0452 F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79 -F src/btree.c 781deff0d5af639e8dd4f83ec963cc3bbf8cffc2 +F src/btree.c f48b3ef91676c06a90a8832987ecef6b94c931ee F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1 F src/btreeInt.h 2ad754dd4528baa8d0946a593cc373b890bf859e F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e548d77b3c91cdf11c78d1a688fd768e209bdbf5 -R f434f0b9092147e4e9389e2958ccbd33 -U drh -Z 3bea78814fd8f9c4678ec13302736bdc +P 202479aa0a62067343e724487960b8a039e2e978 +R 2160d68c9d0127f66e3d6f1278c01344 +U mistachkin +Z a4e5a6ada18fe91bfc53e29cc79ebc33 diff --git a/manifest.uuid b/manifest.uuid index e4e6a3512a..a29e2790a6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -202479aa0a62067343e724487960b8a039e2e978 \ No newline at end of file +3de030c904d125ccf41fa1929646b8a002b5341b \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 17c7bb67c3..2692ade8e4 100644 --- a/src/btree.c +++ b/src/btree.c @@ -8959,7 +8959,7 @@ static int checkTreePage( const char *saved_zPfx = pCheck->zPfx; int saved_v1 = pCheck->v1; int saved_v2 = pCheck->v2; - u8 savedIsInit; + u8 savedIsInit = 0; /* Check that the page exists */ From 65a88fcb421c234849ecd2542ed198d3995a80be Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 14 Jul 2015 21:56:17 +0000 Subject: [PATCH 02/20] Skip trying to include 'intrin.h' when compiling for WinCE with MSVC. FossilOrigin-Name: 6db90ca2b4ac806b42532072ebe6b2a4a7b9713d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/sqliteInt.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9780c6d113..9d73744804 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\sharmless\scompiler\swarnings. -D 2015-07-14T17:18:05.834 +C Skip\strying\sto\sinclude\s'intrin.h'\swhen\scompiling\sfor\sWinCE\swith\sMSVC. +D 2015-07-14T21:56:17.995 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2a4a94d9c6ad8cde388b672d89d1463e6f38a6da F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -332,7 +332,7 @@ F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7 F src/sqlite.h.in 3d951bf985839de7fcf4d3f69568bb4df2641abe F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066 -F src/sqliteInt.h d8d420d66a5c403b119696159b69f71cd53840ce +F src/sqliteInt.h 61e6e8e6f37a665452f677f2d82f9c2c4cecdbd2 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 202479aa0a62067343e724487960b8a039e2e978 -R 2160d68c9d0127f66e3d6f1278c01344 +P 3de030c904d125ccf41fa1929646b8a002b5341b +R 005ae2df59e13158535147c0afd5a97b U mistachkin -Z a4e5a6ada18fe91bfc53e29cc79ebc33 +Z b7895c5a0dbe848b1ad5c81c9335730e diff --git a/manifest.uuid b/manifest.uuid index a29e2790a6..9fca29ab1f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3de030c904d125ccf41fa1929646b8a002b5341b \ No newline at end of file +6db90ca2b4ac806b42532072ebe6b2a4a7b9713d \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 199a1cc662..862b2f68d2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -189,7 +189,7 @@ ** Make sure that the compiler intrinsics we desire are enabled when ** compiling with an appropriate version of MSVC. */ -#if defined(_MSC_VER) && _MSC_VER>=1300 +#if defined(_MSC_VER) && _MSC_VER>=1300 && !defined(_WIN32_WCE) # include # pragma intrinsic(_byteswap_ushort) # pragma intrinsic(_byteswap_ulong) From bc50bb7f53a562d5669fdc6240e23e17175b63b0 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 14 Jul 2015 21:56:53 +0000 Subject: [PATCH 03/20] Further refine FTS5 cleanup in Makefiles. FossilOrigin-Name: b53a95063cf6b8ee8cad77e9fff4c50a356c43bb --- Makefile.in | 2 +- Makefile.msc | 2 +- main.mk | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0cbd80cc4b..2c91b8252d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1189,7 +1189,7 @@ clean: rm -f fuzzershell fuzzershell.exe rm -f fuzzcheck fuzzcheck.exe rm -f sqldiff sqldiff.exe - rm -f fts5.c fts5.h fts5parse.* + rm -f fts5.* fts5parse.* distclean: clean rm -f config.log config.status libtool Makefile sqlite3.pc diff --git a/Makefile.msc b/Makefile.msc index 02a3330a24..ed6e58e949 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1833,7 +1833,7 @@ clean: del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL del /Q sqlite-*-output.vsix 2>NUL del /Q fuzzershell.exe fuzzcheck.exe sqldiff.exe 2>NUL - del /Q fts5.c fts5.h fts5parse.* 2>NUL + del /Q fts5.* fts5parse.* 2>NUL # Dynamic link library section. # diff --git a/main.mk b/main.mk index 4b84873316..0219689201 100644 --- a/main.mk +++ b/main.mk @@ -869,4 +869,4 @@ clean: rm -f fuzzershell fuzzershell.exe rm -f fuzzcheck fuzzcheck.exe rm -f sqldiff sqldiff.exe - rm -f fts5.c fts5.h fts5parse.* + rm -f fts5.* fts5parse.* diff --git a/manifest b/manifest index 9d73744804..57be5c7709 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Skip\strying\sto\sinclude\s'intrin.h'\swhen\scompiling\sfor\sWinCE\swith\sMSVC. -D 2015-07-14T21:56:17.995 +C Further\srefine\sFTS5\scleanup\sin\sMakefiles. +D 2015-07-14T21:56:53.776 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 2a4a94d9c6ad8cde388b672d89d1463e6f38a6da +F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 86926e2330ad4b7ae6d4674762b53b293873b3fb +F Makefile.msc efafcbf2be203b61dc7b6301703544753c513cb2 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db @@ -248,7 +248,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 551665e0bf7bd275a3e49dc8569ccb17098f7179 +F main.mk 7f0c666075028f306001ec9e883cf20dcb2deb64 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk 0e7f04a8eb90f92259e47d80110e4e98d7ce337a F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3de030c904d125ccf41fa1929646b8a002b5341b -R 005ae2df59e13158535147c0afd5a97b +P 6db90ca2b4ac806b42532072ebe6b2a4a7b9713d +R 8e7a1fc75fdd853e0505391914a90ba5 U mistachkin -Z b7895c5a0dbe848b1ad5c81c9335730e +Z 9c90a50d81f502459cfc9d381f2f84f0 diff --git a/manifest.uuid b/manifest.uuid index 9fca29ab1f..fae52a1e73 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6db90ca2b4ac806b42532072ebe6b2a4a7b9713d \ No newline at end of file +b53a95063cf6b8ee8cad77e9fff4c50a356c43bb \ No newline at end of file From a8dbd52abbc0579601e3e56aa43ba03077054fb9 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 14 Jul 2015 22:43:37 +0000 Subject: [PATCH 04/20] Amplify the comment on renderLogMsg() that explains the problems associated with calling sqlite3_log() from deep within the memory allocator. FossilOrigin-Name: a73d7128fbca8dde5e90bd46ee915e39ae07dd1f --- ext/ota/sqlite3ota.h | 1 - manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/printf.c | 5 +++++ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ext/ota/sqlite3ota.h b/ext/ota/sqlite3ota.h index a255611ea8..76f5aba5fb 100644 --- a/ext/ota/sqlite3ota.h +++ b/ext/ota/sqlite3ota.h @@ -416,4 +416,3 @@ int sqlite3ota_create_vfs(const char *zName, const char *zParent); void sqlite3ota_destroy_vfs(const char *zName); #endif /* _SQLITE3OTA_H */ - diff --git a/manifest b/manifest index 57be5c7709..072ea3edba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\srefine\sFTS5\scleanup\sin\sMakefiles. -D 2015-07-14T21:56:53.776 +C Amplify\sthe\scomment\son\srenderLogMsg()\sthat\sexplains\sthe\sproblems\sassociated\nwith\scalling\ssqlite3_log()\sfrom\sdeep\swithin\sthe\smemory\sallocator. +D 2015-07-14T22:43:37.988 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -217,7 +217,7 @@ F ext/ota/otacrash.test 8346192b2d46cbe7787d5d65904d81d3262a3cbf F ext/ota/otafault.test 8c43586c2b96ca16bbce00b5d7e7d67316126db8 F ext/ota/otafault2.test fa202a98ca221faec318f3e5c5f39485b1256561 F ext/ota/sqlite3ota.c 21575d86eac30482a9bfbb2a531f433015e0e03c -F ext/ota/sqlite3ota.h 00028de37eede471ff1947d455cc3f33d3a911c6 +F ext/ota/sqlite3ota.h 4c66588429338b8977f33caa4c1d026d16fc383e F ext/ota/test_ota.c a876f88550d7d59a3ef62d4c1a5c04c4c2f1ebe1 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/rtree.c 0f9b595bd0debcbedf1d7a63d0e0678d619e6c9c @@ -323,7 +323,7 @@ F src/pcache1.c 3f4c87cf913f2de8189026d9a5223ddaf55eaf6b F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7 F src/pragma.h b8632d7cdda7b25323fa580e3e558a4f0d4502cc F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1 -F src/printf.c db11b5960105ee661dcac690f2ae6276e49bf251 +F src/printf.c 2bc439ff20a4aad0e0ad50a37a67b5eae7d20edc F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 2d47554370de8de6dd5be060cef9559eec315005 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6db90ca2b4ac806b42532072ebe6b2a4a7b9713d -R 8e7a1fc75fdd853e0505391914a90ba5 -U mistachkin -Z 9c90a50d81f502459cfc9d381f2f84f0 +P b53a95063cf6b8ee8cad77e9fff4c50a356c43bb +R 26006e835c43647146db287bec9bd4c4 +U drh +Z dc5623ac8940b300cc2e3eac0d79ceed diff --git a/manifest.uuid b/manifest.uuid index fae52a1e73..280fe995b1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b53a95063cf6b8ee8cad77e9fff4c50a356c43bb \ No newline at end of file +a73d7128fbca8dde5e90bd46ee915e39ae07dd1f \ No newline at end of file diff --git a/src/printf.c b/src/printf.c index 72b9497d7b..018df412f4 100644 --- a/src/printf.c +++ b/src/printf.c @@ -1012,6 +1012,11 @@ char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ ** sqlite3_log() must render into a static buffer. It cannot dynamically ** allocate memory because it might be called while the memory allocator ** mutex is held. +** +** sqlite3VXPrintf() might ask for *temporary* memory allocations for +** certain format characters (%q) or for very large precisions or widths. +** Care must be taken that any sqlite3_log() calls that occur while the +** memory mutex is held do not use these mechanisms. */ static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){ StrAccum acc; /* String accumulator */ From 3cf9c12008b7dbb037973ff96e96fa6b5b0790d7 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 15 Jul 2015 13:56:34 +0000 Subject: [PATCH 05/20] Fix the fuzz3.test script so that it works with the new bulk pagecache allocation feature. FossilOrigin-Name: 829a2dbaf17413743b58ce0533d556031a14195a --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/fuzz3.test | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 072ea3edba..1cda851569 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Amplify\sthe\scomment\son\srenderLogMsg()\sthat\sexplains\sthe\sproblems\sassociated\nwith\scalling\ssqlite3_log()\sfrom\sdeep\swithin\sthe\smemory\sallocator. -D 2015-07-14T22:43:37.988 +C Fix\sthe\sfuzz3.test\sscript\sso\sthat\sit\sworks\swith\sthe\snew\sbulk\spagecache\nallocation\sfeature. +D 2015-07-15T13:56:34.803 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -732,7 +732,7 @@ F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4 F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74 F test/fuzz.test 96083052bf5765e4518c1ba686ce2bab785670d1 F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1 -F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3 +F test/fuzz3.test 0d13010d1c13003a3aa57dda2f69b6b71ccac46e F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26 F test/fuzzcheck.c b973b06b500e6fc052d7059257cdf70df1f3a986 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b53a95063cf6b8ee8cad77e9fff4c50a356c43bb -R 26006e835c43647146db287bec9bd4c4 +P a73d7128fbca8dde5e90bd46ee915e39ae07dd1f +R 1575b64aa232857a5cba2b7d0fa0d544 U drh -Z dc5623ac8940b300cc2e3eac0d79ceed +Z 5196f1c48257576357ef4df004b3f923 diff --git a/manifest.uuid b/manifest.uuid index 280fe995b1..db5059ad5b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a73d7128fbca8dde5e90bd46ee915e39ae07dd1f \ No newline at end of file +829a2dbaf17413743b58ce0533d556031a14195a \ No newline at end of file diff --git a/test/fuzz3.test b/test/fuzz3.test index 2b21404f43..e54b811142 100644 --- a/test/fuzz3.test +++ b/test/fuzz3.test @@ -21,6 +21,13 @@ source $testdir/tester.tcl # These tests deal with corrupt database files # database_may_be_corrupt +db close +sqlite3_shutdown +sqlite3_config_pagecache 0 0 +sqlite3_initialize +autoinstall_test_functions +sqlite3 db test.db + expr srand(123) From 618ee61e048737307769ca61d01f4d967693c2ec Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 15 Jul 2015 18:04:48 +0000 Subject: [PATCH 06/20] Attempt to fix harmless warnings generated by GCC and Clang runtime analyzers. FossilOrigin-Name: b522c95ddcd7046dca756f4d1a1e90c34dbcab64 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/date.c | 2 +- src/test1.c | 3 +++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1cda851569..69b8bcf68e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sfuzz3.test\sscript\sso\sthat\sit\sworks\swith\sthe\snew\sbulk\spagecache\nallocation\sfeature. -D 2015-07-15T13:56:34.803 +C Attempt\sto\sfix\sharmless\swarnings\sgenerated\sby\sGCC\sand\sClang\sruntime\sanalyzers. +D 2015-07-15T18:04:48.790 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -276,7 +276,7 @@ F src/build.c b3f15255d5b16e42dafeaa638fd4f8a47c94ed70 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f F src/ctime.c 5a0b735dc95604766f5dac73973658eef782ee8b -F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac +F src/date.c 8ec787fed4929d8ccdf6b1bc360fccc3e1d2ca58 F src/dbstat.c f402e77e25089c6003d0c60b3233b9b3947d599a F src/delete.c 8857a6f27560718f65d43bdbec86c967ae1f8dfa F src/expr.c c5c58e4d01c7ceb2266791d8d877f1b23a88e316 @@ -337,7 +337,7 @@ F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e F src/tclsqlite.c 13b9c2aa725882de807377fa889682eff2a74114 -F src/test1.c e055ab594a48d25720ed31daa5eced1163544488 +F src/test1.c 375d7bd56d9f806095deb91a3dafe61bd0e367c8 F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d F src/test3.c 64d2afdd68feac1bb5e2ffb8226c8c639f798622 F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a73d7128fbca8dde5e90bd46ee915e39ae07dd1f -R 1575b64aa232857a5cba2b7d0fa0d544 +P 829a2dbaf17413743b58ce0533d556031a14195a +R 81af9970925c4f23f9b8c535565a4e96 U drh -Z 5196f1c48257576357ef4df004b3f923 +Z b330313b2eaf1b169130b9aad32db66a diff --git a/manifest.uuid b/manifest.uuid index db5059ad5b..e0fc25ee7e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -829a2dbaf17413743b58ce0533d556031a14195a \ No newline at end of file +b522c95ddcd7046dca756f4d1a1e90c34dbcab64 \ No newline at end of file diff --git a/src/date.c b/src/date.c index 5f3f247ca9..6b11d9904a 100644 --- a/src/date.c +++ b/src/date.c @@ -355,7 +355,7 @@ static void computeYMD(DateTime *p){ A = Z + 1 + A - (A/4); B = A + 1524; C = (int)((B - 122.1)/365.25); - D = (36525*C)/100; + D = (36525*(C&32767))/100; E = (int)((B-D)/30.6001); X1 = (int)(30.6001*E); p->D = B - D - X1; diff --git a/src/test1.c b/src/test1.c index 3885b71ca7..15fd8c7f7d 100644 --- a/src/test1.c +++ b/src/test1.c @@ -273,6 +273,9 @@ static int clang_sanitize_address( # if __has_feature(address_sanitizer) res = 1; # endif +#endif +#ifdef __SANITIZE_ADDRESS__ + res = 1; #endif if( res==0 && getenv("OMIT_MISUSE")!=0 ) res = 1; Tcl_SetObjResult(interp, Tcl_NewIntObj(res)); From f4fa0b80738a90d5bc3a627722146b699b79a7ae Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 15 Jul 2015 18:35:54 +0000 Subject: [PATCH 07/20] Fix some harmless compiler warnings. FossilOrigin-Name: 110cd84f5e842c4dcd9b9398cea211e25f36b3aa --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/wal.c | 10 +++++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 69b8bcf68e..824a4c2997 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\sfix\sharmless\swarnings\sgenerated\sby\sGCC\sand\sClang\sruntime\sanalyzers. -D 2015-07-15T18:04:48.790 +C Fix\ssome\sharmless\scompiler\swarnings. +D 2015-07-15T18:35:54.200 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -401,7 +401,7 @@ F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0 F src/vtab.c 082b35a25a26e3d36f365ca8cd73c1922532f05e F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb -F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113 +F src/wal.c 6c9354c72452ab5699a44381ae03004ee2893824 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 F src/where.c 909eba3b6db984eb2adfbca9de2c237ee7056adb @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 829a2dbaf17413743b58ce0533d556031a14195a -R 81af9970925c4f23f9b8c535565a4e96 +P b522c95ddcd7046dca756f4d1a1e90c34dbcab64 +R 5ae06ee700ba79856dd8d83789b8e902 U drh -Z b330313b2eaf1b169130b9aad32db66a +Z c7acc62193fe6f94b78724b3b176c9a0 diff --git a/manifest.uuid b/manifest.uuid index e0fc25ee7e..3c8bff2494 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b522c95ddcd7046dca756f4d1a1e90c34dbcab64 \ No newline at end of file +110cd84f5e842c4dcd9b9398cea211e25f36b3aa \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index ce98149e3c..69f335d792 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1460,7 +1460,7 @@ static void walMergesort( int nMerge = 0; /* Number of elements in list aMerge */ ht_slot *aMerge = 0; /* List to be merged */ int iList; /* Index into input list */ - int iSub = 0; /* Index into aSub array */ + u32 iSub = 0; /* Index into aSub array */ struct Sublist aSub[13]; /* Array of sub-lists */ memset(aSub, 0, sizeof(aSub)); @@ -1471,7 +1471,9 @@ static void walMergesort( nMerge = 1; aMerge = &aList[iList]; for(iSub=0; iList & (1<aList && p->nList<=(1<aList==&aList[iList&~((2<aList, p->nList, &aMerge, &nMerge, aBuffer); @@ -1482,7 +1484,9 @@ static void walMergesort( for(iSub++; iSubnList<=(1<aList==&aList[nList&~((2<aList, p->nList, &aMerge, &nMerge, aBuffer); From 3a2a68640922ac28a75720db76d026609840421f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Wed, 15 Jul 2015 21:00:33 +0000 Subject: [PATCH 08/20] Make the debugging line numbers in the amalgamation more accurate. FossilOrigin-Name: 3b34e95ca85a6dd7d0766e43035a6cec4bc724a1 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- tool/mksqlite3c-noext.tcl | 4 ++++ tool/mksqlite3c.tcl | 4 ++++ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 824a4c2997..d3cfa707d7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\sharmless\scompiler\swarnings. -D 2015-07-15T18:35:54.200 +C Make\sthe\sdebugging\sline\snumbers\sin\sthe\samalgamation\smore\saccurate. +D 2015-07-15T21:00:33.917 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1329,8 +1329,8 @@ F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 40c287d3f929ece67da6e9e7c49885789960accf F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 69bae8ce4aa52d2ff82d4a8a856bf283ec035b2e -F tool/mksqlite3c.tcl d79e450048b0bbf04d53677e01c249a012981182 +F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835 +F tool/mksqlite3c.tcl f29898d34f1dcd77ccc4e6fd7dcc2f9ebb54622f F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b522c95ddcd7046dca756f4d1a1e90c34dbcab64 -R 5ae06ee700ba79856dd8d83789b8e902 -U drh -Z c7acc62193fe6f94b78724b3b176c9a0 +P 110cd84f5e842c4dcd9b9398cea211e25f36b3aa +R 3027f3e188f09da4aed1352810f3e367 +U mistachkin +Z f095bb94f35a2c2f2b8c78d0815b5cb4 diff --git a/manifest.uuid b/manifest.uuid index 3c8bff2494..701aee323a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -110cd84f5e842c4dcd9b9398cea211e25f36b3aa \ No newline at end of file +3b34e95ca85a6dd7d0766e43035a6cec4bc724a1 \ No newline at end of file diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index 0e1d0fcd1a..601b8cce8c 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -180,6 +180,10 @@ proc copy_file {filename} { copy_file tsrc/$hdr section_comment "Continuing where we left off in $tail" if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} + } else { + # Comment out the entire line, replacing any nested comment + # begin/end markers with the harmless substring "**". + puts $out "/* [string map [list /* ** */ **] $line] */" } } elseif {![info exists seen_hdr($hdr)]} { if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} { diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 5b00368427..2cf77a6327 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -188,6 +188,10 @@ proc copy_file {filename} { copy_file tsrc/$hdr section_comment "Continuing where we left off in $tail" if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} + } else { + # Comment out the entire line, replacing any nested comment + # begin/end markers with the harmless substring "**". + puts $out "/* [string map [list /* ** */ **] $line] */" } } elseif {![info exists seen_hdr($hdr)]} { if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} { From 3e9dd938dd96f06ba9a86a15fd7d30b3b2d74e09 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 15 Jul 2015 23:15:59 +0000 Subject: [PATCH 09/20] Enable memory-mapped I/O on FreeBSD and DragonFly. FossilOrigin-Name: 2cdd647951ff5dca53576bb8be6dd6310a557571 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/sqliteInt.h | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d3cfa707d7..9a34fd136a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\sthe\sdebugging\sline\snumbers\sin\sthe\samalgamation\smore\saccurate. -D 2015-07-15T21:00:33.917 +C Enable\smemory-mapped\sI/O\son\sFreeBSD\sand\sDragonFly. +D 2015-07-15T23:15:59.722 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -332,7 +332,7 @@ F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7 F src/sqlite.h.in 3d951bf985839de7fcf4d3f69568bb4df2641abe F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066 -F src/sqliteInt.h 61e6e8e6f37a665452f677f2d82f9c2c4cecdbd2 +F src/sqliteInt.h c67d0a1368484dd156e7d13caa62862adc2ebefa F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 110cd84f5e842c4dcd9b9398cea211e25f36b3aa -R 3027f3e188f09da4aed1352810f3e367 -U mistachkin -Z f095bb94f35a2c2f2b8c78d0815b5cb4 +P 3b34e95ca85a6dd7d0766e43035a6cec4bc724a1 +R 16c8c817fa7a592f412bec571af44f5f +U drh +Z 22f6b41786e6e7d81e68671a3854bbda diff --git a/manifest.uuid b/manifest.uuid index 701aee323a..2960fe4c62 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3b34e95ca85a6dd7d0766e43035a6cec4bc724a1 \ No newline at end of file +2cdd647951ff5dca53576bb8be6dd6310a557571 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 862b2f68d2..c520e8abc3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -754,7 +754,9 @@ extern const int sqlite3one; # if defined(__linux__) \ || defined(_WIN32) \ || (defined(__APPLE__) && defined(__MACH__)) \ - || defined(__sun) + || defined(__sun) \ + || defined(__FreeBSD__) \ + || defined(__DragonFly__) # define SQLITE_MAX_MMAP_SIZE 0x7fff0000 /* 2147418112 */ # else # define SQLITE_MAX_MMAP_SIZE 0 From 89b31d73a627f9514e4469654d5b7f00b7e70e98 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 16 Jul 2015 17:29:27 +0000 Subject: [PATCH 10/20] Fix compilation issues with SQLITE_OMIT_COMPOUND_SELECT defined. FossilOrigin-Name: 9c39d4644530ccc532f4ff26464106c6da43269a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/select.c | 28 +++++++++++++--------------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 9a34fd136a..dbbb79b3e9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enable\smemory-mapped\sI/O\son\sFreeBSD\sand\sDragonFly. -D 2015-07-15T23:15:59.722 +C Fix\scompilation\sissues\swith\sSQLITE_OMIT_COMPOUND_SELECT\sdefined. +D 2015-07-16T17:29:27.953 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -327,7 +327,7 @@ F src/printf.c 2bc439ff20a4aad0e0ad50a37a67b5eae7d20edc F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 2d47554370de8de6dd5be060cef9559eec315005 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c d3c04f01549317afbe02455c4ca9465100e9c5fe +F src/select.c 57ef3d98c4400b93eea318813be41b2af2da2217 F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7 F src/sqlite.h.in 3d951bf985839de7fcf4d3f69568bb4df2641abe F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3b34e95ca85a6dd7d0766e43035a6cec4bc724a1 -R 16c8c817fa7a592f412bec571af44f5f -U drh -Z 22f6b41786e6e7d81e68671a3854bbda +P 2cdd647951ff5dca53576bb8be6dd6310a557571 +R 2352a36372e4c50dccbac9452cf765fb +U mistachkin +Z ddf00ea17d7e53d080e6ac931c2ced93 diff --git a/manifest.uuid b/manifest.uuid index 2960fe4c62..1edb0e4abf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2cdd647951ff5dca53576bb8be6dd6310a557571 \ No newline at end of file +9c39d4644530ccc532f4ff26464106c6da43269a \ No newline at end of file diff --git a/src/select.c b/src/select.c index 13de029420..8ac98f1759 100644 --- a/src/select.c +++ b/src/select.c @@ -1082,7 +1082,6 @@ static KeyInfo *keyInfoFromExprList( return pInfo; } -#ifndef SQLITE_OMIT_COMPOUND_SELECT /* ** Name of the connection operator, used for error messages. */ @@ -1096,7 +1095,6 @@ static const char *selectOpName(int id){ } return z; } -#endif /* SQLITE_OMIT_COMPOUND_SELECT */ #ifndef SQLITE_OMIT_EXPLAIN /* @@ -2099,19 +2097,6 @@ static int multiSelectOrderBy( SelectDest *pDest /* What to do with query results */ ); -/* -** Error message for when two or more terms of a compound select have different -** size result sets. -*/ -void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){ - if( p->selFlags & SF_Values ){ - sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); - }else{ - sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" - " do not have the same number of result columns", selectOpName(p->op)); - } -} - /* ** Handle the special case of a compound-select that originates from a ** VALUES clause. By handling this as a special case, we avoid deep @@ -2538,6 +2523,19 @@ multi_select_end: } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ +/* +** Error message for when two or more terms of a compound select have different +** size result sets. +*/ +void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){ + if( p->selFlags & SF_Values ){ + sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); + }else{ + sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" + " do not have the same number of result columns", selectOpName(p->op)); + } +} + /* ** Code an output subroutine for a coroutine implementation of a ** SELECT statment. From 957026ac784f88287d714cadf2566ed9bac1a1b2 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 16 Jul 2015 18:18:19 +0000 Subject: [PATCH 11/20] Defer the bulk pcache1 memory allocation until the first page allocation request. Limit the size of the pcache1 bulk allocation to the cache_size setting. Deallocate the bulk allocation on a sqlite3_db_release_memory() request, if the bulk allocation is completely unused. FossilOrigin-Name: b79a4affe44bd0c8e155cae19f3f62c715684cd6 --- manifest | 26 ++++++------- manifest.uuid | 2 +- src/pcache1.c | 91 +++++++++++++++++++++++++++----------------- src/pragma.c | 1 + src/pragma.h | 2 +- test/malloc5.test | 30 ++++++++------- test/pcache.test | 2 +- test/pcache2.test | 4 +- tool/mkpragmatab.tcl | 1 - 9 files changed, 91 insertions(+), 68 deletions(-) diff --git a/manifest b/manifest index dbbb79b3e9..0ea09a905b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scompilation\sissues\swith\sSQLITE_OMIT_COMPOUND_SELECT\sdefined. -D 2015-07-16T17:29:27.953 +C Defer\sthe\sbulk\spcache1\smemory\sallocation\suntil\sthe\sfirst\spage\sallocation\nrequest.\s\sLimit\sthe\ssize\sof\sthe\spcache1\sbulk\sallocation\sto\sthe\scache_size\nsetting.\s\sDeallocate\sthe\sbulk\sallocation\son\sa\ssqlite3_db_release_memory()\nrequest,\sif\sthe\sbulk\sallocation\sis\scompletely\sunused. +D 2015-07-16T18:18:19.580 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -319,9 +319,9 @@ F src/pager.h 6d435f563b3f7fcae4b84433b76a6ac2730036e2 F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8 F src/pcache.c cde06aa50962595e412d497e22fd2e07878ba1f0 F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9 -F src/pcache1.c 3f4c87cf913f2de8189026d9a5223ddaf55eaf6b -F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7 -F src/pragma.h b8632d7cdda7b25323fa580e3e558a4f0d4502cc +F src/pcache1.c 6c1e5957087b74e7e7cff871561849cf2fe09654 +F src/pragma.c e52084b37a08a88f258830518461e94627af2621 +F src/pragma.h 631a91c8b0e6ca8f051a1d8a4a0da4150e04620a F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1 F src/printf.c 2bc439ff20a4aad0e0ad50a37a67b5eae7d20edc F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 @@ -823,7 +823,7 @@ F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 F test/malloc.test 21c213365f2cca95ab2d7dc078dc8525f96065f8 F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a F test/malloc4.test 957337613002b7058a85116493a262f679f3a261 -F test/malloc5.test e9a9116f80ab6b7a9ca258876c6f3dedb08cb08b +F test/malloc5.test 21f6552bacb9efe649e6ba10a52f2cedaecce242 F test/malloc6.test 2f039d9821927eacae43e1831f815e157659a151 F test/malloc7.test 7c68a32942858bc715284856c5507446bba88c3a F test/malloc8.test 9b7a3f8cb9cf0b12fff566e80a980b1767bd961d @@ -900,8 +900,8 @@ F test/pagerfault2.test caf4c7facb914fd3b03a17b31ae2b180c8d6ca1f F test/pagerfault3.test 1003fcda009bf48a8e22a516e193b6ef0dd1bbd8 F test/pageropt.test 6b8f6a123a5572c195ad4ae40f2987007923bbd6 F test/pagesize.test 5769fc62d8c890a83a503f67d47508dfdc543305 -F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d -F test/pcache2.test ec3ae192f444ee6a0a80d1fd80d99695d884bfb3 +F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b +F test/pcache2.test c70d92547550136ba6f818e6a44fe246d2738604 F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff F test/permutations.test 6a88fd9ca15b804e9c20990773262ca67494058f F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2 @@ -1327,7 +1327,7 @@ F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e -F tool/mkpragmatab.tcl 40c287d3f929ece67da6e9e7c49885789960accf +F tool/mkpragmatab.tcl 84af2b180484323a2ea22a2279e8bd9e3e1e492e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 87240b09c20042999b41d5fabe091b7111287835 F tool/mksqlite3c.tcl f29898d34f1dcd77ccc4e6fd7dcc2f9ebb54622f @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2cdd647951ff5dca53576bb8be6dd6310a557571 -R 2352a36372e4c50dccbac9452cf765fb -U mistachkin -Z ddf00ea17d7e53d080e6ac931c2ced93 +P 9c39d4644530ccc532f4ff26464106c6da43269a +R 09036069f4d0dade4c9d3cbed758be18 +U drh +Z 38e6769945da8f33e2e2b46c42a73ce6 diff --git a/manifest.uuid b/manifest.uuid index 1edb0e4abf..f712181dec 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9c39d4644530ccc532f4ff26464106c6da43269a \ No newline at end of file +b79a4affe44bd0c8e155cae19f3f62c715684cd6 \ No newline at end of file diff --git a/src/pcache1.c b/src/pcache1.c index a345e6760f..8d74da5c90 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -191,6 +191,7 @@ static SQLITE_WSD struct PCacheGlobal { */ int isInit; /* True if initialized */ int separateCache; /* Use a new PGroup for each PCache */ + int nInitPage; /* Initial bulk allocation size */ int szSlot; /* Size of each free slot */ int nSlot; /* The number of pcache slots */ int nReserve; /* Try to keep nFreeSlot above this */ @@ -259,6 +260,43 @@ void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ } } +/* +** Try to initialize the pCache->pFree and pCache->pBulk fields. Return +** true if pCache->pFree ends up containing one or more free pages. +*/ +static int pcache1InitBulk(PCache1 *pCache){ + int szBulk; + char *zBulk; + if( pcache1.nInitPage==0 ) return 0; + /* Do not bother with a bulk allocation if the cache size very small */ + if( pCache->nMax<3 ) return 0; + sqlite3BeginBenignMalloc(); + if( pcache1.nInitPage>0 ){ + szBulk = pCache->szAlloc * pcache1.nInitPage; + }else{ + szBulk = -1024*pcache1.nInitPage; + } + if( szBulk > pCache->szAlloc*pCache->nMax ){ + szBulk = pCache->szAlloc*pCache->nMax; + } + zBulk = pCache->pBulk = sqlite3Malloc( szBulk ); + sqlite3EndBenignMalloc(); + if( zBulk ){ + int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc; + int i; + for(i=0; iszPage]; + pX->page.pBuf = zBulk; + pX->page.pExtra = &pX[1]; + pX->isBulkLocal = 1; + pX->pNext = pCache->pFree; + pCache->pFree = pX; + zBulk += pCache->szAlloc; + } + } + return pCache->pFree!=0; +} + /* ** Malloc function used within this file to allocate space from the buffer ** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no @@ -359,7 +397,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache){ void *pPg; assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); - if( pCache->pFree ){ + if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){ p = pCache->pFree; pCache->pFree = p->pNext; p->pNext = 0; @@ -563,7 +601,8 @@ static void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){ ** If there are currently more than nMaxPage pages allocated, try ** to recycle pages to reduce the number allocated to nMaxPage. */ -static void pcache1EnforceMaxPage(PGroup *pGroup){ +static void pcache1EnforceMaxPage(PCache1 *pCache){ + PGroup *pGroup = pCache->pGroup; assert( sqlite3_mutex_held(pGroup->mutex) ); while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){ PgHdr1 *p = pGroup->pLruTail; @@ -572,6 +611,10 @@ static void pcache1EnforceMaxPage(PGroup *pGroup){ pcache1PinPage(p); pcache1RemoveFromHash(p, 1); } + if( pCache->nPage==0 && pCache->pBulk ){ + sqlite3_free(pCache->pBulk); + pCache->pBulk = pCache->pFree = 0; + } } /* @@ -647,6 +690,14 @@ static int pcache1Init(void *NotUsed){ pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PMEM); } #endif + if( pcache1.separateCache + && sqlite3GlobalConfig.nPage!=0 + && sqlite3GlobalConfig.pPage==0 + ){ + pcache1.nInitPage = sqlite3GlobalConfig.nPage; + }else{ + pcache1.nInitPage = 0; + } pcache1.grp.mxPinned = 10; pcache1.isInit = 1; return SQLITE_OK; @@ -701,36 +752,6 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; } pcache1LeaveMutex(pGroup); - /* Try to initialize the local bulk pagecache line allocation if using - ** separate caches and if nPage!=0 */ - if( pcache1.separateCache - && sqlite3GlobalConfig.nPage!=0 - && sqlite3GlobalConfig.pPage==0 - ){ - int szBulk; - char *zBulk; - sqlite3BeginBenignMalloc(); - if( sqlite3GlobalConfig.nPage>0 ){ - szBulk = pCache->szAlloc * sqlite3GlobalConfig.nPage; - }else{ - szBulk = -1024*sqlite3GlobalConfig.nPage; - } - zBulk = pCache->pBulk = sqlite3Malloc( szBulk ); - sqlite3EndBenignMalloc(); - if( zBulk ){ - int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc; - int i; - for(i=0; ipage.pBuf = zBulk; - pX->page.pExtra = &pX[1]; - pX->isBulkLocal = 1; - pX->pNext = pCache->pFree; - pCache->pFree = pX; - zBulk += pCache->szAlloc; - } - } - } if( pCache->nHash==0 ){ pcache1Destroy((sqlite3_pcache*)pCache); pCache = 0; @@ -753,7 +774,7 @@ static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; pCache->nMax = nMax; pCache->n90pct = pCache->nMax*9/10; - pcache1EnforceMaxPage(pGroup); + pcache1EnforceMaxPage(pCache); pcache1LeaveMutex(pGroup); } } @@ -771,7 +792,7 @@ static void pcache1Shrink(sqlite3_pcache *p){ pcache1EnterMutex(pGroup); savedMaxPage = pGroup->nMaxPage; pGroup->nMaxPage = 0; - pcache1EnforceMaxPage(pGroup); + pcache1EnforceMaxPage(pCache); pGroup->nMaxPage = savedMaxPage; pcache1LeaveMutex(pGroup); } @@ -1108,7 +1129,7 @@ static void pcache1Destroy(sqlite3_pcache *p){ assert( pGroup->nMinPage >= pCache->nMin ); pGroup->nMinPage -= pCache->nMin; pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; - pcache1EnforceMaxPage(pGroup); + pcache1EnforceMaxPage(pCache); pcache1LeaveMutex(pGroup); sqlite3_free(pCache->pBulk); sqlite3_free(pCache->apHash); diff --git a/src/pragma.c b/src/pragma.c index 1b4213844d..ffa0685727 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -721,6 +721,7 @@ void sqlite3Pragma( case PragTyp_CACHE_SIZE: { assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); if( !zRight ){ + if( sqlite3ReadSchema(pParse) ) goto pragma_out; returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size); }else{ int size = sqlite3Atoi(zRight); diff --git a/src/pragma.h b/src/pragma.h index bbf141ee2d..9e206dac49 100644 --- a/src/pragma.h +++ b/src/pragma.h @@ -86,7 +86,7 @@ static const struct sPragmaNames { #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) { /* zName: */ "cache_size", /* ePragTyp: */ PragTyp_CACHE_SIZE, - /* ePragFlag: */ PragFlag_NeedSchema, + /* ePragFlag: */ 0, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) diff --git a/test/malloc5.test b/test/malloc5.test index 2b8ba74e5b..c9ee5dbc7d 100644 --- a/test/malloc5.test +++ b/test/malloc5.test @@ -41,6 +41,7 @@ ifcapable !memorymanage { sqlite3_soft_heap_limit 0 sqlite3 db test.db +db eval {PRAGMA cache_size=1} do_test malloc5-1.1 { # Simplest possible test. Call sqlite3_release_memory when there is exactly @@ -61,15 +62,14 @@ do_test malloc5-1.2 { # not the case before version 3.6.2). # sqlite3 db2 test.db - execsql { SELECT * FROM sqlite_master } db2 + execsql {PRAGMA cache_size=2; SELECT * FROM sqlite_master } db2 } {} do_test malloc5-1.3 { # Call [sqlite3_release_memory] when there is exactly one unused page # in the cache belonging to db2. # set ::pgalloc [sqlite3_release_memory] - expr $::pgalloc > 0 -} {1} +} {0} # The sizes of memory allocations from system malloc() might vary, # depending on the memory allocator algorithms used. The following @@ -231,6 +231,7 @@ do_test malloc5-4.1 { expr $nMaxBytes > 1000000 } {1} do_test malloc5-4.2 { + db eval {PRAGMA cache_size=1} db cache flush sqlite3_release_memory sqlite3_soft_heap_limit 100000 @@ -302,7 +303,7 @@ do_test malloc5-6.1.1 { sqlite3 db test.db execsql { PRAGMA page_size=1024; - PRAGMA default_cache_size=10; + PRAGMA default_cache_size=2; } execsql { PRAGMA temp_store = memory; @@ -325,24 +326,25 @@ do_test malloc5-6.1.1 { } forcecopy test.db test2.db sqlite3 db2 test2.db + db2 eval {PRAGMA cache_size=2} list \ [expr ([file size test.db]/1024)>20] [expr ([file size test2.db]/1024)>20] } {1 1} do_test malloc5-6.1.2 { list [execsql {PRAGMA cache_size}] [execsql {PRAGMA cache_size} db2] -} {10 10} +} {2 2} do_test malloc5-6.2.1 { execsql {SELECT * FROM abc} db2 execsql {SELECT * FROM abc} db expr [nPage db] + [nPage db2] -} {20} +} {4} do_test malloc5-6.2.2 { # If we now try to reclaim some memory, it should come from the db2 cache. sqlite3_release_memory 3000 expr [nPage db] + [nPage db2] -} {17} +} {4} do_test malloc5-6.2.3 { # Access the db2 cache again, so that all the db2 pages have been used # more recently than all the db pages. Then try to reclaim 3000 bytes. @@ -350,7 +352,7 @@ do_test malloc5-6.2.3 { execsql { SELECT * FROM abc } db2 sqlite3_release_memory 3000 expr [nPage db] + [nPage db2] -} {17} +} {4} do_test malloc5-6.3.1 { # Now open a transaction and update 2 pages in the db2 cache. Then @@ -367,19 +369,19 @@ do_test malloc5-6.3.1 { } db2 execsql { SELECT * FROM abc } db expr [nPage db] + [nPage db2] -} {20} +} {4} do_test malloc5-6.3.2 { # Try to release 7700 bytes. This should release all the # non-dirty pages held by db2. sqlite3_release_memory [expr 7*1132] list [nPage db] [nPage db2] -} {10 3} +} {1 3} do_test malloc5-6.3.3 { # Try to release another 1000 bytes. This should come fromt the db # cache, since all three pages held by db2 are either in-use or diry. sqlite3_release_memory 1000 list [nPage db] [nPage db2] -} {9 3} +} {1 3} do_test malloc5-6.3.4 { # Now release 9900 more (about 9 pages worth). This should expunge # the rest of the db cache. But the db2 cache remains intact, because @@ -390,20 +392,20 @@ do_test malloc5-6.3.4 { sqlite3_release_memory 9900 } list [nPage db] [nPage db2] -} {0 3} +} {1 3} do_test malloc5-6.3.5 { # But if we are really insistent, SQLite will consent to call sync() # if there is no other option. UPDATE: As of 3.6.2, SQLite will not # call sync() in this scenario. So no further memory can be reclaimed. sqlite3_release_memory 1000 list [nPage db] [nPage db2] -} {0 3} +} {1 3} do_test malloc5-6.3.6 { # The referenced page (page 1 of the db2 cache) will not be freed no # matter how much memory we ask for: sqlite3_release_memory 31459 list [nPage db] [nPage db2] -} {0 3} +} {1 3} db2 close diff --git a/test/pcache.test b/test/pcache.test index 0766fce088..5d9d93edb7 100644 --- a/test/pcache.test +++ b/test/pcache.test @@ -73,7 +73,7 @@ do_test pcache-1.4 { do_test pcache-1.5 { sqlite3 db2 test.db - execsql "PRAGMA cache_size=10" db2 + execsql "PRAGMA cache_size; PRAGMA cache_size=10" db2 pcache_stats } {current 11 max 22 min 20 recyclable 1} diff --git a/test/pcache2.test b/test/pcache2.test index 1c15b8b56a..c59dfb25d4 100644 --- a/test/pcache2.test +++ b/test/pcache2.test @@ -36,13 +36,13 @@ do_test pcache2-1.1 { do_test pcache2-1.2 { forcedelete test.db test.db-journal sqlite3 db test.db - db eval {PRAGMA cache_size=10} + db eval {PRAGMA cache_size=10; SELECT 1 FROM sqlite_master;} lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 } {2} do_test pcache2-1.3 { forcedelete test2.db test2.db-journal sqlite3 db2 test2.db - db2 eval {PRAGMA cache_size=50} + db2 eval {PRAGMA cache_size=50; SELECT 1 FROM sqlite_master;} lindex [sqlite3_status SQLITE_STATUS_PAGECACHE_USED 0] 1 } {4} diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index cb3aed0fff..bbdf9da754 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -170,7 +170,6 @@ set pragma_def { IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) NAME: cache_size - FLAG: NeedSchema IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) NAME: mmap_size From 939d4bcd771413378c49547608bc13526bf59990 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 16 Jul 2015 18:37:53 +0000 Subject: [PATCH 12/20] Fix harmless compiler warnings. FossilOrigin-Name: 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pcache1.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 0ea09a905b..f408f5f761 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Defer\sthe\sbulk\spcache1\smemory\sallocation\suntil\sthe\sfirst\spage\sallocation\nrequest.\s\sLimit\sthe\ssize\sof\sthe\spcache1\sbulk\sallocation\sto\sthe\scache_size\nsetting.\s\sDeallocate\sthe\sbulk\sallocation\son\sa\ssqlite3_db_release_memory()\nrequest,\sif\sthe\sbulk\sallocation\sis\scompletely\sunused. -D 2015-07-16T18:18:19.580 +C Fix\sharmless\scompiler\swarnings. +D 2015-07-16T18:37:53.565 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -319,7 +319,7 @@ F src/pager.h 6d435f563b3f7fcae4b84433b76a6ac2730036e2 F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8 F src/pcache.c cde06aa50962595e412d497e22fd2e07878ba1f0 F src/pcache.h 9968603796240cdf83da7e7bef76edf90619cea9 -F src/pcache1.c 6c1e5957087b74e7e7cff871561849cf2fe09654 +F src/pcache1.c d08939800abf3031bd0affd5a13fbc4d7ba3fb68 F src/pragma.c e52084b37a08a88f258830518461e94627af2621 F src/pragma.h 631a91c8b0e6ca8f051a1d8a4a0da4150e04620a F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9c39d4644530ccc532f4ff26464106c6da43269a -R 09036069f4d0dade4c9d3cbed758be18 +P b79a4affe44bd0c8e155cae19f3f62c715684cd6 +R 46ffb58e9bbf5b7d344569559372c137 U drh -Z 38e6769945da8f33e2e2b46c42a73ce6 +Z fc33a5797b3dc2992ffe746880c5611b diff --git a/manifest.uuid b/manifest.uuid index f712181dec..9dd0845ea4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b79a4affe44bd0c8e155cae19f3f62c715684cd6 \ No newline at end of file +9a592cf91c74b369bacf6a0e69d45f3e73dfdbce \ No newline at end of file diff --git a/src/pcache1.c b/src/pcache1.c index 8d74da5c90..187f09f592 100644 --- a/src/pcache1.c +++ b/src/pcache1.c @@ -265,18 +265,18 @@ void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ ** true if pCache->pFree ends up containing one or more free pages. */ static int pcache1InitBulk(PCache1 *pCache){ - int szBulk; + i64 szBulk; char *zBulk; if( pcache1.nInitPage==0 ) return 0; /* Do not bother with a bulk allocation if the cache size very small */ if( pCache->nMax<3 ) return 0; sqlite3BeginBenignMalloc(); if( pcache1.nInitPage>0 ){ - szBulk = pCache->szAlloc * pcache1.nInitPage; + szBulk = pCache->szAlloc * (i64)pcache1.nInitPage; }else{ - szBulk = -1024*pcache1.nInitPage; + szBulk = -1024 * (i64)pcache1.nInitPage; } - if( szBulk > pCache->szAlloc*pCache->nMax ){ + if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){ szBulk = pCache->szAlloc*pCache->nMax; } zBulk = pCache->pBulk = sqlite3Malloc( szBulk ); From 8694d6049f73de1db9265dab0702d0ec9a00b594 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 16 Jul 2015 20:17:57 +0000 Subject: [PATCH 13/20] Fix compiler warnings in fts5 code. FossilOrigin-Name: e9bf275cd969eca6fb41384d3637528d6a19f819 --- ext/fts5/fts5_expr.c | 4 ++-- ext/fts5/fts5_hash.c | 19 +++++++++++++------ ext/fts5/fts5_index.c | 11 +++++------ ext/fts5/fts5_main.c | 4 ++-- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- 6 files changed, 33 insertions(+), 27 deletions(-) diff --git a/ext/fts5/fts5_expr.c b/ext/fts5/fts5_expr.c index a02a66f15c..97ff3c72a0 100644 --- a/ext/fts5/fts5_expr.c +++ b/ext/fts5/fts5_expr.c @@ -83,7 +83,7 @@ struct Fts5ExprPhrase { Fts5ExprNode *pNode; /* FTS5_STRING node this phrase is part of */ Fts5Buffer poslist; /* Current position list */ int nTerm; /* Number of entries in aTerm[] */ - Fts5ExprTerm aTerm[0]; /* Terms that make up this phrase */ + Fts5ExprTerm aTerm[1]; /* Terms that make up this phrase */ }; /* @@ -104,7 +104,7 @@ struct Fts5ExprNearset { int nNear; /* NEAR parameter */ Fts5ExprColset *pColset; /* Columns to search (NULL -> all columns) */ int nPhrase; /* Number of entries in aPhrase[] array */ - Fts5ExprPhrase *apPhrase[0]; /* Array of phrase pointers */ + Fts5ExprPhrase *apPhrase[1]; /* Array of phrase pointers */ }; diff --git a/ext/fts5/fts5_hash.c b/ext/fts5/fts5_hash.c index 0f878cf783..ff440fa61c 100644 --- a/ext/fts5/fts5_hash.c +++ b/ext/fts5/fts5_hash.c @@ -66,9 +66,16 @@ struct Fts5HashEntry { int iCol; /* Column of last value written */ int iPos; /* Position of last value written */ i64 iRowid; /* Rowid of last value written */ - char zKey[0]; /* Nul-terminated entry key */ + char zKey[8]; /* Nul-terminated entry key */ }; +/* +** Size of Fts5HashEntry without the zKey[] array. +*/ +#define FTS5_HASHENTRYSIZE (sizeof(Fts5HashEntry)-8) + + + /* ** Allocate a new hash table. */ @@ -220,7 +227,7 @@ int sqlite3Fts5HashWrite( /* If an existing hash entry cannot be found, create a new one. */ if( p==0 ){ - int nByte = sizeof(Fts5HashEntry) + (nToken+1) + 1 + 64; + int nByte = FTS5_HASHENTRYSIZE + (nToken+1) + 1 + 64; if( nByte<128 ) nByte = 128; if( (pHash->nEntry*2)>=pHash->nSlot ){ @@ -231,13 +238,13 @@ int sqlite3Fts5HashWrite( p = (Fts5HashEntry*)sqlite3_malloc(nByte); if( !p ) return SQLITE_NOMEM; - memset(p, 0, sizeof(Fts5HashEntry)); + memset(p, 0, FTS5_HASHENTRYSIZE); p->nAlloc = nByte; p->zKey[0] = bByte; memcpy(&p->zKey[1], pToken, nToken); assert( iHash==fts5HashKey(pHash->nSlot, p->zKey, nToken+1) ); p->zKey[nToken+1] = '\0'; - p->nData = nToken+1 + 1 + sizeof(Fts5HashEntry); + p->nData = nToken+1 + 1 + FTS5_HASHENTRYSIZE; p->nData += sqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid); p->iSzPoslist = p->nData; p->nData += 1; @@ -417,7 +424,7 @@ int sqlite3Fts5HashQuery( if( p ){ fts5HashAddPoslistSize(p); *ppDoclist = (const u8*)&p->zKey[nTerm+1]; - *pnDoclist = p->nData - (sizeof(*p) + nTerm + 1); + *pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1); }else{ *ppDoclist = 0; *pnDoclist = 0; @@ -454,7 +461,7 @@ void sqlite3Fts5HashScanEntry( fts5HashAddPoslistSize(p); *pzTerm = p->zKey; *ppDoclist = (const u8*)&p->zKey[nTerm+1]; - *pnDoclist = p->nData - (sizeof(*p) + nTerm + 1); + *pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1); }else{ *pzTerm = 0; *ppDoclist = 0; diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c index dc664aab71..4229573391 100644 --- a/ext/fts5/fts5_index.c +++ b/ext/fts5/fts5_index.c @@ -368,7 +368,7 @@ struct Fts5Structure { u64 nWriteCounter; /* Total leaves written to level 0 */ int nSegment; /* Total segments in this structure */ int nLevel; /* Number of levels in this index */ - Fts5StructureLevel aLevel[0]; /* Array of nLevel level objects */ + Fts5StructureLevel aLevel[1]; /* Array of nLevel level objects */ }; /* @@ -929,7 +929,7 @@ static int fts5StructureDecode( i += fts5GetVarint32(&pData[i], nSegment); nByte = ( sizeof(Fts5Structure) + /* Main structure */ - sizeof(Fts5StructureLevel) * (nLevel) /* aLevel[] array */ + sizeof(Fts5StructureLevel) * (nLevel-1) /* aLevel[] array */ ); pRet = (Fts5Structure*)sqlite3Fts5MallocZero(&rc, nByte); @@ -3070,7 +3070,7 @@ static void fts5ChunkIterate( ** returned in this case. */ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){ - u32 iSegid = 0; + int iSegid = 0; if( p->rc==SQLITE_OK ){ if( pStruct->nSegment>=FTS5_MAX_SEGMENT ){ @@ -3079,8 +3079,7 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){ while( iSegid==0 ){ int iLvl, iSeg; sqlite3_randomness(sizeof(u32), (void*)&iSegid); - iSegid = (iSegid % ((1 << FTS5_DATA_ID_B) - 2)) + 1; - assert( iSegid>0 && iSegid<=65535 ); + iSegid = iSegid & ((1 << FTS5_DATA_ID_B)-1); for(iLvl=0; iLvlnLevel; iLvl++){ for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){ if( iSegid==pStruct->aLevel[iLvl].aSeg[iSeg].iSegid ){ @@ -3092,7 +3091,7 @@ static int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){ } } - return (int)iSegid; + return iSegid; } /* diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c index 87902935b4..7afe0653e1 100644 --- a/ext/fts5/fts5_main.c +++ b/ext/fts5/fts5_main.c @@ -145,7 +145,7 @@ struct Fts5Sorter { i64 iRowid; /* Current rowid */ const u8 *aPoslist; /* Position lists for current row */ int nIdx; /* Number of entries in aIdx[] */ - int aIdx[0]; /* Offsets into aPoslist for current row */ + int aIdx[1]; /* Offsets into aPoslist for current row */ }; @@ -808,7 +808,7 @@ static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){ const char *zRankArgs = pCsr->zRankArgs; nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); - nByte = sizeof(Fts5Sorter) + sizeof(int) * nPhrase; + nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1); pSorter = (Fts5Sorter*)sqlite3_malloc(nByte); if( pSorter==0 ) return SQLITE_NOMEM; memset(pSorter, 0, nByte); diff --git a/manifest b/manifest index f408f5f761..6a62491cb7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings. -D 2015-07-16T18:37:53.565 +C Fix\scompiler\swarnings\sin\sfts5\scode. +D 2015-07-16T20:17:57.553 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -110,10 +110,10 @@ F ext/fts5/fts5Int.h 8d9bce1847a10df2e4ed9492ea4f3868276748fb F ext/fts5/fts5_aux.c 044cb176a815f4388308738437f6e130aa384fb0 F ext/fts5/fts5_buffer.c 80f9ba4431848cb857e3d2158f5280093dcd8015 F ext/fts5/fts5_config.c b2456e9625bca41c51d54c363e369c6356895c90 -F ext/fts5/fts5_expr.c d2e148345639c5a5583e0daa39a639bf298ae6a7 -F ext/fts5/fts5_hash.c 219f4edd72e5cf95b19c33f1058809a18fad5229 -F ext/fts5/fts5_index.c cfd41d49591e4e4ce2a5f84de35512f59fbb360d -F ext/fts5/fts5_main.c 8f279999deb204b0c7760464f60f88666046398b +F ext/fts5/fts5_expr.c ac0614f843cf5c80a85c4c6aa44bbede62a51bb2 +F ext/fts5/fts5_hash.c ff07722c73587c12781213133edbdb22cd156378 +F ext/fts5/fts5_index.c d6ad9293280f39c56343ef5035b0475ff2a6be12 +F ext/fts5/fts5_main.c 0de7ba81488d2c502c8e794eaf7983d468e4c6e9 F ext/fts5/fts5_storage.c 1c35a38a564ee9cadcbd7ae0b13a806bdda722bd F ext/fts5/fts5_tcl.c 85eb4e0d0fefa9420b78151496ad4599a1783e20 F ext/fts5/fts5_tokenize.c 30f97a8c74683797b4cd233790444fbefb3b0708 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b79a4affe44bd0c8e155cae19f3f62c715684cd6 -R 46ffb58e9bbf5b7d344569559372c137 -U drh -Z fc33a5797b3dc2992ffe746880c5611b +P 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce +R 7a5b6f6204af419d579789c3ece1729c +U dan +Z a4633be21e523e4e841d0095eaa70845 diff --git a/manifest.uuid b/manifest.uuid index 9dd0845ea4..dbc4f5f578 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a592cf91c74b369bacf6a0e69d45f3e73dfdbce \ No newline at end of file +e9bf275cd969eca6fb41384d3637528d6a19f819 \ No newline at end of file From f6bff3f5d6c2f49bdee0b4a15f7677856b513c28 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 17 Jul 2015 01:16:10 +0000 Subject: [PATCH 14/20] Avoid a harmless compiler warning. FossilOrigin-Name: 2288842b8f191ff05a157db7f77af867bfa83c4f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/wal.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 6a62491cb7..6cd163f25a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scompiler\swarnings\sin\sfts5\scode. -D 2015-07-16T20:17:57.553 +C Avoid\sa\sharmless\scompiler\swarning. +D 2015-07-17T01:16:10.825 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -401,7 +401,7 @@ F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0 F src/vtab.c 082b35a25a26e3d36f365ca8cd73c1922532f05e F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb -F src/wal.c 6c9354c72452ab5699a44381ae03004ee2893824 +F src/wal.c 590e85f3b24e8ed2f3263abd1f69f219a1f15ad2 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 F src/where.c 909eba3b6db984eb2adfbca9de2c237ee7056adb @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce -R 7a5b6f6204af419d579789c3ece1729c -U dan -Z a4633be21e523e4e841d0095eaa70845 +P e9bf275cd969eca6fb41384d3637528d6a19f819 +R 12f173b5d59b5ca59e2ddd738e75f068 +U drh +Z b458ca27129248b1d38d912e023bd41c diff --git a/manifest.uuid b/manifest.uuid index dbc4f5f578..76645404d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e9bf275cd969eca6fb41384d3637528d6a19f819 \ No newline at end of file +2288842b8f191ff05a157db7f77af867bfa83c4f \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 69f335d792..7f252baf02 100644 --- a/src/wal.c +++ b/src/wal.c @@ -648,9 +648,9 @@ static void walIndexWriteHdr(Wal *pWal){ pWal->hdr.isInit = 1; pWal->hdr.iVersion = WALINDEX_MAX_VERSION; walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum); - memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr)); + memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr)); walShmBarrier(pWal); - memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr)); + memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr)); } /* From 63abdc59dd3476adbe917b6ddb50dbd9ae9ed51e Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 17 Jul 2015 12:42:53 +0000 Subject: [PATCH 15/20] More adjustments to the malloc5.test module so that it works correctly with the new pcache1 bulk allocation. FossilOrigin-Name: 2a7b3a440f74019f154496b2f95aa852a46e04fc --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/malloc5.test | 5 +++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 6cd163f25a..7815d1bf1c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sa\sharmless\scompiler\swarning. -D 2015-07-17T01:16:10.825 +C More\sadjustments\sto\sthe\smalloc5.test\smodule\sso\sthat\sit\sworks\scorrectly\swith\nthe\snew\spcache1\sbulk\sallocation. +D 2015-07-17T12:42:53.567 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -823,7 +823,7 @@ F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9 F test/malloc.test 21c213365f2cca95ab2d7dc078dc8525f96065f8 F test/malloc3.test e3b32c724b5a124b57cb0ed177f675249ad0c66a F test/malloc4.test 957337613002b7058a85116493a262f679f3a261 -F test/malloc5.test 21f6552bacb9efe649e6ba10a52f2cedaecce242 +F test/malloc5.test 4e87e596a28908c034eb5777fc33dd921bb44fc3 F test/malloc6.test 2f039d9821927eacae43e1831f815e157659a151 F test/malloc7.test 7c68a32942858bc715284856c5507446bba88c3a F test/malloc8.test 9b7a3f8cb9cf0b12fff566e80a980b1767bd961d @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e9bf275cd969eca6fb41384d3637528d6a19f819 -R 12f173b5d59b5ca59e2ddd738e75f068 +P 2288842b8f191ff05a157db7f77af867bfa83c4f +R b4855de59061718601ad3bfe72c98bbc U drh -Z b458ca27129248b1d38d912e023bd41c +Z 238f0465cd3dec3d05c76c19fe6e7116 diff --git a/manifest.uuid b/manifest.uuid index 76645404d7..f8163d578f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2288842b8f191ff05a157db7f77af867bfa83c4f \ No newline at end of file +2a7b3a440f74019f154496b2f95aa852a46e04fc \ No newline at end of file diff --git a/test/malloc5.test b/test/malloc5.test index c9ee5dbc7d..3f5208accd 100644 --- a/test/malloc5.test +++ b/test/malloc5.test @@ -20,6 +20,11 @@ # # $Id: malloc5.test,v 1.22 2009/04/11 19:09:54 drh Exp $ +sqlite3_shutdown +sqlite3_config_pagecache 0 100 +sqlite3_initialize +autoinstall_test_functions + set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl From 9edb5ceb1f6b782fcdcbe0c09444e34f98fda591 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sun, 19 Jul 2015 19:53:23 +0000 Subject: [PATCH 16/20] Cleanup the 'config.h' file in the appropriate distclean targets. FossilOrigin-Name: e0a9978077a1b4e5988681438e4efff93920e574 --- Makefile.in | 2 +- autoconf/tea/Makefile.in | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2c91b8252d..dcf5a0bf80 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1192,7 +1192,7 @@ clean: rm -f fts5.* fts5parse.* distclean: clean - rm -f config.log config.status libtool Makefile sqlite3.pc + rm -f config.h config.log config.status libtool Makefile sqlite3.pc # # Windows section diff --git a/autoconf/tea/Makefile.in b/autoconf/tea/Makefile.in index a8708974b0..3e481dadfe 100644 --- a/autoconf/tea/Makefile.in +++ b/autoconf/tea/Makefile.in @@ -348,7 +348,7 @@ clean: distclean: clean -rm -f *.tab.c -rm -f $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log config.status + -rm -f config.h config.cache config.log config.status #======================================================================== # Install binary object libraries. On Windows this includes both .dll and diff --git a/manifest b/manifest index 7815d1bf1c..3772070e8b 100644 --- a/manifest +++ b/manifest @@ -1,7 +1,7 @@ -C More\sadjustments\sto\sthe\smalloc5.test\smodule\sso\sthat\sit\sworks\scorrectly\swith\nthe\snew\spcache1\sbulk\sallocation. -D 2015-07-17T12:42:53.567 +C Cleanup\sthe\s'config.h'\sfile\sin\sthe\sappropriate\sdistclean\stargets. +D 2015-07-19T19:53:23.061 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 6e8af213d49e6325bf283ebed7662254f8e15bda +F Makefile.in 6b439e21d6dabede337772b85959340d37bb17bb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc efafcbf2be203b61dc7b6301703544753c513cb2 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 @@ -23,7 +23,7 @@ F autoconf/depcomp 0b26f101e3bc9fd1ff0be1da9fb4a82371142f92 x F autoconf/install-sh 06ee6336e63bb845c8439d777c32eb2eccc4fbf1 x F autoconf/ltmain.sh 7a658a24028f02331c1d2446562758083c5eadd1 F autoconf/missing d7c9981a81af13370d4ed152b24c0a82b7028585 x -F autoconf/tea/Makefile.in d55bcc63832caf0309c2ff80358756116618cfca +F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 F autoconf/tea/configure.ac 93d43c79e936fb16556e22498177d7e8571efa04 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2288842b8f191ff05a157db7f77af867bfa83c4f -R b4855de59061718601ad3bfe72c98bbc -U drh -Z 238f0465cd3dec3d05c76c19fe6e7116 +P 2a7b3a440f74019f154496b2f95aa852a46e04fc +R 9ac1abb764f2df34d280651c8f2240d5 +U mistachkin +Z d4dbff2c0caaf5449789190171f9545d diff --git a/manifest.uuid b/manifest.uuid index f8163d578f..da24f20144 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2a7b3a440f74019f154496b2f95aa852a46e04fc \ No newline at end of file +e0a9978077a1b4e5988681438e4efff93920e574 \ No newline at end of file From 6b67a8ae035b1e349d82055971180b9f2d3b1fde Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 21 Jul 2015 19:22:35 +0000 Subject: [PATCH 17/20] Fix harmless compiler warning in MSVC 2015. FossilOrigin-Name: 01c8b9ccfa0f336dfead7c004de3de571753f707 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/wal.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 3772070e8b..5ef27fc936 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cleanup\sthe\s'config.h'\sfile\sin\sthe\sappropriate\sdistclean\stargets. -D 2015-07-19T19:53:23.061 +C Fix\sharmless\scompiler\swarning\sin\sMSVC\s2015. +D 2015-07-21T19:22:35.266 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6b439e21d6dabede337772b85959340d37bb17bb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -401,7 +401,7 @@ F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0 F src/vtab.c 082b35a25a26e3d36f365ca8cd73c1922532f05e F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb -F src/wal.c 590e85f3b24e8ed2f3263abd1f69f219a1f15ad2 +F src/wal.c 6fb6b68969e4692593c2552c4e7bff5882de2cb8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 F src/where.c 909eba3b6db984eb2adfbca9de2c237ee7056adb @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2a7b3a440f74019f154496b2f95aa852a46e04fc -R 9ac1abb764f2df34d280651c8f2240d5 +P e0a9978077a1b4e5988681438e4efff93920e574 +R cbf3f19f824b2b3f6f21c8e30bb2d4e0 U mistachkin -Z d4dbff2c0caaf5449789190171f9545d +Z 106701e31e609f92431b2c0ad60fc867 diff --git a/manifest.uuid b/manifest.uuid index da24f20144..cc221e9da1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0a9978077a1b4e5988681438e4efff93920e574 \ No newline at end of file +01c8b9ccfa0f336dfead7c004de3de571753f707 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index 7f252baf02..f7e2594001 100644 --- a/src/wal.c +++ b/src/wal.c @@ -952,13 +952,13 @@ static void walCleanupHash(Wal *pWal){ ** via the hash table even after the cleanup. */ if( iLimit ){ - int i; /* Loop counter */ + int j; /* Loop counter */ int iKey; /* Hash key */ - for(i=1; i<=iLimit; i++){ - for(iKey=walHash(aPgno[i]); aHash[iKey]; iKey=walNextHash(iKey)){ - if( aHash[iKey]==i ) break; + for(j=1; j<=iLimit; j++){ + for(iKey=walHash(aPgno[j]); aHash[iKey]; iKey=walNextHash(iKey)){ + if( aHash[iKey]==j ) break; } - assert( aHash[iKey]==i ); + assert( aHash[iKey]==j ); } } #endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */ From d3e3f0b46e52789ef8310a94894c450ba94d84a3 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jul 2015 16:39:33 +0000 Subject: [PATCH 18/20] The sqlite3ExprCodeGetColumn() is not guaranteed to put the result in the register requested. Fix the skip-scan code generator for WITHOUT ROWID tables so that it always checks the register and copies the result if it lands in the wrong register. Fix for ticket [8fd39115d8f46ece70e7d4b3]. FossilOrigin-Name: 793e206f9032d9205bdb3f447b136bed9a25fa22 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/wherecode.c | 6 +++++- test/skipscan1.test | 30 ++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 5ef27fc936..d107ab01d1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\sin\sMSVC\s2015. -D 2015-07-21T19:22:35.266 +C The\ssqlite3ExprCodeGetColumn()\sis\snot\sguaranteed\sto\sput\sthe\sresult\sin\sthe\nregister\srequested.\s\s\sFix\sthe\sskip-scan\scode\sgenerator\sfor\sWITHOUT\sROWID\ntables\sso\sthat\sit\salways\schecks\sthe\sregister\sand\scopies\sthe\sresult\sif\sit\nlands\sin\sthe\swrong\sregister.\s\sFix\sfor\sticket\s[8fd39115d8f46ece70e7d4b3]. +D 2015-07-23T16:39:33.653 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6b439e21d6dabede337772b85959340d37bb17bb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -406,7 +406,7 @@ F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804 F src/where.c 909eba3b6db984eb2adfbca9de2c237ee7056adb F src/whereInt.h 5f87e3c4b0551747d119730dfebddd3c54f04047 -F src/wherecode.c 0669481cabaf5caf934b6bb825df15bc57f60d40 +F src/wherecode.c 5da5049224f12db314931ae7e0919b4914a2a0b1 F src/whereexpr.c 9ce1c9cfedbf80c93c7d899497025ec8256ce652 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd @@ -985,7 +985,7 @@ F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5 F test/shrink.test 06deac10d591186017466ce67d10645150bfdeec F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329 -F test/skipscan1.test 2ddfe5d168462170c4487f534e2a99fb006b2076 +F test/skipscan1.test d37a75b4be4eb9dedeb69b4f38b1d0a74b5021d7 F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5 F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e0a9978077a1b4e5988681438e4efff93920e574 -R cbf3f19f824b2b3f6f21c8e30bb2d4e0 -U mistachkin -Z 106701e31e609f92431b2c0ad60fc867 +P 01c8b9ccfa0f336dfead7c004de3de571753f707 +R 23f175ee7b2eb2636faea6e0fbfacef1 +U drh +Z 1c321a77d86fb7457929725064e82b93 diff --git a/manifest.uuid b/manifest.uuid index cc221e9da1..f5c0256de7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -01c8b9ccfa0f336dfead7c004de3de571753f707 \ No newline at end of file +793e206f9032d9205bdb3f447b136bed9a25fa22 \ No newline at end of file diff --git a/src/wherecode.c b/src/wherecode.c index e1f0f86615..9747f7f375 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -1296,7 +1296,11 @@ Bitmask sqlite3WhereCodeOneLoopStart( r = sqlite3GetTempRange(pParse, nPk); for(iPk=0; iPkaiColumn[iPk]; - sqlite3ExprCodeGetColumn(pParse, pTab, iCol, iCur, r+iPk, 0); + int rx; + rx = sqlite3ExprCodeGetColumn(pParse, pTab, iCol, iCur,r+iPk,0); + if( rx!=r+iPk ){ + sqlite3VdbeAddOp2(v, OP_SCopy, rx, r+iPk); + } } /* Check if the temp table already contains this key. If so, diff --git a/test/skipscan1.test b/test/skipscan1.test index 4f996df972..ac26711603 100644 --- a/test/skipscan1.test +++ b/test/skipscan1.test @@ -292,4 +292,34 @@ do_execsql_test skipscan1-7.3 { EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE b=1; } {~/ANY/} +# Ticket 8fd39115d8f46ece70e7d4b3c481d1bd86194746 2015-07-23 +# Incorrect code generated for a skipscan within an OR optimization +# on a WITHOUT ROWID table. +# +do_execsql_test skipscan1-8.1 { + DROP TABLE IF EXISTS t1; + CREATE TABLE t1(x, y, PRIMARY KEY(x,y)) WITHOUT ROWID; + INSERT INTO t1(x,y) VALUES(1,'AB'); + INSERT INTO t1(x,y) VALUES(2,'CD'); + ANALYZE; + DROP TABLE IF EXISTS sqlite_stat4; + DELETE FROM sqlite_stat1; + INSERT INTO sqlite_stat1(tbl,idx,stat) VALUES('t1','t1','1000000 100 1'); + ANALYZE sqlite_master; + SELECT * FROM t1 + WHERE (y = 'AB' AND x <= 4) + OR (y = 'EF' AND x = 5); +} {1 AB} +do_execsql_test skipscan1-8.1eqp { + EXPLAIN QUERY PLAN + SELECT * FROM t1 + WHERE (y = 'AB' AND x <= 4) + OR (y = 'EF' AND x = 5); +} {/ANY/} +do_execsql_test skipscan1-8.2 { + SELECT * FROM t1 + WHERE y = 'AB' OR (y = 'CD' AND x = 2) + ORDER BY +x; +} {1 AB 2 CD} + finish_test From 7877d9afca7cf5627801d1b0b69790a7158d5699 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jul 2015 17:16:27 +0000 Subject: [PATCH 19/20] When SQLITE_OMIT_LOOKASIDE is set, do not allocate any lookaside memory since it will never be used. FossilOrigin-Name: 0ffd499f2374f2b191080b9952acfed56daf3335 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/main.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index d107ab01d1..0d1fddcfea 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\ssqlite3ExprCodeGetColumn()\sis\snot\sguaranteed\sto\sput\sthe\sresult\sin\sthe\nregister\srequested.\s\s\sFix\sthe\sskip-scan\scode\sgenerator\sfor\sWITHOUT\sROWID\ntables\sso\sthat\sit\salways\schecks\sthe\sregister\sand\scopies\sthe\sresult\sif\sit\nlands\sin\sthe\swrong\sregister.\s\sFix\sfor\sticket\s[8fd39115d8f46ece70e7d4b3]. -D 2015-07-23T16:39:33.653 +C When\sSQLITE_OMIT_LOOKASIDE\sis\sset,\sdo\snot\sallocate\sany\slookaside\smemory\ssince\nit\swill\snever\sbe\sused. +D 2015-07-23T17:16:27.642 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 6b439e21d6dabede337772b85959340d37bb17bb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -292,7 +292,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 92bafa308607dd985ca389a788cd9e0a2b608712 F src/loadext.c e722f4b832f923744788365df5fb8515c0bc8a47 -F src/main.c 92d79bfa1a36c7c554700bb58eb8327abff1ac5c +F src/main.c 0a60b7ca8252c3a6f95438fa4ce8fe5b275c69f2 F src/malloc.c 19461e159bccf0e2cf06a50e867963d0a7b124a8 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987 @@ -1365,7 +1365,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 01c8b9ccfa0f336dfead7c004de3de571753f707 -R 23f175ee7b2eb2636faea6e0fbfacef1 +P 793e206f9032d9205bdb3f447b136bed9a25fa22 +R 9158ac1eaf08b6ce5d701ee4b9a1ddba U drh -Z 1c321a77d86fb7457929725064e82b93 +Z 6817e7006180b52519c297d18e3556cf diff --git a/manifest.uuid b/manifest.uuid index f5c0256de7..78d6663e99 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -793e206f9032d9205bdb3f447b136bed9a25fa22 \ No newline at end of file +0ffd499f2374f2b191080b9952acfed56daf3335 \ No newline at end of file diff --git a/src/main.c b/src/main.c index faeee6af2e..36206eec8c 100644 --- a/src/main.c +++ b/src/main.c @@ -642,6 +642,7 @@ int sqlite3_config(int op, ...){ ** the lookaside memory. */ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ +#ifndef SQLITE_OMIT_LOOKASIDE void *pStart; if( db->lookaside.nOut ){ return SQLITE_BUSY; @@ -692,6 +693,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ db->lookaside.bEnabled = 0; db->lookaside.bMalloced = 0; } +#endif /* SQLITE_OMIT_LOOKASIDE */ return SQLITE_OK; } From cfb8f8d6a9073040e90f0bf502f4b108d7917433 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jul 2015 20:44:49 +0000 Subject: [PATCH 20/20] Change the name of the OTA extension to RBU: Resumable Bulk Update. FossilOrigin-Name: 017c5019e1ce042025d4f327e50ec50af49f9fa4 --- Makefile.in | 6 +- Makefile.msc | 6 +- ext/{ota/ota.c => rbu/rbu.c} | 50 +- ext/{ota/ota1.test => rbu/rbu1.test} | 272 +-- ext/{ota/ota10.test => rbu/rbu10.test} | 58 +- ext/{ota/ota11.test => rbu/rbu11.test} | 102 +- ext/{ota/ota12.test => rbu/rbu12.test} | 100 +- ext/{ota/ota13.test => rbu/rbu13.test} | 18 +- ext/{ota/ota3.test => rbu/rbu3.test} | 92 +- ext/{ota/ota5.test => rbu/rbu5.test} | 86 +- ext/{ota/ota6.test => rbu/rbu6.test} | 52 +- ext/{ota/ota7.test => rbu/rbu7.test} | 38 +- ext/{ota/ota8.test => rbu/rbu8.test} | 30 +- ext/{ota/ota9.test => rbu/rbu9.test} | 36 +- ext/{ota/otaA.test => rbu/rbuA.test} | 40 +- ext/{ota/otacrash.test => rbu/rbucrash.test} | 78 +- ext/{ota/otafault.test => rbu/rbufault.test} | 66 +- .../otafault2.test => rbu/rbufault2.test} | 22 +- ext/{ota/sqlite3ota.c => rbu/sqlite3rbu.c} | 1578 ++++++++--------- ext/{ota/sqlite3ota.h => rbu/sqlite3rbu.h} | 248 +-- ext/{ota/test_ota.c => rbu/test_rbu.c} | 75 +- main.mk | 16 +- manifest | 70 +- manifest.uuid | 2 +- src/sqlite.h.in | 8 +- src/tclsqlite.c | 4 +- src/test_config.c | 6 +- test/permutations.test | 8 +- test/{ota.test => rbu.test} | 7 +- test/releasetest.tcl | 2 +- test/speedtest1.c | 12 +- tool/mksqlite3c.tcl | 6 +- 32 files changed, 1596 insertions(+), 1598 deletions(-) rename ext/{ota/ota.c => rbu/rbu.c} (67%) rename ext/{ota/ota1.test => rbu/rbu1.test} (71%) rename ext/{ota/ota10.test => rbu/rbu10.test} (81%) rename ext/{ota/ota11.test => rbu/rbu11.test} (64%) rename ext/{ota/ota12.test => rbu/rbu12.test} (71%) rename ext/{ota/ota13.test => rbu/rbu13.test} (80%) rename ext/{ota/ota3.test => rbu/rbu3.test} (65%) rename ext/{ota/ota5.test => rbu/rbu5.test} (83%) rename ext/{ota/ota6.test => rbu/rbu6.test} (70%) rename ext/{ota/ota7.test => rbu/rbu7.test} (79%) rename ext/{ota/ota8.test => rbu/rbu8.test} (75%) rename ext/{ota/ota9.test => rbu/rbu9.test} (81%) rename ext/{ota/otaA.test => rbu/rbuA.test} (70%) rename ext/{ota/otacrash.test => rbu/rbucrash.test} (59%) rename ext/{ota/otafault.test => rbu/rbufault.test} (78%) rename ext/{ota/otafault2.test => rbu/rbufault2.test} (78%) rename ext/{ota/sqlite3ota.c => rbu/sqlite3rbu.c} (69%) rename ext/{ota/sqlite3ota.h => rbu/sqlite3rbu.h} (63%) rename ext/{ota/test_ota.c => rbu/test_rbu.c} (71%) rename test/{ota.test => rbu.test} (76%) diff --git a/Makefile.in b/Makefile.in index dcf5a0bf80..9886377a4b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -345,8 +345,8 @@ SRC += \ $(TOP)/ext/rtree/rtree.h \ $(TOP)/ext/rtree/rtree.c SRC += \ - $(TOP)/ext/ota/sqlite3ota.h \ - $(TOP)/ext/ota/sqlite3ota.c + $(TOP)/ext/rbu/sqlite3rbu.h \ + $(TOP)/ext/rbu/sqlite3rbu.c # Generated source code files @@ -404,7 +404,7 @@ TESTSRC = \ $(TOP)/src/test_wsd.c \ $(TOP)/ext/fts3/fts3_term.c \ $(TOP)/ext/fts3/fts3_test.c \ - $(TOP)/ext/ota/test_ota.c + $(TOP)/ext/rbu/test_rbu.c # Statically linked extensions # diff --git a/Makefile.msc b/Makefile.msc index ed6e58e949..bec86b1bc9 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1007,8 +1007,8 @@ SRC4 = \ $(TOP)\ext\icu\icu.c \ $(TOP)\ext\rtree\rtree.h \ $(TOP)\ext\rtree\rtree.c \ - $(TOP)\ext\ota\sqlite3ota.h \ - $(TOP)\ext\ota\sqlite3ota.c + $(TOP)\ext\rbu\sqlite3rbu.h \ + $(TOP)\ext\rbu\sqlite3rbu.c # Generated source code files @@ -1069,7 +1069,7 @@ TESTSRC = \ $(TOP)\src\test_wsd.c \ $(TOP)\ext\fts3\fts3_term.c \ $(TOP)\ext\fts3\fts3_test.c \ - $(TOP)\ext\ota\test_ota.c + $(TOP)\ext\rbu\test_rbu.c # Statically linked extensions # diff --git a/ext/ota/ota.c b/ext/rbu/rbu.c similarity index 67% rename from ext/ota/ota.c rename to ext/rbu/rbu.c index fffc1267bd..6e84bbdebe 100644 --- a/ext/ota/ota.c +++ b/ext/rbu/rbu.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** -** This file contains a command-line application that uses the OTA +** This file contains a command-line application that uses the RBU ** extension. See the usage() function below for an explanation. */ -#include "sqlite3ota.h" +#include "sqlite3rbu.h" #include #include #include @@ -24,18 +24,18 @@ */ void usage(const char *zArgv0){ fprintf(stderr, -"Usage: %s [-step NSTEP] TARGET-DB OTA-DB\n" +"Usage: %s [-step NSTEP] TARGET-DB RBU-DB\n" "\n" -" Argument OTA-DB must be an OTA database containing an update suitable for\n" +" Argument RBU-DB must be an RBU database containing an update suitable for\n" " target database TARGET-DB. If NSTEP is set to less than or equal to zero\n" " (the default value), this program attempts to apply the entire update to\n" " the target database.\n" "\n" " If NSTEP is greater than zero, then a maximum of NSTEP calls are made\n" -" to sqlite3ota_step(). If the OTA update has not been completely applied\n" -" after the NSTEP'th call is made, the state is saved in the database OTA-DB\n" -" and the program exits. Subsequent invocations of this (or any other OTA)\n" -" application will use this state to resume applying the OTA update to the\n" +" to sqlite3rbu_step(). If the RBU update has not been completely applied\n" +" after the NSTEP'th call is made, the state is saved in the database RBU-DB\n" +" and the program exits. Subsequent invocations of this (or any other RBU)\n" +" application will use this state to resume applying the RBU update to the\n" " target db.\n" "\n" , zArgv0); @@ -47,8 +47,8 @@ void report_default_vfs(){ fprintf(stdout, "default vfs is \"%s\"\n", pVfs->zName); } -void report_ota_vfs(sqlite3ota *pOta){ - sqlite3 *db = sqlite3ota_db(pOta, 0); +void report_rbu_vfs(sqlite3rbu *pRbu){ + sqlite3 *db = sqlite3rbu_db(pRbu, 0); if( db ){ char *zName = 0; sqlite3_file_control(db, "main", SQLITE_FCNTL_VFSNAME, &zName); @@ -63,16 +63,16 @@ void report_ota_vfs(sqlite3ota *pOta){ int main(int argc, char **argv){ int i; - const char *zTarget; /* Target database to apply OTA to */ - const char *zOta; /* Database containing OTA */ + const char *zTarget; /* Target database to apply RBU to */ + const char *zRbu; /* Database containing RBU */ char *zErrmsg; /* Error message, if any */ - sqlite3ota *pOta; /* OTA handle */ + sqlite3rbu *pRbu; /* RBU handle */ int nStep = 0; /* Maximum number of step() calls */ int rc; sqlite3_int64 nProgress = 0; /* Process command line arguments. Following this block local variables - ** zTarget, zOta and nStep are all set. */ + ** zTarget, zRbu and nStep are all set. */ if( argc==5 ){ int nArg1 = strlen(argv[1]); if( nArg1>5 || nArg1<2 || memcmp("-step", argv[1], nArg1) ) usage(argv[0]); @@ -81,32 +81,32 @@ int main(int argc, char **argv){ usage(argv[0]); } zTarget = argv[argc-2]; - zOta = argv[argc-1]; + zRbu = argv[argc-1]; report_default_vfs(); - /* Open an OTA handle. If nStep is less than or equal to zero, call - ** sqlite3ota_step() until either the OTA has been completely applied + /* Open an RBU handle. If nStep is less than or equal to zero, call + ** sqlite3rbu_step() until either the RBU has been completely applied ** or an error occurs. Or, if nStep is greater than zero, call - ** sqlite3ota_step() a maximum of nStep times. */ - pOta = sqlite3ota_open(zTarget, zOta, 0); - report_ota_vfs(pOta); - for(i=0; (nStep<=0 || i