Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | An improvement to the SQLITE_FCNTL_SIZE_HINT change that invokes the hint less often and only when really needed. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | branch-3.6.1 |
Files: | files | file ages | folders |
SHA1: |
a1d20ceb9c195ea96f09c2a40c898ca7 |
User & Date: | drh 2010-05-17 15:52:44.000 |
Context
2010-10-15
| ||
14:45 | Cherry-pick the change at [2d4505510032bf9] into the 3.6.1 branch. (check-in: ecb1419e4b user: drh tags: branch-3.6.1) | |
2010-05-18
| ||
12:37 | Keep additional state information in the pager in an effort to reduce the number of SQLITE_FCNTL_SIZE_HINTs. (Note: This change was found to make no performance difference and so has been moved onto a side branch. Use the parent check-in instead of this one.) (Closed-Leaf check-in: 97d88a86e4 user: drh tags: branch-3.6.1-exp) | |
2010-05-17
| ||
15:52 | An improvement to the SQLITE_FCNTL_SIZE_HINT change that invokes the hint less often and only when really needed. (check-in: a1d20ceb9c user: drh tags: branch-3.6.1) | |
15:33 | Invoke the SQLITE_FCNTL_SIZE_HINT opcode on the sqlite3_file_control() interface for database files before extending the size of the file. The VFS can use this hint to preallocate space. (check-in: 9a08371171 user: drh tags: branch-3.6.1) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
3028 3029 3030 3031 3032 3033 3034 | ** every one of those pages out to the database file and mark them all ** as clean. */ static int pager_write_pagelist(PgHdr *pList){ Pager *pPager; PgHdr *p; int rc; | < | 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 | ** every one of those pages out to the database file and mark them all ** as clean. */ static int pager_write_pagelist(PgHdr *pList){ Pager *pPager; PgHdr *p; int rc; if( pList==0 ) return SQLITE_OK; pPager = pList->pPager; /* At this point there may be either a RESERVED or EXCLUSIVE lock on the ** database file. If there is already an EXCLUSIVE lock, the following ** calls to sqlite3OsLock() are no-ops. |
︙ | ︙ | |||
3059 3060 3061 3062 3063 3064 3065 | } pList = sort_pagelist(pList); for(p=pList; p; p=p->pDirty){ assert( p->dirty ); p->dirty = 0; } | < < | | | | | | | | | > | | < | > | 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 | } pList = sort_pagelist(pList); for(p=pList; p; p=p->pDirty){ assert( p->dirty ); p->dirty = 0; } /* If the file has not yet been opened, open it now. */ if( !pPager->fd->pMethods ){ assert(pPager->tempFile); rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags); if( rc ) return rc; } /* Before the first write, give the VFS a hint of what the final ** file size will be. */ if( pPager->dbSize > (pPager->origDbSize+1) ){ sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); } while( pList ){ /* If there are dirty pages in the page cache with page numbers greater ** than Pager.dbSize, this means sqlite3PagerTruncate() was called to ** make the file smaller (presumably by auto-vacuum code). Do not write ** any such pages to the file. */ if( pList->pgno<=pPager->dbSize ){ i64 offset = (pList->pgno-1)*(i64)pPager->pageSize; |
︙ | ︙ |