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

Side by Side Diff: third_party/sqlite/patches/0015-backport-Config-database-to-not-checkpoint-WAL-on-cl.patch

Issue 2587603003: [sql] Patch SQLite to allow control of close-time WAL checkpoint. (Closed)
Patch Set: fix UsesUsleep comment from trybot results Created 4 years 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
« no previous file with comments | « third_party/sqlite/amalgamation/sqlite3.c ('k') | third_party/sqlite/src/src/btree.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 From e5ba7652d3d8a1769955a579d84edbe5595d5e2b Mon Sep 17 00:00:00 2001
2 From: Scott Hess <shess@chromium.org>
3 Date: Fri, 16 Dec 2016 15:25:50 -0800
4 Subject: [PATCH 15/15] [backport] Config database to not checkpoint WAL on
5 close.
6
7 SQLite check-in https://www.sqlite.org/src/info/6d142025c74f66f2
8 [With mods through pending 3.16.0.]
9
10 "Add the SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE sqlite3_dbconfig() option -
11 for disabling SQLite's default checkpoint-on-close behaviour."
12
13 BUG=675264
14 ---
15 third_party/sqlite/src/src/btree.c | 4 ++--
16 third_party/sqlite/src/src/main.c | 1 +
17 third_party/sqlite/src/src/pager.c | 6 ++++--
18 third_party/sqlite/src/src/pager.h | 2 +-
19 third_party/sqlite/src/src/sqlite.h.in | 13 +++++++++++++
20 third_party/sqlite/src/src/sqliteInt.h | 1 +
21 6 files changed, 22 insertions(+), 5 deletions(-)
22
23 diff --git a/third_party/sqlite/src/src/btree.c b/third_party/sqlite/src/src/btr ee.c
24 index f5feff8a..f987388 100644
25 --- a/third_party/sqlite/src/src/btree.c
26 +++ b/third_party/sqlite/src/src/btree.c
27 @@ -2390,7 +2390,7 @@ int sqlite3BtreeOpen(
28 btree_open_out:
29 if( rc!=SQLITE_OK ){
30 if( pBt && pBt->pPager ){
31 - sqlite3PagerClose(pBt->pPager);
32 + sqlite3PagerClose(pBt->pPager, 0);
33 }
34 sqlite3_free(pBt);
35 sqlite3_free(p);
36 @@ -2531,7 +2531,7 @@ int sqlite3BtreeClose(Btree *p){
37 ** Clean out and delete the BtShared object.
38 */
39 assert( !pBt->pCursor );
40 - sqlite3PagerClose(pBt->pPager);
41 + sqlite3PagerClose(pBt->pPager, p->db);
42 if( pBt->xFreeSchema && pBt->pSchema ){
43 pBt->xFreeSchema(pBt->pSchema);
44 }
45 diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main .c
46 index 301808c..78181cd 100644
47 --- a/third_party/sqlite/src/src/main.c
48 +++ b/third_party/sqlite/src/src/main.c
49 @@ -799,6 +799,7 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
50 } aFlagOp[] = {
51 { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys },
52 { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger },
53 + { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose },
54 };
55 unsigned int i;
56 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
57 diff --git a/third_party/sqlite/src/src/pager.c b/third_party/sqlite/src/src/pag er.c
58 index 74c76f37..9201555 100644
59 --- a/third_party/sqlite/src/src/pager.c
60 +++ b/third_party/sqlite/src/src/pager.c
61 @@ -3991,7 +3991,7 @@ static void pagerFreeMapHdrs(Pager *pPager){
62 ** a hot journal may be left in the filesystem but no error is returned
63 ** to the caller.
64 */
65 -int sqlite3PagerClose(Pager *pPager){
66 +int sqlite3PagerClose(Pager *pPager, sqlite3 *db){
67 u8 *pTmp = (u8 *)pPager->pTmpSpace;
68
69 assert( assert_pager_state(pPager) );
70 @@ -4001,7 +4001,9 @@ int sqlite3PagerClose(Pager *pPager){
71 /* pPager->errCode = 0; */
72 pPager->exclusiveMode = 0;
73 #ifndef SQLITE_OMIT_WAL
74 - sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);
75 + sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize,
76 + (db && (db->flags & SQLITE_NoCkptOnClose) ? 0 : pTmp)
77 + );
78 pPager->pWal = 0;
79 #endif
80 pager_reset(pPager);
81 diff --git a/third_party/sqlite/src/src/pager.h b/third_party/sqlite/src/src/pag er.h
82 index 3552a87..1f5a584 100644
83 --- a/third_party/sqlite/src/src/pager.h
84 +++ b/third_party/sqlite/src/src/pager.h
85 @@ -112,7 +112,7 @@ int sqlite3PagerOpen(
86 int,
87 void(*)(DbPage*)
88 );
89 -int sqlite3PagerClose(Pager *pPager);
90 +int sqlite3PagerClose(Pager *pPager, sqlite3*);
91 int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
92
93 /* Functions used to configure a Pager object. */
94 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src /sqlite.h.in
95 index e5673fd..33334d3 100644
96 --- a/third_party/sqlite/src/src/sqlite.h.in
97 +++ b/third_party/sqlite/src/src/sqlite.h.in
98 @@ -1904,11 +1904,24 @@ struct sqlite3_mem_methods {
99 ** following this call. The second parameter may be a NULL pointer, in
100 ** which case the trigger setting is not reported back. </dd>
101 **
102 +** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
103 +** <dd> Usually, when a database in wal mode is closed or detached from a
104 +** database handle, SQLite checks if this will mean that there are now no
105 +** connections at all to the database. If so, it performs a checkpoint
106 +** operation before closing the connection. This option may be used to
107 +** override this behaviour. The first parameter passed to this operation
108 +** is an integer - non-zero to disable checkpoints-on-close, or zero (the
109 +** default) to enable them. The second parameter is a pointer to an integer
110 +** into which is written 0 or 1 to indicate whether checkpoints-on-close
111 +** have been disabled - 0 if they are not disabled, 1 if they are.
112 +** </dd>
113 +**
114 ** </dl>
115 */
116 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
117 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
118 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
119 +#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
120
121
122 /*
123 diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src /sqliteInt.h
124 index 745b910..3b8b7d0 100644
125 --- a/third_party/sqlite/src/src/sqliteInt.h
126 +++ b/third_party/sqlite/src/src/sqliteInt.h
127 @@ -1305,6 +1305,7 @@ struct sqlite3 {
128 #define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */
129 #define SQLITE_Vacuum 0x08000000 /* Currently in a VACUUM */
130 #define SQLITE_CellSizeCk 0x10000000 /* Check btree cell sizes on load */
131 +#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */
132
133
134 /*
135 --
136 2.8.2
137
OLDNEW
« no previous file with comments | « third_party/sqlite/amalgamation/sqlite3.c ('k') | third_party/sqlite/src/src/btree.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698