| Index: third_party/sqlite/patches/0015-backport-Config-database-to-not-checkpoint-WAL-on-cl.patch
|
| diff --git a/third_party/sqlite/patches/0015-backport-Config-database-to-not-checkpoint-WAL-on-cl.patch b/third_party/sqlite/patches/0015-backport-Config-database-to-not-checkpoint-WAL-on-cl.patch
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f9e619afc17c75059e3efee1c6bd18c49dfb05fc
|
| --- /dev/null
|
| +++ b/third_party/sqlite/patches/0015-backport-Config-database-to-not-checkpoint-WAL-on-cl.patch
|
| @@ -0,0 +1,137 @@
|
| +From e5ba7652d3d8a1769955a579d84edbe5595d5e2b Mon Sep 17 00:00:00 2001
|
| +From: Scott Hess <shess@chromium.org>
|
| +Date: Fri, 16 Dec 2016 15:25:50 -0800
|
| +Subject: [PATCH 15/15] [backport] Config database to not checkpoint WAL on
|
| + close.
|
| +
|
| +SQLite check-in https://www.sqlite.org/src/info/6d142025c74f66f2
|
| +[With mods through pending 3.16.0.]
|
| +
|
| +"Add the SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE sqlite3_dbconfig() option -
|
| +for disabling SQLite's default checkpoint-on-close behaviour."
|
| +
|
| +BUG=675264
|
| +---
|
| + third_party/sqlite/src/src/btree.c | 4 ++--
|
| + third_party/sqlite/src/src/main.c | 1 +
|
| + third_party/sqlite/src/src/pager.c | 6 ++++--
|
| + third_party/sqlite/src/src/pager.h | 2 +-
|
| + third_party/sqlite/src/src/sqlite.h.in | 13 +++++++++++++
|
| + third_party/sqlite/src/src/sqliteInt.h | 1 +
|
| + 6 files changed, 22 insertions(+), 5 deletions(-)
|
| +
|
| +diff --git a/third_party/sqlite/src/src/btree.c b/third_party/sqlite/src/src/btree.c
|
| +index f5feff8a..f987388 100644
|
| +--- a/third_party/sqlite/src/src/btree.c
|
| ++++ b/third_party/sqlite/src/src/btree.c
|
| +@@ -2390,7 +2390,7 @@ int sqlite3BtreeOpen(
|
| + btree_open_out:
|
| + if( rc!=SQLITE_OK ){
|
| + if( pBt && pBt->pPager ){
|
| +- sqlite3PagerClose(pBt->pPager);
|
| ++ sqlite3PagerClose(pBt->pPager, 0);
|
| + }
|
| + sqlite3_free(pBt);
|
| + sqlite3_free(p);
|
| +@@ -2531,7 +2531,7 @@ int sqlite3BtreeClose(Btree *p){
|
| + ** Clean out and delete the BtShared object.
|
| + */
|
| + assert( !pBt->pCursor );
|
| +- sqlite3PagerClose(pBt->pPager);
|
| ++ sqlite3PagerClose(pBt->pPager, p->db);
|
| + if( pBt->xFreeSchema && pBt->pSchema ){
|
| + pBt->xFreeSchema(pBt->pSchema);
|
| + }
|
| +diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main.c
|
| +index 301808c..78181cd 100644
|
| +--- a/third_party/sqlite/src/src/main.c
|
| ++++ b/third_party/sqlite/src/src/main.c
|
| +@@ -799,6 +799,7 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
|
| + } aFlagOp[] = {
|
| + { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys },
|
| + { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger },
|
| ++ { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose },
|
| + };
|
| + unsigned int i;
|
| + rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
|
| +diff --git a/third_party/sqlite/src/src/pager.c b/third_party/sqlite/src/src/pager.c
|
| +index 74c76f37..9201555 100644
|
| +--- a/third_party/sqlite/src/src/pager.c
|
| ++++ b/third_party/sqlite/src/src/pager.c
|
| +@@ -3991,7 +3991,7 @@ static void pagerFreeMapHdrs(Pager *pPager){
|
| + ** a hot journal may be left in the filesystem but no error is returned
|
| + ** to the caller.
|
| + */
|
| +-int sqlite3PagerClose(Pager *pPager){
|
| ++int sqlite3PagerClose(Pager *pPager, sqlite3 *db){
|
| + u8 *pTmp = (u8 *)pPager->pTmpSpace;
|
| +
|
| + assert( assert_pager_state(pPager) );
|
| +@@ -4001,7 +4001,9 @@ int sqlite3PagerClose(Pager *pPager){
|
| + /* pPager->errCode = 0; */
|
| + pPager->exclusiveMode = 0;
|
| + #ifndef SQLITE_OMIT_WAL
|
| +- sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);
|
| ++ sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize,
|
| ++ (db && (db->flags & SQLITE_NoCkptOnClose) ? 0 : pTmp)
|
| ++ );
|
| + pPager->pWal = 0;
|
| + #endif
|
| + pager_reset(pPager);
|
| +diff --git a/third_party/sqlite/src/src/pager.h b/third_party/sqlite/src/src/pager.h
|
| +index 3552a87..1f5a584 100644
|
| +--- a/third_party/sqlite/src/src/pager.h
|
| ++++ b/third_party/sqlite/src/src/pager.h
|
| +@@ -112,7 +112,7 @@ int sqlite3PagerOpen(
|
| + int,
|
| + void(*)(DbPage*)
|
| + );
|
| +-int sqlite3PagerClose(Pager *pPager);
|
| ++int sqlite3PagerClose(Pager *pPager, sqlite3*);
|
| + int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
|
| +
|
| + /* Functions used to configure a Pager object. */
|
| +diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src/sqlite.h.in
|
| +index e5673fd..33334d3 100644
|
| +--- a/third_party/sqlite/src/src/sqlite.h.in
|
| ++++ b/third_party/sqlite/src/src/sqlite.h.in
|
| +@@ -1904,11 +1904,24 @@ struct sqlite3_mem_methods {
|
| + ** following this call. The second parameter may be a NULL pointer, in
|
| + ** which case the trigger setting is not reported back. </dd>
|
| + **
|
| ++** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
|
| ++** <dd> Usually, when a database in wal mode is closed or detached from a
|
| ++** database handle, SQLite checks if this will mean that there are now no
|
| ++** connections at all to the database. If so, it performs a checkpoint
|
| ++** operation before closing the connection. This option may be used to
|
| ++** override this behaviour. The first parameter passed to this operation
|
| ++** is an integer - non-zero to disable checkpoints-on-close, or zero (the
|
| ++** default) to enable them. The second parameter is a pointer to an integer
|
| ++** into which is written 0 or 1 to indicate whether checkpoints-on-close
|
| ++** have been disabled - 0 if they are not disabled, 1 if they are.
|
| ++** </dd>
|
| ++**
|
| + ** </dl>
|
| + */
|
| + #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
| + #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
|
| + #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
|
| ++#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
|
| +
|
| +
|
| + /*
|
| +diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
|
| +index 745b910..3b8b7d0 100644
|
| +--- a/third_party/sqlite/src/src/sqliteInt.h
|
| ++++ b/third_party/sqlite/src/src/sqliteInt.h
|
| +@@ -1305,6 +1305,7 @@ struct sqlite3 {
|
| + #define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */
|
| + #define SQLITE_Vacuum 0x08000000 /* Currently in a VACUUM */
|
| + #define SQLITE_CellSizeCk 0x10000000 /* Check btree cell sizes on load */
|
| ++#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */
|
| +
|
| +
|
| + /*
|
| +--
|
| +2.8.2
|
| +
|
|
|