diff options
author | rmcilroy@chromium.org <rmcilroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 22:50:12 +0000 |
---|---|---|
committer | rmcilroy@chromium.org <rmcilroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 22:50:12 +0000 |
commit | b7e3342b5453e86aa299cf5dc2cd76a4c66e9167 (patch) | |
tree | 7a6884d60520978197d67e39d1ce23aa885f07fc /third_party/sqlite | |
parent | 0a91a3fa17b2a9f9a67fdc864aa273cb0f5e834f (diff) | |
download | chromium_src-b7e3342b5453e86aa299cf5dc2cd76a4c66e9167.zip chromium_src-b7e3342b5453e86aa299cf5dc2cd76a4c66e9167.tar.gz chromium_src-b7e3342b5453e86aa299cf5dc2cd76a4c66e9167.tar.bz2 |
Use seperate page caches pools for each sqlite connection.
Due to multiple different subsystems using sqlite, the shared global page
cache policy does not suite our use-cases on Chrome very well. This CL
enables a compile time flag to be set to disable shared cache pools.
BUG=243769
Review URL: https://chromiumcodereview.appspot.com/17413004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/sqlite')
-rw-r--r-- | third_party/sqlite/README.chromium | 3 | ||||
-rw-r--r-- | third_party/sqlite/amalgamation/sqlite3.c | 8 | ||||
-rw-r--r-- | third_party/sqlite/separate_cache_pool.patch | 29 | ||||
-rw-r--r-- | third_party/sqlite/sqlite.gyp | 1 | ||||
-rw-r--r-- | third_party/sqlite/src/src/pcache1.c | 8 |
5 files changed, 45 insertions, 4 deletions
diff --git a/third_party/sqlite/README.chromium b/third_party/sqlite/README.chromium index d129d62..6becfe4 100644 --- a/third_party/sqlite/README.chromium +++ b/third_party/sqlite/README.chromium @@ -73,6 +73,8 @@ mac_time_machine.patch system-sqlite.patch sqlite-3.7.6.3-fix-out-of-scope-memory-reference.patch misalignment.patch +memcmp.patch +separate_cache_pool.patch So, e.g. you could do this to apply all our patches to vanilla SQLite: @@ -90,6 +92,7 @@ patch -p0 < ../sqlite/system-sqlite.patch patch -p0 < ../sqlite/sqlite-3.7.6.3-fix-out-of-scope-memory-reference.patch patch -p0 < ../sqlite/misalignment.patch patch -p0 < ../sqlite/memcmp.patch +patch -p0 < ../sqlite/separate_cache_pool.patch This will only be the case if all changes we make also update the corresponding patch files. Therefore please remember to do that whenever you make a change! diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c index 9f49db1..a457c09 100644 --- a/third_party/sqlite/amalgamation/sqlite3.c +++ b/third_party/sqlite/amalgamation/sqlite3.c @@ -35465,10 +35465,12 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ int sz; /* Bytes of memory required to allocate the new cache */ /* - ** The seperateCache variable is true if each PCache has its own private + ** The separateCache variable is true if each PCache has its own private ** PGroup. In other words, separateCache is true for mode (1) where no ** mutexing is required. ** + ** * Always use separate caches (mode-1) if SQLITE_SEPARATE_CACHE_POOLS + ** ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT ** ** * Always use a unified cache in single-threaded applications @@ -35476,7 +35478,9 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ ** * Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) ** use separate caches (mode-1) */ -#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 +#ifdef SQLITE_SEPARATE_CACHE_POOLS + const int separateCache = 1; +#elif defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 const int separateCache = 0; #else int separateCache = sqlite3GlobalConfig.bCoreMutex>0; diff --git a/third_party/sqlite/separate_cache_pool.patch b/third_party/sqlite/separate_cache_pool.patch new file mode 100644 index 0000000..cf22f35 --- /dev/null +++ b/third_party/sqlite/separate_cache_pool.patch @@ -0,0 +1,29 @@ +diff --git src/pcache1.c src/pcache1.c +index ad44395..e4d0705 100644 +--- src/pcache1.c ++++ src/pcache1.c +@@ -549,10 +549,12 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ + int sz; /* Bytes of memory required to allocate the new cache */ + + /* +- ** The seperateCache variable is true if each PCache has its own private ++ ** The separateCache variable is true if each PCache has its own private + ** PGroup. In other words, separateCache is true for mode (1) where no + ** mutexing is required. + ** ++ ** * Always use separate caches (mode-1) if SQLITE_SEPARATE_CACHE_POOLS ++ ** + ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT + ** + ** * Always use a unified cache in single-threaded applications +@@ -560,7 +562,9 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ + ** * Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) + ** use separate caches (mode-1) + */ +-#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 ++#ifdef SQLITE_SEPARATE_CACHE_POOLS ++ const int separateCache = 1; ++#elif defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 + const int separateCache = 0; + #else + int separateCache = sqlite3GlobalConfig.bCoreMutex>0; diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp index ad4cc72..cb1fe6b 100644 --- a/third_party/sqlite/sqlite.gyp +++ b/third_party/sqlite/sqlite.gyp @@ -16,6 +16,7 @@ 'SQLITE_ENABLE_ICU', 'SQLITE_ENABLE_MEMORY_MANAGEMENT', 'SQLITE_SECURE_DELETE', + 'SQLITE_SEPERATE_CACHE_POOLS', 'THREADSAFE', '_HAS_EXCEPTIONS=0', ], diff --git a/third_party/sqlite/src/src/pcache1.c b/third_party/sqlite/src/src/pcache1.c index ad44395..e4d0705 100644 --- a/third_party/sqlite/src/src/pcache1.c +++ b/third_party/sqlite/src/src/pcache1.c @@ -549,10 +549,12 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ int sz; /* Bytes of memory required to allocate the new cache */ /* - ** The seperateCache variable is true if each PCache has its own private + ** The separateCache variable is true if each PCache has its own private ** PGroup. In other words, separateCache is true for mode (1) where no ** mutexing is required. ** + ** * Always use separate caches (mode-1) if SQLITE_SEPARATE_CACHE_POOLS + ** ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT ** ** * Always use a unified cache in single-threaded applications @@ -560,7 +562,9 @@ static sqlite3_pcache *pcache1Create(int szPage, int bPurgeable){ ** * Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) ** use separate caches (mode-1) */ -#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 +#ifdef SQLITE_SEPARATE_CACHE_POOLS + const int separateCache = 1; +#elif defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 const int separateCache = 0; #else int separateCache = sqlite3GlobalConfig.bCoreMutex>0; |