Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: third_party/sqlite/preload-cache.patch

Issue 6823057: Cleanup SQLite 3.6.18 import. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/misc.patch ('k') | third_party/sqlite/preprocessed/sqlite3.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Adds a new API function sqlite3_preload(). This fills the page cache
2 with the first pages of the database.
3
1 Index: src/build.c 4 Index: src/build.c
2 =================================================================== 5 ===================================================================
3 --- src/build.c 2009-09-11 07:02:46.000000000 -0700 6 --- src/build.c 2009-09-11 07:02:46.000000000 -0700
4 +++ src/build.c 2009-09-14 18:16:46.000000000 -0700 7 +++ src/build.c 2009-09-14 18:16:46.000000000 -0700
5 @@ -26,6 +26,9 @@ 8 @@ -26,6 +26,9 @@
6 */ 9 */
7 #include "sqliteInt.h" 10 #include "sqliteInt.h"
8 11
9 +#include "pager.h" 12 +#include "pager.h"
10 +#include "btree.h" 13 +#include "btree.h"
11 + 14 +
12 /* 15 /*
13 ** This routine is called when a new SQL statement is beginning to 16 ** This routine is called when a new SQL statement is beginning to
14 ** be parsed. Initialize the pParse structure as needed. 17 ** be parsed. Initialize the pParse structure as needed.
15 @@ -3659,3 +3662,30 @@ 18 @@ -3659,3 +3662,30 @@
16 } 19 }
17 return pKey; 20 return pKey;
18 } 21 }
19 + 22 +
20 +/* Begin preload-cache.patch for Chromium */ 23 +/* Begin preload-cache.patch for Chromium */
21 +/* See declaration in sqlite3.h for information */ 24 +/* See declaration in sqlite3.h for information */
22 +int sqlite3Preload(sqlite3 *db) 25 +int sqlite3_preload(sqlite3 *db)
23 +{ 26 +{
24 + Pager *pPager; 27 + Pager *pPager;
25 + Btree *pBt; 28 + Btree *pBt;
26 + int rc; 29 + int rc;
27 + int i; 30 + int i;
28 + int dbsLoaded = 0; 31 + int dbsLoaded = 0;
29 + 32 +
30 + for(i=0; i<db->nDb; i++) { 33 + for(i=0; i<db->nDb; i++) {
31 + pBt = db->aDb[i].pBt; 34 + pBt = db->aDb[i].pBt;
32 + if( !pBt ) 35 + if( !pBt )
(...skipping 23 matching lines...) Expand all
56 +** Preload the databases into the pager cache, up to the maximum size of the 59 +** Preload the databases into the pager cache, up to the maximum size of the
57 +** pager cache. 60 +** pager cache.
58 +** 61 +**
59 +** For a database to be loaded successfully, the pager must be active. That is, 62 +** For a database to be loaded successfully, the pager must be active. That is,
60 +** there must be an open statement on that database. See sqlite3pager_loadall 63 +** there must be an open statement on that database. See sqlite3pager_loadall
61 +** 64 +**
62 +** There might be many databases attached to the given connection. We iterate 65 +** There might be many databases attached to the given connection. We iterate
63 +** them all and try to load them. If none are loadable successfully, we return 66 +** them all and try to load them. If none are loadable successfully, we return
64 +** an error. Otherwise, we return OK. 67 +** an error. Otherwise, we return OK.
65 +*/ 68 +*/
66 +int sqlite3Preload(sqlite3 *db); 69 +int sqlite3_preload(sqlite3 *db);
67 +/* End preload-cache.patch for Chromium */ 70 +/* End preload-cache.patch for Chromium */
68 + 71 +
69 /* 72 /*
70 ** CAPI3REF: Virtual File System Objects {H11200} <S20100> 73 ** CAPI3REF: Virtual File System Objects {H11200} <S20100>
71 ** 74 **
72 Index: src/pager.c 75 Index: src/pager.c
73 =================================================================== 76 ===================================================================
74 --- src/pager.c 2009-09-07 08:58:09.000000000 -0700 77 --- src/pager.c 2009-09-07 08:58:09.000000000 -0700
75 +++ src/pager.c 2009-09-15 16:43:07.000000000 -0700 78 +++ src/pager.c 2009-09-15 16:43:07.000000000 -0700
76 @@ -388,6 +388,16 @@ 79 @@ -388,6 +388,16 @@
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 +++ src/pager.h 2009-09-15 11:31:55.000000000 -0700 238 +++ src/pager.h 2009-09-15 11:31:55.000000000 -0700
236 @@ -143,6 +143,8 @@ 239 @@ -143,6 +143,8 @@
237 sqlite3_file *sqlite3PagerFile(Pager*); 240 sqlite3_file *sqlite3PagerFile(Pager*);
238 const char *sqlite3PagerJournalname(Pager*); 241 const char *sqlite3PagerJournalname(Pager*);
239 int sqlite3PagerNosync(Pager*); 242 int sqlite3PagerNosync(Pager*);
240 +/* This function is for preload-cache.patch for Chromium: */ 243 +/* This function is for preload-cache.patch for Chromium: */
241 +int sqlite3PagerLoadall(Pager*); 244 +int sqlite3PagerLoadall(Pager*);
242 void *sqlite3PagerTempSpace(Pager*); 245 void *sqlite3PagerTempSpace(Pager*);
243 int sqlite3PagerIsMemdb(Pager*); 246 int sqlite3PagerIsMemdb(Pager*);
244 247
248 Index: src/pcache.c
249 ===================================================================
250 --- src/pcache.c 2009-09-04 13:37:42.000000000 -0700
251 +++ src/pcache.c 2009-09-15 16:41:55.000000000 -0700
252 @@ -542,14 +542,12 @@
253 return nPage;
254 }
255
256 -#ifdef SQLITE_TEST
257 /*
258 ** Get the suggested cache-size value.
259 */
260 int sqlite3PcacheGetCachesize(PCache *pCache){
261 return pCache->nMax;
262 }
263 -#endif
264
265 /*
266 ** Set the suggested cache-size value.
267 Index: src/pcache.h
268 ===================================================================
269 --- src/pcache.h 2009-09-04 13:37:42.000000000 -0700
270 +++ src/pcache.h 2009-09-15 16:41:52.000000000 -0700
271 @@ -139,9 +139,7 @@
272 ** of the suggested cache-sizes.
273 */
274 void sqlite3PcacheSetCachesize(PCache *, int);
275 -#ifdef SQLITE_TEST
276 int sqlite3PcacheGetCachesize(PCache *);
277 -#endif
278
279 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
280 /* Try to return memory used by the pcache module to the main memory heap */
OLDNEW
« no previous file with comments | « third_party/sqlite/misc.patch ('k') | third_party/sqlite/preprocessed/sqlite3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698