Hi.

Another question.
Below source code is a part of "pager_write_pagelist()".

In this code, dbSize of pPager or pgno of pList are compared with
dbHistSize of pPager.
However, szFile variable is only calculated from dbSize of pPager.

  /* Before the first write, give the VFS a hint of what the final

  ** file size will be.

  */

  assert( rc!=SQLITE_OK || isOpen(pPager->fd) );

  if( rc==SQLITE_OK

   && (pList->pDirty ? pPager->dbSize : pList->pgno+1)>pPager->dbHintSize

  ){

    sqlite3_int64 szFile = pPager->pageSize *
(sqlite3_int64)pPager->dbSize;
    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);

    pPager->dbHintSize = pPager->dbSize;

  }


Should this line be changed to check pList->pgno?

From: sqlite3_int64 szFile = pPager->pageSize *
(sqlite3_int64)pPager->dbSize;
To:     sqlite3_int64 szFile = pPager->pageSize *
(sqlite3_int64)(pList->pDirty ? pPager->dbSize : pList->pgno+1);

When the original source is tested, fstat() in fcntlSizeHint() is called
frequently without any changes to file size.

Regards,
Yongil Jang.



2013/4/19 Yongil Jang <yongilj...@gmail.com>

> Dear all,
>
> I have a qustion about using chunk size on VFS.
>
> AFAIK, chunk size means that increasing and reducing file size has
> dependency on chunk size.
> For example, with chunk size of 32KB, DB file size can be 32KB, 64KB, 96KB
> and so on...
>
> However, when I tested with my own test scripts that inserts single record
> to a database file, file size increased with single page size. (ex: 4KB
> page size)
> In case of multiple insertion or update with transaction calls fallocate
> with chunk size.
>
> It would not be a big problem, but I will be happy if I can get some
> description about this.
>
> Best regards,
> Yongil Jang.
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to