From: drh Date: Wed, 19 May 2010 22:09:19 +0000 (+0000) Subject: Cherry-pick the SQLITE_FCNTL_SIZE_HINT patch (check-in [2b7e3b4a30d6a7c4a8] X-Git-Tag: mountain-lion~58^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4098a3d9f8d8cefaeb5e7fa5a7088069b390dd1;p=thirdparty%2Fsqlite.git Cherry-pick the SQLITE_FCNTL_SIZE_HINT patch (check-in [2b7e3b4a30d6a7c4a8] and bump the version number to 3.6.23.2. FossilOrigin-Name: 776679af588625f13307369770979bccae7cf03a --- diff --git a/VERSION b/VERSION index cc690cc436..ea05a75496 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.6.23.1 +3.6.23.2 diff --git a/manifest b/manifest index c6e5e0ffe0..09cbf369f7 100644 --- a/manifest +++ b/manifest @@ -1,14 +1,14 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Disable\sthe\scorruptE\stest\swhich\sSQLITE_OVERSIZE_CELL_CHECK\sis\senabled.\nThis\sis\sa\scherrypick\smerge\sfrom\scheck-in\s[1dc4f9fe9b83467ba]. -D 2010-05-19T20:30:16 +C Cherry-pick\sthe\sSQLITE_FCNTL_SIZE_HINT\spatch\s(check-in\s[2b7e3b4a30d6a7c4a8]\nand\sbump\sthe\sversion\snumber\sto\s3.6.23.2. +D 2010-05-19T22:09:19 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.vxworks ab005d301296c40e021ccd0133ce49ca811e319f F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 -F VERSION 09d2dfb6a4a47d07b3b2091e349eedef78fb0f77 +F VERSION e074e6c926531bc0ccf713d48465eb16807d7193 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531 F art/2005osaward.gif 0d1851b2a7c1c9d0ccce545f3e14bca42d7fd248 @@ -153,9 +153,9 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306 F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30 F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f -F src/os_unix.c 148d2f625db3727250c0b880481ae7630b6d0eb0 -F src/os_win.c 1c7453c2df4dab26d90ff6f91272aea18bcf7053 -F src/pager.c 1915e3ec1a2157d0c29086b7fc0c936a2d97029e +F src/os_unix.c fdeb37c703243141470396acf32331674b905e55 +F src/os_win.c bc65553f911439a6b1aa3cf22f34e5ea1c4aa394 +F src/pager.c e39ac887694a6644135f5e4151fe293b5397dd64 F src/pager.h 1b32faf2e578ac3e7bcf9c9d11217128261c5c54 F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c 4956b41d6ba913f7a8a56fbf32be78caed0e45c2 @@ -169,7 +169,7 @@ F src/resolve.c a1648d98e869937b29f4f697461fe4d60f220a7b F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c 4113ef360430ed4e7533690ef46d06c20204adce F src/shell.c c40427c7245535a04a9cb4a417b6cc05c022e6a4 -F src/sqlite.h.in 08a2d9a278ff0dfd65055a7ec9c599f7ae1a3c18 +F src/sqlite.h.in f9a9be1bce911669a259f7c747bf05635cb360b5 F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 F src/sqliteInt.h 6873f7f4c24fcdceece8777f2a1cbec049df77a0 F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 @@ -795,14 +795,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P b51fcac9fb4207810ee8d33ead47886e9c46d224 -R 5026f362b493c0d77060cf3649122050 +P a40d080ca3c5f152f3296caf48f20728f61317de +R 6b321985aaecd4ff831144c4a95fd584 U drh -Z b66b4e4c871064b8805e5065bde070bc +Z c0f8d3e720ac9f1021b4b9695ecbd8fd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFL9EpboxKgR168RlERApFWAJ9PwVd2vtYYmrUVxPOHb8rjJua9iQCeKmI2 -LDgKLnQS+QE03MScalpbIxY= -=ekzi +iD8DBQFL9GGSoxKgR168RlERAnsLAJ9mAxq1HjJvHt5vClDz1V5oM9GOTwCgiKms +ckp+G3lPReQ5n8ebpgNyR7c= +=B53W -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 15bdf941c3..f2572112b7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a40d080ca3c5f152f3296caf48f20728f61317de \ No newline at end of file +776679af588625f13307369770979bccae7cf03a \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 769e75df39..8c35d285f3 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3349,6 +3349,12 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ *(int*)pArg = ((unixFile*)id)->lastErrno; return SQLITE_OK; } + case SQLITE_FCNTL_SIZE_HINT: { + sqlite3_int64 szFile = *(sqlite3_int64*)pArg; + unixFile *pFile = (unixFile*)id; + ftruncate(pFile->h, szFile); + return SQLITE_OK; + } #ifndef NDEBUG /* The pager calls this method to signal that it has done ** a rollback and that the database is therefore unchanged and diff --git a/src/os_win.c b/src/os_win.c index 4721eadff8..c3ea1b2754 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1112,6 +1112,11 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ *(int*)pArg = (int)((winFile*)id)->lastErrno; return SQLITE_OK; } + case SQLITE_FCNTL_SIZE_HINT: { + sqlite3_int64 sz = *(sqlite3_int64*)pArg; + winTruncate(id, sz); + return SQLITE_OK; + } } return SQLITE_ERROR; } diff --git a/src/pager.c b/src/pager.c index 180b3c7947..61e0e98f38 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2869,6 +2869,17 @@ 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( rc==SQLITE_OK + && pPager->dbSize>(pPager->dbFileSize+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; @@ -4660,7 +4671,7 @@ int sqlite3PagerCommitPhaseOne( sqlite3PagerUnref(pPage); if( rc!=SQLITE_OK ) goto commit_phase_one_exit; } - } + } pPager->dbSize = dbSize; } #endif diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f831496ab0..d0827abd5a 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -670,11 +670,19 @@ struct sqlite3_io_methods { ** into an integer that the pArg argument points to. This capability ** is used during testing and only needs to be supported when SQLITE_TEST ** is defined. +** +** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS +** layer a hint of how large the database file will grow to be during the +** current transaction. This hint is not guaranteed to be accurate but it +** is often close. The underlying VFS might choose to preallocate database +** file space based on this hint in order to help writes to the database +** file run faster. */ #define SQLITE_FCNTL_LOCKSTATE 1 #define SQLITE_GET_LOCKPROXYFILE 2 #define SQLITE_SET_LOCKPROXYFILE 3 #define SQLITE_LAST_ERRNO 4 +#define SQLITE_FCNTL_SIZE_HINT 5 /* ** CAPI3REF: Mutex Handle