Avoid calling sqlite3OsDelete() on a file that is open, since this causes Windows to run *very* slowly. Comes up on error recovery in journal_mode=PERSIST.

FossilOrigin-Name: fdc651e2ec7a0babee669e24fd56632e7cd5f0e9
This commit is contained in:
mistachkin 2014-03-07 02:29:56 +00:00
parent f0ec2a5ea7
commit 8879481868
4 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Do\snot\srun\scorruptH.test\sin\smmap\smode.
D 2014-03-06T18:16:45.962
C Avoid\scalling\ssqlite3OsDelete()\son\sa\sfile\sthat\sis\sopen,\ssince\sthis\scauses\sWindows\sto\srun\s*very*\sslowly.\s\sComes\sup\son\serror\srecovery\sin\sjournal_mode=PERSIST.
D 2014-03-07T02:29:56.179
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -204,7 +204,7 @@ F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 18f7f95dc6bcb9cf4d4a238d8e2de96611bc2ae5
F src/os_win.c e71678ac927d0a0fb11d993db20a9748eabf808e
F src/pager.c 0ffa313a30ed6d061d9c6601b7b175cc50a1cab7
F src/pager.c f5805e0e8c271d37e812402c98b50b9bfb1b196b
F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
F src/parse.y 2613ca5d609c2f3d71dd297351f010bcec16e1e0
F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2
@ -1020,7 +1020,7 @@ F test/unique.test 93f8b2ef5ea51b9495f8d6493429b1fd0f465264
F test/unixexcl.test cd6c765f75e50e8e2c2ba763149e5d340ea19825
F test/unordered.test ef85ac8f2f3c93ed2b9e811b684de73175fc464c
F test/update.test 1b6c488a8f993d090b7ee9ad0e234faa161b3aeb
F test/uri.test 63e03df051620a18f794b4f4adcdefb3c23b6751
F test/uri.test 23662b7b61958b0f0e47082de7d06341ccf85d5b
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324
@ -1155,7 +1155,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 0a4200f95cf46ad620b9fd91f4444114a0c74730
R e9933db135410760cbb03eb238614bcf
U dan
Z b325d7c68ad2fff1170ad7d6e80e5338
P c0d54b4e41cba84dc5934e0fcd03fe422fe5c92b
R 8e1ba1c1988955cecc40c9b987fa270a
U mistachkin
Z a001c15cb2d0783379551661d5488666

View File

@ -1 +1 @@
c0d54b4e41cba84dc5934e0fcd03fe422fe5c92b
fdc651e2ec7a0babee669e24fd56632e7cd5f0e9

View File

@ -4889,15 +4889,15 @@ static int hasHotJournal(Pager *pPager, int *pExists){
if( rc==SQLITE_OK && !locked ){
Pgno nPage; /* Number of pages in database file */
/* Check the size of the database file. If it consists of 0 pages,
** then delete the journal file. See the header comment above for
** the reasoning here. Delete the obsolete journal file under
** a RESERVED lock to avoid race conditions and to avoid violating
** [H33020].
/* Check the size of the database file. If it consists of 0 pages
** and the journal is not being persisted, then delete the journal
** file. See the header comment above for the reasoning here.
** Delete the obsolete journal file under a RESERVED lock to avoid
** race conditions and to avoid violating [H33020].
*/
rc = pagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
if( nPage==0 ){
if( nPage==0 && pPager->journalMode!=PAGER_JOURNALMODE_PERSIST ){
sqlite3BeginBenignMalloc();
if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);

View File

@ -238,12 +238,14 @@ ifcapable wal {
tvfs1 script tvfs1_callback
proc tvfs1_callback {method filename args} {
set ::T1([file tail $filename]) 1
return SQLITE_OK
}
testvfs tvfs2
tvfs2 filter {xOpen xDelete xAccess xFullPathname}
tvfs2 script tvfs2_callback
proc tvfs2_callback {method filename args} {
set ::T2([file tail $filename]) 1
return SQLITE_OK
}
catch {db close}