mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
A different fix to [fc62af4523]. When changing from journal_mode=PERSIST or TRINCATE to some other rollback mode, delete the journal file only if a RESERVED lock can be obtained on the database file first.
FossilOrigin-Name: b9b11855e8a9522309dd30e5256bb67d67e1353a
This commit is contained in:
@@ -5251,9 +5251,6 @@ case OP_JournalMode: { /* out2-prerelease */
|
||||
}else if( rc==SQLITE_BUSY && pOp->p5==0 ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
}else{
|
||||
sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_DELETE);
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
|
||||
/* Open a transaction on the database file. Regardless of the journal
|
||||
@@ -5261,8 +5258,7 @@ case OP_JournalMode: { /* out2-prerelease */
|
||||
*/
|
||||
assert( sqlite3BtreeIsInTrans(pBt)==0 );
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3BtreeSetVersion(pBt,
|
||||
(eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
|
||||
rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
|
||||
if( rc==SQLITE_BUSY && pOp->p5==0 ) goto abort_due_to_error;
|
||||
}
|
||||
if( rc==SQLITE_BUSY ){
|
||||
@@ -5274,6 +5270,7 @@ case OP_JournalMode: { /* out2-prerelease */
|
||||
#endif /* ifndef SQLITE_OMIT_WAL */
|
||||
|
||||
eNew = sqlite3PagerSetJournalMode(pPager, eNew);
|
||||
|
||||
pOut = &aMem[pOp->p2];
|
||||
pOut->flags = MEM_Str|MEM_Static|MEM_Term;
|
||||
pOut->z = (char *)sqlite3JournalModename(eNew);
|
||||
|
Reference in New Issue
Block a user