Still more refinements to the hasHotJournal() fix of ticket #3883. (CVS 6689)

FossilOrigin-Name: 726b425e43e5d864e7e83853bdf134debc1ffb59
This commit is contained in:
drh 2009-05-29 11:57:38 +00:00
parent cc0acb261e
commit 9fe769f129
3 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,5 @@
C The\shasHotJournal()\sfix\sof\scheck-in\s(6687)\scauses\ssome\sminor\sproblems\sin\nvarious\salternative\soperating\smodes,\ssuch\sas\slocking_mode=EXCLUSIVE.\s\sThis\nadditional\spatch\sattempts\sto\sfix\sthose\sconcerns.\s\sTicket\s#3883.\s(CVS\s6688)
D 2009-05-29T10:55:30
C Still\smore\srefinements\sto\sthe\shasHotJournal()\sfix\sof\sticket\s#3883.\s(CVS\s6689)
D 2009-05-29T11:57:38
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -146,7 +146,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
F src/os_unix.c e55d977c516ed880a2f83f0610b019efd9f8bc06
F src/os_win.c 725c38a524d168ce280446ad8761d731bc516405
F src/pager.c e8d7bb38b017f69592ef60c29e079e98116e9169
F src/pager.c 47acbe149a48abbe578f1d753706e6b0ab9d8001
F src/pager.h 73f481a308a873ccd626d97331c081db3b53e2e5
F src/parse.y 07690df997d50b3fdb5e5121e5a27f1a080db13d
F src/pcache.c 395f752a13574120bd7513a400ba02a265aaa76d
@ -731,7 +731,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P d6b5d8e1ab8e5d3348ace560230702718a2a8af9
R 0ac9e3aa3a83dcf8ee0374add80abf93
P a2ba61d927a06c390a9a818a013328092b802222
R df5faf03661654bce8e5953dac271838
U drh
Z 63f4ce5bec4a9085ab67577f4243a291
Z c67a8bef852bbf3b9d8397d68afe4414

View File

@ -1 +1 @@
a2ba61d927a06c390a9a818a013328092b802222
726b425e43e5d864e7e83853bdf134debc1ffb59

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.589 2009/05/29 10:55:30 drh Exp $
** @(#) $Id: pager.c,v 1.590 2009/05/29 11:57:38 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@ -3391,7 +3391,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){
** we get to the following sqlite3OsCheckReservedLock() call. If that
** is the case, this routine might think there is a hot journal when
** in fact there is none. This results in a false-positive which will
** be dealt with by the playback routine under. Ticket #3883.
** be dealt with by the playback routine. Ticket #3883.
*/
rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
if( rc==SQLITE_OK && !locked ){
@ -3400,16 +3400,18 @@ static int hasHotJournal(Pager *pPager, int *pExists){
/* 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.
** a RESERVED lock to avoid race conditions and to avoid violating
** [H33020].
*/
rc = sqlite3PagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
if( nPage==0 ){
sqlite3BeginBenignMalloc();
if( pPager->exclusiveMode
if( pPager->state>=PAGER_RESERVED
|| sqlite3OsLock(pPager->fd, RESERVED_LOCK)==SQLITE_OK ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
if( !pPager->exclusiveMode ){
assert( pPager->state>=PAGER_SHARED );
if( pPager->state==PAGER_SHARED ){
sqlite3OsUnlock(pPager->fd, SHARED_LOCK);
}
}