1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Before beginning an incremental checkpoint in RBU, sync the directory

containing the target database file. This ensures that the new directory entry
created by renaming the *-oal file to *-wal is synced to disk.

FossilOrigin-Name: 915a9a28783fbb2f4c0794eb4264ce8c0b9d42f7
This commit is contained in:
dan
2017-03-03 16:51:46 +00:00
parent 9715f7f033
commit 0e9b43ff85
3 changed files with 15 additions and 8 deletions

View File

@ -2624,6 +2624,7 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){
}else{
int nSectorSize;
sqlite3_file *pDb = p->pTargetFd->pReal;
sqlite3_file *pWal = p->pTargetFd->pWalFd->pReal;
assert( p->nPagePerSector==0 );
nSectorSize = pDb->pMethods->xSectorSize(pDb);
if( nSectorSize>p->pgsz ){
@ -2631,6 +2632,12 @@ static void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){
}else{
p->nPagePerSector = 1;
}
/* Call xSync() on the wal file. This causes SQLite to sync the
** directory in which the target database and the wal file reside, in
** case it has not been synced since the rename() call in
** rbuMoveOalFile(). */
p->rc = pWal->pMethods->xSync(pWal, SQLITE_SYNC_NORMAL);
}
}
}