mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
If, after obtaining a SHARED lock, there exists a *-wal file in the file-system, use WAL mode. This is necessary to recover from a crash that damages the first page of the database file.
FossilOrigin-Name: 33cabf271b8f4dda508a610bf59964273fe2cb84
This commit is contained in:
@@ -2268,7 +2268,14 @@ static int lockBtree(BtShared *pBt){
|
||||
goto page1_init_failed;
|
||||
}
|
||||
|
||||
/* If the write version is set to 2, turn on write-ahead logging mode. */
|
||||
/* If the write version is set to 2, this database should be accessed
|
||||
** in WAL mode. If the log is not already open, open it now. Then
|
||||
** return SQLITE_OK and return without populating BtShared.pPage1.
|
||||
** The caller detects this and calls this function again. This is
|
||||
** required as the version of page 1 currently in the page1 buffer
|
||||
** may not be the latest version - there may be a newer one in the log
|
||||
** file.
|
||||
*/
|
||||
if( page1[19]==2 ){
|
||||
int isOpen = 0;
|
||||
rc = sqlite3PagerOpenLog(pBt->pPager, &isOpen);
|
||||
|
Reference in New Issue
Block a user