1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

If SQLITE_DEFAULT_WAL_SYNCHRONOUS is not the same value as

SQLITE_DEFAULT_SYNCHRONOUS and the application has not run
"PRAGMA synchronous", then set synchronous to the 
SQLITE_DEFAULT_WAL_SYNCHRONOUS setting when entering WAL mode for
the first time.

FossilOrigin-Name: 5791407b523abd24e832fc2361b3e9f01ee2f36a
This commit is contained in:
drh
2016-03-08 15:14:26 +00:00
parent 50a1a5aaca
commit e243de5cf5
6 changed files with 32 additions and 17 deletions

View File

@@ -2864,9 +2864,25 @@ static int lockBtree(BtShared *pBt){
rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);
if( rc!=SQLITE_OK ){
goto page1_init_failed;
}else if( isOpen==0 ){
releasePage(pPage1);
return SQLITE_OK;
}else{
#if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS
sqlite3 *db;
Db *pDb;
if( (db=pBt->db)!=0 && (pDb=db->aDb)!=0 ){
while( pDb->pBt==0 || pDb->pBt->pBt!=pBt ){ pDb++; }
if( pDb->bSyncSet==0
&& pDb->safety_level==SQLITE_DEFAULT_SYNCHRONOUS
){
pDb->safety_level = SQLITE_DEFAULT_WAL_SYNCHRONOUS;
sqlite3PagerSetFlags(pBt->pPager,
pDb->safety_level | (db->flags & PAGER_FLAGS_MASK));
}
}
#endif
if( isOpen==0 ){
releasePage(pPage1);
return SQLITE_OK;
}
}
rc = SQLITE_NOTADB;
}