Commit Graph

97 Commits

Author SHA1 Message Date
drh
4098aa5d19 Add an assert() to fix a harmless compiler warning in the recovery
extension.

FossilOrigin-Name: 2502339339f3c831966479a400c2b1a531fb4d990b1776b4dc4870cf734c3fcd
2024-08-10 09:56:36 +00:00
stephan
5529ec74da Move a misplaced va_end, as reported in [forum:702c79e9da|forum post 702c79e9da].
FossilOrigin-Name: daa25fb35fd7bdd482d51214439f38b0b9a7df93f689a2b3d30a113daa9f2a1a
2024-08-08 10:51:56 +00:00
drh
780187f090 Get rid of "-encoding binary" across all test cases, as that is no longer
supported in Tcl9.  Use "-translation binary" instead.

FossilOrigin-Name: e0d9670dd98a22d2e22aac8ba8720787a05e280e18ec9b2d4323f947c83718f5
2024-07-30 17:09:51 +00:00
drh
064b681e9b First attempt at getting the build to work with Tcl 9.0.
FossilOrigin-Name: 6e5bb48a74d63fb8c30528f0005d1763cd2dbb882abf86baf1565721e6bfcf84
2024-07-30 15:49:02 +00:00
dan
3731703dbb Ensure an sqlite_dbdata cursor is properly reset before being used again, even if it has already encountered database corruption.
FossilOrigin-Name: 3210e1ca4d0efedf9710c97abd050ba10d3af98cb1f029c26daa84daf42fbc7e
2024-05-21 17:37:50 +00:00
dan
f765aec406 Do not run the tests in recovercorrupt4.test with the inmemory_journal permutation.
FossilOrigin-Name: c13205d66b8406cccfc937c88ac515fa758fe2ade8b3d30f0c1e79fe974e9600
2024-05-20 19:51:06 +00:00
dan
9a1a4822e8 If there is no data available for a field in a corrupted record, but the type is available, have the recovery extension substitute 0, 0.0, '' or X'' instead of a NULL value.
FossilOrigin-Name: 8eb326c24981647e2df90e4b9d75db52a552bd997bd821f5898c7ff3fb93a57d
2024-05-15 15:06:27 +00:00
dan
01508c814c Fix a case where the recovery extension might write uninitialized data to the recovered database.
FossilOrigin-Name: 8519b4d0393ed17eed06bceffbc891fe8cae0bc1d466a79eba0602ef46b07c56
2024-05-02 17:46:52 +00:00
dan
2ad1e92858 Fix another problem in the recovery extension where a corrupt sqlite_schema table could lead to excessive memory consumption.
FossilOrigin-Name: 1c7e33a8aa0e6122b5ef606e4a7d95e8ecd9440216d4b099fe8f2a40653422be
2024-05-01 16:25:46 +00:00
dan
19ca99eea4 Fix a problem causing the recovery extension to use excessive memory and CPU time in some cases.
FossilOrigin-Name: 8de85170d53e1d2a2abe14508a222377b9493e25f3174b8f0f773427deb8df26
2024-05-01 14:42:20 +00:00
dan
73a50fa42c Avoid some performance problems in the recover extension when recovering strategically corrupted databases.
FossilOrigin-Name: e66a834bbab9d71e02b70588ad4c71eae2e13b50e299b0269d488402bc4a7fc5
2024-04-09 15:09:54 +00:00
mistachkin
3ab9c021ff Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: e52c87420b072fa68d921eda66069542d50accbfaf1110ac4cc1543a4162200d
2024-02-04 04:01:11 +00:00
drh
ed088f5f8d In the recovery extension, if a payload size is unreasonably large, it is
probably corrupt, so truncate it.

FossilOrigin-Name: 988c3179e978a3a6d42541e9c7a2ab98150383671810926503376ed808f150ff
2023-11-29 13:47:46 +00:00
drh
1935887a68 Ensure that all fields of static sqlite3_module objects are explicitly
initialized, in order to hush-up nuisance compiler warnings.

FossilOrigin-Name: f3b3d712d6e58b1cb8fdebd2b6b3125080b6b3ac8c7c849a8cc1e5e778d62fe7
2023-10-06 12:51:05 +00:00
dan
6e4ff8707e Remove SQLITE_EXTENSION_INIT macros from dbdata.c.
FossilOrigin-Name: 106ec745766ac59131f975d5ab5487c8a24b9c3be1766411c018b42c6ae4672a
2023-06-08 20:49:25 +00:00
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
3195b88b79 Fix a buffer overread in the recovery extension that might occur on 32-bit platforms.
FossilOrigin-Name: ff4a9a2b59657116da99c748ada19dbc64b7d0fd4c920e1c517d8bda3466f06b
2023-05-23 14:05:02 +00:00
dan
9d31508a54 Add test cases for the recovery extension. No changes to code.
FossilOrigin-Name: cec49c7d93362f527f0b4744cd1ae95d44a79671d49d69baa77fda70be29f7e8
2023-05-23 11:47:56 +00:00
dan
d9be387361 Fix recover1.test so that it works with DEFAULT_AUTOVACUUM builds.
FossilOrigin-Name: 4ffae48e831eedf8f5e61dc6d38817c0fdccfb2f4f1189d07f9722b9e3a48b5e
2023-05-08 16:26:22 +00:00
dan
6d841fdc89 Add tests for recovering data to a lost-and-found table from a utf-16 db. No code changes.
FossilOrigin-Name: 832f6e9f797eecb9a3dae4e7e20c70eda1e91372e9d3ce4223d57f26582cdbd2
2023-05-08 10:51:35 +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
dan
95dc3e08bd Update test script recoverbuild.test so that it may be run using old test harnesses that run more than one test script in a process.
FossilOrigin-Name: 5135aab0c0ab39f3b9cc84efbbc57f7266b42d98134fc0c5dace06f707374195
2023-04-14 13:34:26 +00:00
drh
0669d6ebbf Add the SQLITE_VTAB_USES_ALL_SCHEMAS option to sqlite3_vtab_config(). Update
the sqlite_dbpage, sqlite_dbdata, and sqlite_dbptr virtual tables to make
use of that interface.  This was formerly handled by the internal
sqlite3VtabUsesAllSchemas() routine that was called directly from sqlite_dbpage.
But since sqlite_dbdata and sqlite_dbptr are an extension, an external
interface to that functionality had to be provided.
dbsqlfuzz 1a29c245175a63393b6a78c5b8cab5199939d6a8

FossilOrigin-Name: bcd51abee0b0f82bb5dbb881025a92d55baf9df6adeaf3a305e2e0da96a81d58
2023-04-03 15:01:37 +00:00
dan
66086eb6a6 Fix a potential buffer overread in the recovery extension.
FossilOrigin-Name: 0b3b5bf9597615589a1d045aaa697c13550553ee4fe4b9008a8e51415b6fe96a
2023-03-17 14:18:39 +00:00
dan
eb5d71ed58 Fix a broken assert() in the recovery extension.
FossilOrigin-Name: 4c4e66f293d7768cceb875a936ca0f4cd910473e20b9910698cc1e1ce221a7d4
2023-03-15 13:53:47 +00:00
dan
b211a4b391 Improve the error message generated by the recovery extension if it is used with a non-SQLITE_ENABLE_DBPAGE_VTAB build.
FossilOrigin-Name: c1f2a1d55c180fb51a4e203befbbe529bdd23137b26190c50b8f85820450e7fa
2023-02-28 11:02:02 +00:00
dan
986c22a6d0 Update testrunner.tcl to use a separate process for each test script. And to run some extra tests too.
FossilOrigin-Name: d090948a69a9c4b86693bd3caedba3d7e5883e4b2ad1f2d4bf7ae14c105ddea7
2023-02-01 20:14:59 +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
ea038d3d23 Additional defense against corrupt database files in dbdata.c.
FossilOrigin-Name: 2e70d1e5c9b2c9e068be3ccf8a6062edf7bdde2e46d60ba8ce54eda851af6008
2022-11-09 11:02:39 +00:00
drh
92c0881d9d Increase the precision of the nData parameter to the dbdataValue() routine
inside the sqlite_dbdata virtual table, to avoid the possibility of integer
overflow.

FossilOrigin-Name: 295447b44fc7658891352a9b3f792379b52a76ee5dcfd498b7028f5f87b40e9e
2022-11-09 10:17:25 +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
a16edfa29b Tweaks to recover module test scripts to work with various permutations.
FossilOrigin-Name: 454c61e818f6941c9a23f6600e37828a3f2b2ad3c6dbc8d6223570aed5d9cd8b
2022-11-04 18:32:45 +00:00
dan
5f7e173abf Another test case fix for auto-vacuum builds.
FossilOrigin-Name: c1c47eff48e0831b5aed987e90d797aee99caf1861fa8318c6c3ecfb108de7e6
2022-11-04 17:07:33 +00:00
dan
80dbd818f2 Fixes to recover module test scripts so that they may be used with SQLITE_DEFAULT_AUTOVACUUM and SQLITE_SECURE_DELETE builds.
FossilOrigin-Name: 0e5597ce5353dea2cdb092b166b57ba1d60f8115eb468349f2b2869803691a2c
2022-11-04 16:39:39 +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
12de518db4 Minor improvements to API documentation in comments for the recovery
extension.

FossilOrigin-Name: ed1c3515ad6a988e07a8b4583fbc38be257e6eae7443b01a242b98207ce78162
2022-11-02 13:09:14 +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
drh
c97bb14fab Fix a minor problem with sqlite_dbdata.
FossilOrigin-Name: 58c2e49279c8f77f006b0c2ce351776bc711633f9c1a39c7a37969838d49ec0b
2022-10-27 23:17:49 +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