aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2013-03-23 17:29:06 +0000
committerdan <dan@noemail.net>2013-03-23 17:29:06 +0000
commite5586a1a79f3d8e61ee6d263ec680c012ffbabfb (patch)
tree819ec26cd25df30f40979028e39cab596fabcbca /src
parent9d56c6df9aef1e9cb59246b010c55407ea1ab73b (diff)
downloadsqlite-e5586a1a79f3d8e61ee6d263ec680c012ffbabfb.tar.gz
sqlite-e5586a1a79f3d8e61ee6d263ec680c012ffbabfb.zip
Improve a comment in wal.c. No code changes.
FossilOrigin-Name: 60b9f5e4dd2af54975ba78437239f0bebd472fd2
Diffstat (limited to 'src')
-rw-r--r--src/wal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/wal.c b/src/wal.c
index 8757003d7..051b77f51 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1725,12 +1725,17 @@ static int walCheckpoint(
rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
}
- /* If the database file may grow as a result of this checkpoint, hint
- ** about the eventual size of the db file to the VFS layer.
- */
+ /* If the database file is currently smaller than mxPage pages in size,
+ ** the call below issues an SQLITE_FCNTL_SIZE_HINT to the OS layer to
+ ** inform it that it is likely to grow to that size.
+ **
+ ** Additionally, if the pager is using mmap(), then the call to
+ ** SetFilesize() guarantees that the mapping is not larger than mxPage
+ ** pages. This makes the sqlite3OsTruncate() call below safe - no pages
+ ** that are part of the mapped region will be truncated away. */
if( rc==SQLITE_OK ){
i64 nReq = ((i64)mxPage * szPage);
- rc = sqlite3PagerSetFilesize(pWal->pPager, nReq);
+ rc = sqlite3PagerSetFilesize(pWal->pPager, nReq);
}
/* Iterate through the contents of the WAL, copying data to the db file. */