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

Side by Side Diff: third_party/sqlite/patches/0006-Virtual-table-supporting-recovery-of-corrupted-datab.patch

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
OLDNEW
1 From dc2d5db3e20e8aa8f3f34640b605dfa88576c19c Mon Sep 17 00:00:00 2001 1 From 13a64d3c7fb541be8cb753c575837c1b84f5d9fd Mon Sep 17 00:00:00 2001
2 From: Scott Hess <shess@chromium.org> 2 From: Scott Hess <shess@chromium.org>
3 Date: Sat, 20 Jul 2013 11:42:21 -0700 3 Date: Sat, 20 Jul 2013 11:42:21 -0700
4 Subject: [PATCH 08/23] Virtual table supporting recovery of corrupted 4 Subject: [PATCH 06/16] Virtual table supporting recovery of corrupted
5 databases. 5 databases.
6 6
7 "recover" implements a virtual table which uses the SQLite pager layer 7 "recover" implements a virtual table which uses the SQLite pager layer
8 to read table pages and pull out the data which is structurally sound 8 to read table pages and pull out the data which is structurally sound
9 (at least at the storage layer). 9 (at least at the storage layer).
10 10
11 BUG=109482 11 BUG=109482
12 12
13 Since this implements a new feature for SQLite, the review URLs aren't 13 Since this implements a new feature for SQLite, the review URLs aren't
14 listed. This patch and the top of recover.c should be considered 14 listed. This patch and the top of recover.c should be considered
(...skipping 12 matching lines...) Expand all
27 third_party/sqlite/src/test/recover2.test | 157 ++ 27 third_party/sqlite/src/test/recover2.test | 157 ++
28 third_party/sqlite/src/tool/mksqlite3c.tcl | 2 + 28 third_party/sqlite/src/tool/mksqlite3c.tcl | 2 +
29 11 files changed, 3458 insertions(+), 1 deletion(-) 29 11 files changed, 3458 insertions(+), 1 deletion(-)
30 create mode 100644 third_party/sqlite/src/src/recover.c 30 create mode 100644 third_party/sqlite/src/src/recover.c
31 create mode 100644 third_party/sqlite/src/test/recover.test 31 create mode 100644 third_party/sqlite/src/test/recover.test
32 create mode 100644 third_party/sqlite/src/test/recover0.test 32 create mode 100644 third_party/sqlite/src/test/recover0.test
33 create mode 100644 third_party/sqlite/src/test/recover1.test 33 create mode 100644 third_party/sqlite/src/test/recover1.test
34 create mode 100644 third_party/sqlite/src/test/recover2.test 34 create mode 100644 third_party/sqlite/src/test/recover2.test
35 35
36 diff --git a/third_party/sqlite/src/Makefile.in b/third_party/sqlite/src/Makefil e.in 36 diff --git a/third_party/sqlite/src/Makefile.in b/third_party/sqlite/src/Makefil e.in
37 index f3239f3..216742c 100644 37 index a2213e8..1389486 100644
38 --- a/third_party/sqlite/src/Makefile.in 38 --- a/third_party/sqlite/src/Makefile.in
39 +++ b/third_party/sqlite/src/Makefile.in 39 +++ b/third_party/sqlite/src/Makefile.in
40 @@ -251,6 +251,7 @@ SRC = \ 40 @@ -253,6 +253,7 @@ SRC = \
41 $(TOP)/src/prepare.c \ 41 $(TOP)/src/prepare.c \
42 $(TOP)/src/printf.c \ 42 $(TOP)/src/printf.c \
43 $(TOP)/src/random.c \ 43 $(TOP)/src/random.c \
44 + $(TOP)/src/recover.c \ 44 + $(TOP)/src/recover.c \
45 $(TOP)/src/resolve.c \ 45 $(TOP)/src/resolve.c \
46 $(TOP)/src/rowset.c \ 46 $(TOP)/src/rowset.c \
47 $(TOP)/src/select.c \ 47 $(TOP)/src/select.c \
48 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc 48 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc
49 index 554bf56..e631816 100644 49 index 554bf56..e631816 100644
50 --- a/third_party/sqlite/src/Makefile.linux-gcc 50 --- a/third_party/sqlite/src/Makefile.linux-gcc
51 +++ b/third_party/sqlite/src/Makefile.linux-gcc 51 +++ b/third_party/sqlite/src/Makefile.linux-gcc
52 @@ -82,6 +82,10 @@ OPTS += -DSQLITE_MEMDEBUG=1 52 @@ -82,6 +82,10 @@ OPTS += -DSQLITE_MEMDEBUG=1
53 # TODO(shess) I can't see why I need this setting. 53 # TODO(shess) I can't see why I need this setting.
54 OPTS += -DOS_UNIX=1 54 OPTS += -DOS_UNIX=1
55 55
56 +# The recover virtual table is not generally enabled. Enable it for testing 56 +# The recover virtual table is not generally enabled. Enable it for testing
57 +# purposes. 57 +# purposes.
58 +OPTS += -DDEFAULT_ENABLE_RECOVER=1 58 +OPTS += -DDEFAULT_ENABLE_RECOVER=1
59 + 59 +
60 #### The suffix to add to executable files. ".exe" for windows. 60 #### The suffix to add to executable files. ".exe" for windows.
61 # Nothing for unix. 61 # Nothing for unix.
62 # 62 #
63 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk 63 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
64 index b0aa4b2..65dd690 100644 64 index dc56b0d..2189fd6 100644
65 --- a/third_party/sqlite/src/main.mk 65 --- a/third_party/sqlite/src/main.mk
66 +++ b/third_party/sqlite/src/main.mk 66 +++ b/third_party/sqlite/src/main.mk
67 @@ -62,7 +62,7 @@ LIBOBJ+= alter.o analyze.o attach.o auth.o \ 67 @@ -65,7 +65,7 @@ LIBOBJ+= vdbe.o parse.o \
68 mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \ 68 mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
69 notify.o opcodes.o os.o os_os2.o os_unix.o os_win.o \ 69 notify.o opcodes.o os.o os_unix.o os_win.o \
70 pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \ 70 pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
71 - random.o resolve.o rowset.o rtree.o select.o status.o \ 71 - random.o resolve.o rowset.o rtree.o select.o status.o \
72 + random.o recover.o resolve.o rowset.o rtree.o select.o status.o \ 72 + random.o recover.o resolve.o rowset.o rtree.o select.o status.o \
73 table.o tokenize.o trigger.o \ 73 table.o threads.o tokenize.o trigger.o \
74 update.o util.o vacuum.o \ 74 update.o userauth.o util.o vacuum.o \
75 vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbetrace.o \ 75 vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
76 @@ -132,6 +132,7 @@ SRC = \ 76 @@ -135,6 +135,7 @@ SRC = \
77 $(TOP)/src/prepare.c \ 77 $(TOP)/src/prepare.c \
78 $(TOP)/src/printf.c \ 78 $(TOP)/src/printf.c \
79 $(TOP)/src/random.c \ 79 $(TOP)/src/random.c \
80 + $(TOP)/src/recover.c \ 80 + $(TOP)/src/recover.c \
81 $(TOP)/src/resolve.c \ 81 $(TOP)/src/resolve.c \
82 $(TOP)/src/rowset.c \ 82 $(TOP)/src/rowset.c \
83 $(TOP)/src/select.c \ 83 $(TOP)/src/select.c \
84 @@ -284,6 +285,7 @@ TESTSRC2 = \ 84 @@ -315,6 +316,7 @@ TESTSRC2 = \
85 $(TOP)/src/prepare.c \ 85 $(TOP)/src/prepare.c \
86 $(TOP)/src/printf.c \ 86 $(TOP)/src/printf.c \
87 $(TOP)/src/random.c \ 87 $(TOP)/src/random.c \
88 + $(TOP)/src/recover.c \ 88 + $(TOP)/src/recover.c \
89 $(TOP)/src/pcache.c \ 89 $(TOP)/src/pcache.c \
90 $(TOP)/src/pcache1.c \ 90 $(TOP)/src/pcache1.c \
91 $(TOP)/src/select.c \ 91 $(TOP)/src/select.c \
92 diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main .c 92 diff --git a/third_party/sqlite/src/src/main.c b/third_party/sqlite/src/src/main .c
93 index 4aaa618..696de1c 100644 93 index fc03700..d15ab9bb 100644
94 --- a/third_party/sqlite/src/src/main.c 94 --- a/third_party/sqlite/src/src/main.c
95 +++ b/third_party/sqlite/src/src/main.c 95 +++ b/third_party/sqlite/src/src/main.c
96 @@ -1996,6 +1996,14 @@ static int openDatabase( 96 @@ -2644,6 +2644,14 @@ static int openDatabase(
97 } 97 }
98 #endif 98 #endif
99 99
100 +#ifdef DEFAULT_ENABLE_RECOVER 100 +#ifdef DEFAULT_ENABLE_RECOVER
101 + /* Initialize recover virtual table for testing. */ 101 + /* Initialize recover virtual table for testing. */
102 + extern int recoverVtableInit(sqlite3 *db); 102 + extern int recoverVtableInit(sqlite3 *db);
103 + if( !db->mallocFailed && rc==SQLITE_OK ){ 103 + if( !db->mallocFailed && rc==SQLITE_OK ){
104 + rc = recoverVtableInit(db); 104 + rc = recoverVtableInit(db);
105 + } 105 + }
106 +#endif 106 +#endif
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 + sqlite3_free(zCreateSql); 2272 + sqlite3_free(zCreateSql);
2273 + if( rc!=SQLITE_OK ){ 2273 + if( rc!=SQLITE_OK ){
2274 + recoverRelease(pRecover); 2274 + recoverRelease(pRecover);
2275 + return rc; 2275 + return rc;
2276 + } 2276 + }
2277 + 2277 +
2278 + *ppVtab = (sqlite3_vtab *)pRecover; 2278 + *ppVtab = (sqlite3_vtab *)pRecover;
2279 + return SQLITE_OK; 2279 + return SQLITE_OK;
2280 +} 2280 +}
2281 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src /sqlite.h.in 2281 diff --git a/third_party/sqlite/src/src/sqlite.h.in b/third_party/sqlite/src/src /sqlite.h.in
2282 index ec7e502..00c8510 100644 2282 index f1d4e40..28b5ef1 100644
2283 --- a/third_party/sqlite/src/src/sqlite.h.in 2283 --- a/third_party/sqlite/src/src/sqlite.h.in
2284 +++ b/third_party/sqlite/src/src/sqlite.h.in 2284 +++ b/third_party/sqlite/src/src/sqlite.h.in
2285 @@ -6388,6 +6388,17 @@ int sqlite3_wal_checkpoint_v2( 2285 @@ -7408,6 +7408,17 @@ int sqlite3_vtab_on_conflict(sqlite3 *);
2286 #define SQLITE_CHECKPOINT_RESTART 2 2286
2287 2287
2288 2288
2289 +/* Begin recover.patch for Chromium */ 2289 +/* Begin recover.patch for Chromium */
2290 +/* 2290 +/*
2291 +** Call to initialize the recover virtual-table modules (see recover.c). 2291 +** Call to initialize the recover virtual-table modules (see recover.c).
2292 +** 2292 +**
2293 +** This could be loaded by default in main.c, but that would make the 2293 +** This could be loaded by default in main.c, but that would make the
2294 +** virtual table available to Web SQL. Breaking it out allows only 2294 +** virtual table available to Web SQL. Breaking it out allows only
2295 +** selected users to enable it (currently sql/recovery.cc). 2295 +** selected users to enable it (currently sql/recovery.cc).
2296 +*/ 2296 +*/
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
3583 + 3583 +
3584 + execsql { 3584 + execsql {
3585 + PRAGMA page_count; 3585 + PRAGMA page_count;
3586 + PRAGMA page_size; 3586 + PRAGMA page_size;
3587 + SELECT rowid, TYPEOF(value), length(value), value FROM overflow_recover; 3587 + SELECT rowid, TYPEOF(value), length(value), value FROM overflow_recover;
3588 + } 3588 + }
3589 +} [list 4 1024 1 text [string length $substr] $substr] 3589 +} [list 4 1024 1 text [string length $substr] $substr]
3590 + 3590 +
3591 +finish_test 3591 +finish_test
3592 diff --git a/third_party/sqlite/src/tool/mksqlite3c.tcl b/third_party/sqlite/src /tool/mksqlite3c.tcl 3592 diff --git a/third_party/sqlite/src/tool/mksqlite3c.tcl b/third_party/sqlite/src /tool/mksqlite3c.tcl
3593 index fa99f2d..df2df07 100644 3593 index 0e97923..9e2b0fe 100644
3594 --- a/third_party/sqlite/src/tool/mksqlite3c.tcl 3594 --- a/third_party/sqlite/src/tool/mksqlite3c.tcl
3595 +++ b/third_party/sqlite/src/tool/mksqlite3c.tcl 3595 +++ b/third_party/sqlite/src/tool/mksqlite3c.tcl
3596 @@ -293,6 +293,8 @@ foreach file { 3596 @@ -316,6 +316,8 @@ foreach file {
3597 main.c 3597 main.c
3598 notify.c 3598 notify.c
3599 3599
3600 + recover.c 3600 + recover.c
3601 + 3601 +
3602 fts3.c 3602 fts3.c
3603 fts3_aux.c 3603 fts3_aux.c
3604 fts3_expr.c 3604 fts3_expr.c
3605 -- 3605 --
3606 2.2.1 3606 2.2.1
3607 3607
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698