mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Add the SQLITE_FCNTL_SIZE_HINT operator to sqlite3_file_control() and use it
to give the VFS hints about the ultimate size of a database file when the file is growing. FossilOrigin-Name: 2b7e3b4a30d6a7c4a8a4b8e7dd2ed728b565c96d
This commit is contained in:
@@ -3332,6 +3332,14 @@ static int pager_write_pagelist(PgHdr *pList){
|
||||
rc = pagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
|
||||
}
|
||||
|
||||
/* Before the first write, give the VFS a hint of what the final
|
||||
** file size will be.
|
||||
*/
|
||||
if( pPager->dbSize > (pPager->dbOrigSize+1) && isOpen(pPager->fd) ){
|
||||
sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;
|
||||
sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);
|
||||
}
|
||||
|
||||
while( rc==SQLITE_OK && pList ){
|
||||
Pgno pgno = pList->pgno;
|
||||
|
||||
|
Reference in New Issue
Block a user