-C Do\snot\srun\spragma3.test\sas\spart\sof\sthe\smmap\spermutation.
-D 2014-12-31T09:52:15.410
+C Make\ssure\sPRAGMA\sdata_version\sis\supdated\seven\sif\sthe\scache\sis\sempty\swhen\nanother\sconnection\schanges\sthe\sdatabase.
+D 2014-12-31T14:18:48.679
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 7cd23e4fc91004a6bd081623e1bc6932e44828c0
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/os_unix.c 08c0346d2ea5e5ffd5b1a796f9becf1976d648d7
F src/os_win.c 91d3d08e33ec0258d180d4c8255492f47d15e007
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
-F src/pager.c 2cbaf886a6157c53a8061ea7e677f81620ff46eb
+F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
F src/parse.y 5dfead8aed90cb0c7c1115898ee2266804daff45
F src/pcache.c b83d160ce81ca101f98f0d27498e6d6bd49f1599
F test/permutations.test e1c603ec095e29de3d1f1566d704ea270f9c3f89
F test/pragma.test aa16dedfe01c02c8895169012f7dfde9c163f0d5
F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
-F test/pragma3.test 0ca2aea1499a7c2dcee235419e520d825dac958d
+F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a
F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 93094a68d3a6178779878cbbe0e5e09ef31a323f
-R 568e484006de3cb2669a32ac139fa8fe
-U dan
-Z 9ed2b5eb1c7f4568141d7b75c646d319
+P 94101011966243d599519a69c99c202ea31b928d
+R ce88be0f3eb17006a4da57569dcf8731
+U drh
+Z eb99526801ba8c2c5e7e84b0513387c7
u8 doNotSpill; /* Do not spill the cache when non-zero */
u8 subjInMemory; /* True to use in-memory sub-journals */
u8 bUseFetch; /* True to use xFetch() */
+ u8 hasBeenUsed; /* True if any content previously read from this pager*/
Pgno dbSize; /* Number of pages in the database */
Pgno dbOrigSize; /* dbSize before the current transaction */
Pgno dbFileSize; /* Number of pages in the database file */
PgHdr **ppPage /* OUT: Acquired page object */
){
PgHdr *p; /* Memory mapped page to return */
-
+
if( pPager->pMmapFreelist ){
*ppPage = p = pPager->pMmapFreelist;
pPager->pMmapFreelist = p->pDirty;
);
}
- if( !pPager->tempFile && (
- pPager->pBackup
- || sqlite3PcachePagecount(pPager->pPCache)>0
- || USEFETCH(pPager)
- )){
- /* The shared-lock has just been acquired on the database file
- ** and there are already pages in the cache (from a previous
- ** read or write transaction). Check to see if the database
- ** has been modified. If the database has changed, flush the
- ** cache.
+ if( !pPager->tempFile && pPager->hasBeenUsed ){
+ /* The shared-lock has just been acquired then check to
+ ** see if the database has been modified. If the database has changed,
+ ** flush the cache. The pPager->hasBeenUsed flag prevents this from
+ ** occurring on the very first access to a file, in order to save a
+ ** single unnecessary sqlite3OsRead() call at the start-up.
**
** Database changes is detected by looking at 15 bytes beginning
** at offset 24 into the file. The first 4 of these 16 bytes are
if( pgno==0 ){
return SQLITE_CORRUPT_BKPT;
}
+ pPager->hasBeenUsed = 1;
/* If the pager is in the error state, return an error immediately.
** Otherwise, request the page from the PCache layer. */
assert( pgno!=0 );
assert( pPager->pPCache!=0 );
pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0);
+ assert( pPage==0 || pPager->hasBeenUsed );
return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage);
}