Commit Graph

57 Commits

Author SHA1 Message Date
dan
d8091fe979 Fix a problem causing an infinite loop in the recovery extension when processing a corrupt free-block list.
FossilOrigin-Name: 5a516c6c7a25cec4d0a0cca530017a3299f7a332319f3e1f7cf12f53c32b88ca
2023-05-31 11:03:17 +00:00
dan
9549245509 Fix a broken assert() in the recovery extension. [forum:/forumpost/82a88f5812|Forum post 82a88f5812].
FossilOrigin-Name: 8a1ad137606ce5bddbed62f89ff9a5cd922c6530db84c12b8b27c08df3c66bc6
2023-04-20 10:26:56 +00:00
drh
3547e4997f Fix lots of harmless, nuisance compiler warnings, mostly unused parameter
warnings in extensions.

FossilOrigin-Name: c14bbe1606c1450b709970f922b94a641dfc8f9bd09126501d7dc4db99ea4772
2022-12-23 14:49:24 +00:00
dan
1b3d13e65e Add the SQLITE_FCNTL_RESET_CACHE verb. Use it to ensure that the page cache is purged before and after a the recovery extension is run.
FossilOrigin-Name: 6db0bc4bc0d272b610bef2aeeae43f539ed6e7cc0a9cc767d5af85ecb0019d5f
2022-11-28 18:41:41 +00:00
drh
b36f697b50 Make sure that the recoverStrlen() function (used internally by the new
recovery extension) is 64-bit safe.

FossilOrigin-Name: ea30a6bfc463acce26a4d710e7bf56519ad096ce2fe904ee7e199f5c55068034
2022-11-07 11:05:53 +00:00
drh
b819202acf The recoverAssertMutexHeld() function is for testing and verification only
and should be a harmless no-op for production builds.
[forum/forumpost/b4f2c7d402|Forum post b4f2c7d402].

FossilOrigin-Name: d75504710c86af0037ac897106aadffe54955463195ee4dfb2cdfc81d396cbb4
2022-11-06 17:19:34 +00:00
dan
ffc9b1b046 Fix Tcl tests so that they again build and run with SQLITE_OMIT_VIRTUALTABLE defined.
FossilOrigin-Name: 06a9dbea40c8a0cdfae6b127a1ce1cba0547acdf1115c087e9b790a78c264b52
2022-11-04 15:17:14 +00:00
drh
2cdcc7f01a Clarify documentation regarding the --recovery-db option to ".recover" and
the magic 789 configuration option it is associated with.

FossilOrigin-Name: f6fa0cffa921ccde8910e7fa4a63c2e4ef8ddb376c8ce99e436b27ac332c4498
2022-11-02 14:08:26 +00:00
drh
faff0410dc Emcc seems confused by SQLITE_DEBUG, for reasons unknown. Use NDEBUG instead
to simplify the #ifdef logic in sqlite3recover.c.

FossilOrigin-Name: 2610779ac84ac4a1a6901b6244653faf0c49ac6f0a4710a19aaf2a13106ae742
2022-11-02 11:25:33 +00:00
stephan
f170b97985 Fix a missing symbol in non-SQLITE_DEBUG builds.
FossilOrigin-Name: 17cdcad627205cdc8ae8114df44ad2a44e59603200efb238fbbb5c30ea0a453e
2022-11-02 08:10:22 +00:00
drh
b9f8ff0e8f Fix a harmless compiler warning.
FossilOrigin-Name: 663a89164fdd43529a13cab4b9d9f04fe519e7c6b954f9c91e32e4d7ae25eb46
2022-11-01 21:42:50 +00:00
drh
6da7cc9b4c Fix harmless compiler warnings.
FossilOrigin-Name: de829770aa0f59b4cd3ab1dc5eec90be82663dca3199c2cf6d97f4c41ce9f799
2022-11-01 18:56:39 +00:00
mistachkin
11980a6b8e Fix compilation errors in the recover API seen with MSVC.
FossilOrigin-Name: 78d17c4fedc1629bf161f9858f2b8bf35506155ccaa0acc084b419d244d4f75d
2022-11-01 14:13:05 +00:00
dan
549907fd67 Avoid a segfault that could occur when running the recover API on a database handle with memory-mapping enabled.
FossilOrigin-Name: e02c697281a777c33070168af784b2d291397e488244a217620897f40aed7158
2022-10-31 10:53:23 +00:00
drh
053bb22f35 Fix harmless compiler warnings in testing code.
FossilOrigin-Name: 2f53612388507f9b1ecbec3c15281825beab54b8062d97d0ab6f009c5fed347b
2022-10-28 18:52:05 +00:00
dan
676d1cda92 Fix another crash in the recover extension triggered by a corrupt database.
FossilOrigin-Name: d125377378916fb3147612a536fde15ee955176eea9ea6eaa4a2ee5f1e8e1cbe
2022-10-27 20:27:45 +00:00
dan
10f5525410 Fix another problem to do with recovering from in-memory databases.
FossilOrigin-Name: 5a7bfd4a217cd80882a1827674b479cdc547419a785e06e0ee82cb8cfca42701
2022-10-27 19:06:42 +00:00
dan
ac16a4716b Ensure that the VFS wrapper in the recover extension does not attempt to invoke undefined methods on the underlying VFS.
FossilOrigin-Name: 347c575108bc8112613a02afda1247bdbed24c15def7eb412d0b27aba047715b
2022-10-27 19:02:51 +00:00
dan
48a4a4b73d Fix a problem with running ".recover" on an in-memory database.
FossilOrigin-Name: 87b4cca2b84845cee603d40fbf16c9635d6dc2d19d2f37ae86abfeff716c9a85
2022-10-27 11:12:54 +00:00
dan
21fd7ce098 Do not use sqlite3_mutex_xxx() functions in sqlite3recover.c when built with SQLITE_THREADSAFE=0.
FossilOrigin-Name: cd0aa27d1732abc61c8a8440118ff629f7dca185d2f515ce1f6090c49d8dc890
2022-10-27 10:51:49 +00:00
drh
07dd481010 Remove an unused variable from the recovery extension.
FossilOrigin-Name: a029dddff4f4ed7275538610cbd9cea658b905b72924860ec9cda9e76dabcfac
2022-10-26 20:12:46 +00:00
dan
50632afa6e Remove an undefined left-shift operation from the recover extension.
FossilOrigin-Name: a67082357a2cc348faf8236aafa7f39eb5cb673b1d114a594c6d5bb257f85b73
2022-10-26 18:29:19 +00:00
dan
f0799fdf6d Add missing comments and fix other code issues.
FossilOrigin-Name: 8ed4e4a80d8104d20b211a0b3e299abdb955cabdd36979bf6aae54266dc9778d
2022-10-15 18:26:30 +00:00
dan
3fa10f82f4 Handle recovering databases with reserved bytes at the end of each page.
FossilOrigin-Name: 52d0235ef3f21683daadf2343514f7b95a67c3589266f75c1e00e04f11dc6214
2022-10-14 15:46:19 +00:00
dan
249efd04d7 Add tests for detecting page size of databases.
FossilOrigin-Name: 31f9e2369fcf59032b7c4c9f5bfc85e7ef7c174003b0b9e2757dad5a4c79b370
2022-10-13 20:06:17 +00:00
dan
88a0637f57 Ensure the page-size, auto-vacuum and other settings are copied into the recovered database.
FossilOrigin-Name: 078520f2825bcb82d01b30209409e9bf8b6c99084c192345df41c9f531d08f51
2022-10-06 21:00:23 +00:00
dan
4df12ce5a8 Add code to determine the database page-size by searching for well-formed pages.
FossilOrigin-Name: 0dbd0ccef532e076fa82c9fad4dc9fe632c0ef43e3483cc288cbb7eca336a9b9
2022-10-06 17:20:12 +00:00
dan
adc686043e Improve handling of corruption in the sqlite_schema table b-tree structure.
FossilOrigin-Name: 2be0dba12fb9b98cd9632f1ff3f30aeb29661a2e121b68c2f3335617b027797b
2022-10-05 16:58:28 +00:00
dan
041cc06139 Better handling for databases with corrupt headers.
FossilOrigin-Name: 17f68d803685405d880025134c71bac01077962d677f2902a608952d0b9cdb5a
2022-10-04 19:43:12 +00:00
dan
7e33f8f43b Modify implementation of recovery to break recovery of the lost_and_found table into multiple steps.
FossilOrigin-Name: adedfd040bb2d1c2dcda0b91c6073f12953e45d9b860a8f217d990e861d66dfb
2022-09-26 20:51:16 +00:00
dan
8d8fc58413 Add the SQLITE_RECOVER_SLOWINDEXES option, for specifying that indexes should be created and populated along with tables, instead of separately at the end of the recovery operation.
FossilOrigin-Name: ad9dba9d1eae786575c7f31e34b342b6f5b26e719bbe27b61609cad8cfd0a505
2022-09-24 19:54:49 +00:00
dan
351563efe1 Add sqlite3_recover_step() to header file sqlite3recover.h. Update the API docs in this file.
FossilOrigin-Name: 47f416153035d6bf0ae27587583d2957c87c02caecbd4e7f363bcb2bc27cf159
2022-09-24 19:17:20 +00:00
dan
aee4049128 Update things to use sqlite3_recover_step() internally.
FossilOrigin-Name: f4b15aad3005237b7ac507eed2b9b07e0f5c9407ab28f2656a21c9845f13d35f
2022-09-24 18:05:52 +00:00
dan
9bbd91b39d Internal changes to the recover extension towards a step() style interface.
FossilOrigin-Name: 73926d5c8cd1ecece134b5a73b44ee1dfca74dc200606e3f009b06cdecf8cee9
2022-09-23 21:01:10 +00:00
dan
80b1f6fcde Fix various compiler warnings in new code on this branch.
FossilOrigin-Name: ae49e9efde3012158061def6e0a8d993abbc5933514a21f84bc10f700f61b5e2
2022-09-23 11:40:43 +00:00
dan
73390f09c2 Fix windows builds of recover extension.
FossilOrigin-Name: abcbb6abfe08fc590123f0aa1bd72cfdecc75908f078f1348dc0e957de98bf52
2022-09-15 03:54:52 +00:00
dan
3c24342841 Extra tests and fixes.
FossilOrigin-Name: deed5336931b23bb507c064d08e9899b33f04e4f7eee03beb8d7147eb4caa030
2022-09-14 18:57:46 +00:00
dan
a3a6d63b40 Fix a broken error handling case in the recovery extension.
FossilOrigin-Name: 60089547e1fc77ecc02f207ebf75ee3160e5ff25f41d12e02e170fd7fde66602
2022-09-13 19:47:01 +00:00
dan
7985e05a97 Add tests. Deal issues surrounding aborting recovery from within the SQL callback, and avoiding the pending-byte page.
FossilOrigin-Name: 4e97dd31f5240d9231167ae172a5116426c42177a1ed3c5422b9d51b762d5a87
2022-09-13 18:08:24 +00:00
dan
5ca0b38605 Fix some problems with handling corrupt database in the recovery extension.
FossilOrigin-Name: ed318be8241981ef96334ba13d3201a717cc812a59aed64e3dc67f7e7e71854b
2022-09-12 20:02:33 +00:00
dan
aede9b5bd3 More tests for the recover module.
FossilOrigin-Name: 37fb093b95c6b7d7ad07a275697df73b69f9fb5c5549aea8544b26e38f24833f
2022-09-12 19:23:50 +00:00
dan
65660916dc Rework recover extension code for readability.
FossilOrigin-Name: 1a2540960e40e3c8c622448fd3862e249bd463c29ae4ce5e39942e942533f60a
2022-09-10 20:01:49 +00:00
dan
bc2e7fc228 Further fixes to comments in sqlite3recover.h. Also rework some data structures in sqlite3recover.c.
FossilOrigin-Name: 599d1f8ec2f9e24924a6f9e66c85664360c7b95531b07a4efe1dd8c096b3fc99
2022-09-09 20:44:56 +00:00
dan
7920162093 Handle recovery of virtual tables by recovering each shadow table individually, then writing the CREATE VIRTUAL TABLE statement directly into the sqlite_schema table.
FossilOrigin-Name: 5f2d5ccd56c06c3468377126acfd4be39b79b05bb6fb09b674b2e185df143aa3
2022-09-09 16:25:19 +00:00
dan
46d4398440 Update comments in sqlite3recover.h.
FossilOrigin-Name: 14164047c43e3ca43aa010c77ea00dfa85400e15645ee0f5b90a677898b6a836
2022-09-08 21:43:18 +00:00
dan
9a27d65044 Update the shell to use the recover extension for the .recover command.
FossilOrigin-Name: ae832e77084eddd696c80cb926d070a5db9d45dce34156a02522b3140e8f5e8b
2022-09-08 19:22:29 +00:00
dan
3887ffe82a Fix problems with recovering the sqlite_sequence table.
FossilOrigin-Name: 356d2209ea5f6b69ce15b62027c63419c2d039e52f01c74a3810a6317abf4fb0
2022-09-08 17:42:33 +00:00
dan
abb28667f1 Ensure that the recover extension properly escapes CR and NL characters in text mode. Also that it holds transactions open on both input and output databases for the duration of a recovery operation.
FossilOrigin-Name: 6cca8913e703635ad89415a60fc84000ac188d9df43f45594b8ad87facb91d54
2022-09-07 16:41:33 +00:00
dan
497b3e6a11 Tests and a fix for the SQLITE_RECOVER_ROWIDS option.
FossilOrigin-Name: 1d5000f5718004110776ff58284d824854a93fe1cd1f6d8a4e8b8b0c2b2c3076
2022-09-06 19:38:06 +00:00
dan
108c51b6ae Fix a problem with script mode and lost-and-found tables.
FossilOrigin-Name: 09ec588d2fe24dd321e88318fe90a9ae912cbc73c8a2d59a10c821625dd12d9d
2022-09-05 21:22:35 +00:00