Commit Graph

27832 Commits

Author SHA1 Message Date
dan
645f21f15b Add the ".intck ?STEPS_PER_UNLOCK?" command to the shell tool.
FossilOrigin-Name: cfd051836b72f7d4e38cc9614f6ae5c003de4ce377359fd391adf06fe1ddf6b9
2024-02-23 18:21:51 +00:00
dan
5956d1d942 Fix detection of surplus index entries when all indexed fields are NULL.
FossilOrigin-Name: 5f310fb7be450c96f01c21e6fd1377d4a274784377d0bd811922ab63e612bd11
2024-02-23 17:10:39 +00:00
dan
1545243368 Fix problems with resuming integrity-check operations on indexes with mixed ASC and DESC columns, and on indexes that contain NULL values.
FossilOrigin-Name: 0f68b35a000ef9f4691c59797c66ed6c3435fc5c503e9d24f891afec6aceeada
2024-02-23 15:13:53 +00:00
dan
639db50a02 Fix various issues in sqlite3intck.c.
FossilOrigin-Name: 8a7bfa74525a495f45b1ea212b1718633b637295090d514dd777f9263477d514
2024-02-21 20:58:48 +00:00
dan
6a00f707e8 Simplify the way the restart key is saved internally by the intck extension.
FossilOrigin-Name: 0e39962baae8a82a3021077676b792ac30c79426bcd8c075b5e92bee55e8c3a5
2024-02-21 19:31:00 +00:00
dan
b783f56c58 Add documentation to ext/intck/sqlite3intck.h.
FossilOrigin-Name: 4cc19bd74f05fe92658cc392a1d1afa173d93181a77303af6bc5684436ae832e
2024-02-21 19:17:45 +00:00
dan
b2897c221d Ensure intck tests are run by testrunner.tcl.
FossilOrigin-Name: 11d6816c060b6edb9cd61f29297ab95e75e2b46f29c0a796820d94fc13586f6d
2024-02-21 16:15:50 +00:00
dan
ebd99d5708 Merge trunk changes into this branch.
FossilOrigin-Name: 63e8846ac1dc1cf1f7071c4634ccbfec3c13560db6afec376cd91515b62430d3
2024-02-21 16:12:23 +00:00
dan
eb715f022f Have the intck extension better handle corruption at the b-tree layer.
FossilOrigin-Name: ecd775d108f77d39a1303316c1e0f0b0ae3ffc5218222e1ebfe2ef6783829b85
2024-02-20 20:18:02 +00:00
dan
cfcb3b9208 Use fewer cycles to generate the "next key" value used by sqlite3_intck_suspend() function in the intck extension.
FossilOrigin-Name: 95f01426f948cf435d0b400dc7ae06fa699eee32cff498fe77e74a1257a4e09b
2024-02-20 18:17:06 +00:00
dan
626d619218 Consider using "=" and IS operators with even low-quality indexes in cases where they are selected explicitly using an INDEXED BY clause.
FossilOrigin-Name: 43cbbea82132db2d0ddb4f34cc2b6910b3a1243ae6d4e837b1b27bfe91b84834
2024-02-20 16:04:27 +00:00
drh
21eda699d7 Fixes to comments associated with the recent PRAGMA optimize enhancements.
No changes to code.

FossilOrigin-Name: 27a2113d78b35e324e9aedda7403c96c56ad0bed8c6b139fc5a179e8800b9109
2024-02-20 15:38:36 +00:00
drh
b468e68322 Remove an unreachable branch from printf(). Change it into an assert().
FossilOrigin-Name: 4c9886b692706723f4b68f58dfef07ab19b192fd19b953917f23b55655af3e02
2024-02-20 13:11:27 +00:00
drh
4b2eeb289b Remove an unused variable from the merge in the previous check-in.
FossilOrigin-Name: 5c26bf379e18e28d800525bd03e2d5597e2f37674979302f351b99abfc064749
2024-02-20 13:10:46 +00:00
drh
68d92c4ad3 Enhancements to PRAGMA optimize and ANALYZE. Add the 0x10000 flag to
PRAGMA optimize.  ANALYZE now records zero-size partial indexes in the
sqlite_stat1 table.  PRAGMA optimize looks for both growth and shrinkage
in table sizes, and uses tighter bounds (10x rather than 25x) to trigger
a re-analyze.  PRAGMA optimize automatically uses are reasonable
analysis_limit to prevent excessive runtimes.

FossilOrigin-Name: 63ef234e88857a653fa3541e80d59802ceccb806ac8296e8bae79a385b7086f7
2024-02-20 12:48:00 +00:00
drh
4189c44cff Another simplification of the PRAGMA optimize logic for improved coverage.
FossilOrigin-Name: 6c5a0c85454e3c658e51fab611c169c034447174022eebc52fd8619b528a4765
2024-02-20 12:14:07 +00:00
drh
ae71fa5d59 Minor fixes.
FossilOrigin-Name: ed5afebc410e3d430e2428d35f027bffb218e5f11036a42f97b080153e89016e
2024-02-19 23:58:26 +00:00
drh
a1507a3fa0 Fix a minor hiccup in the computation of the number of btrees to be scanned.
FossilOrigin-Name: 91302d9b2720d6b5184e1c24db55d351544adfde4b3d2ddcdc1561f79f11985a
2024-02-19 20:47:59 +00:00
dan
ebea8458e2 Use more efficient SQL to verify that indexes contain entries that match their tables.
FossilOrigin-Name: c01e008c28895e50b14531b2a1f3f1110aab3b54df41ebdbd416fbac7b1bba94
2024-02-19 20:15:44 +00:00
drh
9a28311b6a If there is no mention of a table in sqlite_stat1, use OP_Rewind to see if
the table is empty prior to invoking ANALYZE.

FossilOrigin-Name: 0cc93b19de597866292e0696f89fbd0e22a6cbb374678f5cc096fb889210fe3c
2024-02-19 20:12:30 +00:00
drh
74b0aad09f In PRAGMA optimize, scale back the analysis_limit when many different tables
and indexes must be scanned.

FossilOrigin-Name: 636615358aebfef80a657d09f15f608df9e64882b2aaa5574ce31a4f1c71fd70
2024-02-19 19:56:40 +00:00
drh
f40da9226d Merge trunk fixes into the better-optimize branch.
FossilOrigin-Name: 2cf78a5b5fce7f2d49ce185d27f50722c91a1d6c91bbcecebd4bb5244a76769f
2024-02-19 18:55:32 +00:00
dan
cfc62ceefd Add implementation of sqlite3_intck_suspend().
FossilOrigin-Name: c36ada868da74e030ff5002de1f3b31b639b0c43714b91c2e5ca0eda16bb6bc2
2024-02-19 18:03:53 +00:00
drh
e7bdb2172c If a table has one or more rows and it has a partial index has zero rows,
still make an entry in the sqlite_stat1 table for the partial index, so that
we know that "PRAGMA optimize" does not need to redo the whole table.

FossilOrigin-Name: e147b18991dd462fff367442acb0504fdf193a31843ed34ec8c1ced30747bf8a
2024-02-19 16:22:58 +00:00
drh
6c6356f7f2 Simplifications to PRAGMA optimize to make it easier to use. It always
tries to ANALYZE unanalyzed indexes.  The 0x10000 flag just makes it check
for size changes in all tables.

FossilOrigin-Name: 44ed7f4cd07a88a2fdd303a2c78e6babe01d7344b399bd2b80ed68d75a77aaa2
2024-02-19 13:50:09 +00:00
drh
9f34a05e98 Change the 0x20000 bit (use analysis limit) to 0x10, meaning that this feature
is on by default.  The default analysis limit is changed to 2000 which is
almost always sufficient for accurate analysis results.

FossilOrigin-Name: 4abd47b5917099a2f74e53e12c987da0722304a5e9a93b6d43015c1f45c48444
2024-02-19 13:06:27 +00:00
stephan
e0a9935be1 Extend the strerror_r() result type discrepancy check in os_unix.c to include the Android NDK, as reported in [forum post 3f13857fa4062301|forum:3f13857fa4062301]. The NDK's strerror_r() signature is version-dependent, whereas this change assumes int return (POSIX semantic) across all versions.
FossilOrigin-Name: f18b2524da6bbbcf372b292df52fbe6efa49fd6e1f1f13ef2447279d559f7a08
2024-02-19 12:20:46 +00:00
drh
d43e7adca7 Hold a transaction during PRAGMA optimize, for performance.
FossilOrigin-Name: d13b79eae6df7f9d1f3b8062ddc75a12ff038196b3d752d2672a9925fa45ca56
2024-02-18 01:12:22 +00:00
dan
99a94a124c Add start of extension for incremental integrity-checks to ext/intck/.
FossilOrigin-Name: 444e3c9210026da7eae1ed98850722e002433aa2cc77dbc6b6f80327a6b7a390
2024-02-17 20:55:01 +00:00
drh
42eb6a91cd Add new MASK bits to PRAGMA optimize: 0x70000.
FossilOrigin-Name: dd4497062569eec9ddfdaa7d6394c83ff40a7a59c6697a161bc4ff6d8af3bb29
2024-02-17 16:39:52 +00:00
drh
6161cdd446 Fix rounding in zero-precision %f and %g printf conversions.
[forum:/info/393708f4a8|Forum post 393708f4a8].  This bug was
introduced by check-in [32befb224b254639] and first appeared in version 3.43.0.

FossilOrigin-Name: 7fca1bc482fc2456d75392eb42f768fda72631c9070de46b8123b1126e78306f
2024-02-17 03:32:31 +00:00
drh
837efb4cbe The PRAGMA optimize command invokes ANALYZE if a table shrinks by 25 times
in addition to if it grows by 25 times.

FossilOrigin-Name: 40532ffba91cf332c1ea4add80184031a9d6e10514d2d9b9a6cfd613091b81f7
2024-02-17 01:12:58 +00:00
drh
4dd59fd997 Fix the subtype on the value column from json_each/json_tree for cases
when the value is an array or object.  Fix for the bug reported by
[forum:/forumpost/ecb94cd210|forum post ecb94cd210].

FossilOrigin-Name: 1c33c5db2e05019d1a375109f79ad8588a3c17f81e4f4b8d66c880c3c860e87e
2024-02-16 21:30:08 +00:00
larrybr
fd2500f98b Retweak last check-in to retain compile-time checking of xprintf() arguments.
FossilOrigin-Name: 670174916c660b24ba70e96a42984eb65ee52da50e9828bdeca4c9ff4bf92e20
2024-02-16 18:34:21 +00:00
stephan
816f677c1c Work around a __VA_ARGS__ complaint in fiddle builds.
FossilOrigin-Name: 7d750248c58ccbf87036ea7db053def1c83c7a8ed428a5c47895756302b36200
2024-02-16 16:04:31 +00:00
drh
9d00aba895 Rename the TF_StatsUsed flag to TF_MaybeReanalyze, to more accurately
reflect its usage.  No logic changes.

FossilOrigin-Name: b4790da5e0d6f0f617e6c3a17fc2606842e41cab14339392abd335410fec0aa3
2024-02-16 12:57:04 +00:00
dan
5e5831a760 Handle an OOM case in fts5 code to query tokendata=1 tables.
FossilOrigin-Name: 01222d96b9ab24c7013a2587544304ba32c1f039b08c06a04d8d58ec9c790db0
2024-02-16 11:41:47 +00:00
drh
95b5295f52 Fix a bug in PRAGMA integrity_check introduced by enhancement (8a) in
[https://sqlite.org/releaselog/3_42_0.html|release 3.42.0] and first reported by
[forum:/forumpost/ee4f6fa5ab|forum post ee4f6fa5ab].

FossilOrigin-Name: 460353dfff8f2fb03f9c8666d0c367ec7be4cfa96dfcb0cea10f144d043223bb
2024-02-13 18:41:46 +00:00
drh
54eb54c7de Changes to vtabCallConstructor() to avoid a harmless static analyzer warning
and to help prove that the UAF reported by
[forum:/forumpost/cafbe582e8|forum post cafbe582e8] is a false-positive.

FossilOrigin-Name: 4892440b93306e5a245f18c0d3d295d851e6712260e420016c0d70e12abf8901
2024-02-13 17:11:19 +00:00
drh
8e821c251d Replace the assert() that was removed by [f023cb541b5dd72c] because
[1cd5d4623f44af25] made it true again.

FossilOrigin-Name: 189a49f165dfc348a8730ad2b2288b9b2b2089b1de99fa2d515f2a90c9e7bd4e
2024-02-12 19:12:30 +00:00
dan
98a8ffb3b3 Have rtree avoid keeping a blob handle open following an error.
FossilOrigin-Name: 1cd5d4623f44af25ab4f5af580354b3ae22cf5de4109e008ca41055125bb708d
2024-02-12 16:12:25 +00:00
drh
38e0492b91 Add a new sqlite3FaultSim() to btree for better fault analysis.
FossilOrigin-Name: 2c675bd30568d3c530300beb3fcfaa17c9f063cdcb9a39ac68b9902100f641a6
2024-02-12 14:44:35 +00:00
drh
84dea8264b Add a new sqlite3FaultSim() call in the btree logic, for testing.
FossilOrigin-Name: e0558f79b8184ea6741fb20b710dab854f5bdb71aa47d5a6701eeb7389540c8c
2024-02-12 13:51:08 +00:00
drh
b29047838d Add support for the ".testctrl fault_install" dot-command in the CLI when
launched with the --unsafe-testing option.

FossilOrigin-Name: 5ba7fee1a9b49df82387e355d2ab7de58663d3fa824e50717608b27e0f7ac874
2024-02-12 13:28:10 +00:00
drh
18b6019cdd In the RTREE extension, allow the xBeginTransaction() entry point to be
invoked multiple times without intervening calls to xEndTransaction().

FossilOrigin-Name: f023cb541b5dd72c996f0574210344179217666a2229bc8d3fe057fdbc5c2245
2024-02-11 22:56:12 +00:00
drh
3c5a810646 If a term of an ORDER BY or GROUP BY contains an aggregate function or column,
then it is not an alias that needs to be resolved, so don't try to.  This fixes
a harmless assertion found by dbsqlfuzz.  This yet another problem that
orginated at check-in [6e6b3729e0549de0].

FossilOrigin-Name: d4ec2a5d2297cd9ead0a8768dcf003ea76c74d8d68d88c40f62363f484a4a4d3
2024-02-11 20:53:14 +00:00
drh
ece3567aec Improved AggInfo tracing in debug builds. No changes to deliverable code.
FossilOrigin-Name: bb31f9c44794e02a46ed3edbcc96eb48c5870d3f82cb404586ded9a3efa7a859
2024-02-11 18:53:48 +00:00
larrybr
589c407f12 Further clarify sqlite3_exec() callback parameter lifetime.
FossilOrigin-Name: 993a1a843177b19a9cb5598f57d1e05c01e1695f164faaa9ae22810ad4533eba
2024-02-10 03:11:42 +00:00
larrybr
25e172d429 Mention limited lifetime of string arrays passed to sqlite3_exec() callback.
FossilOrigin-Name: 717f67f3189a59842f5c17a25e8db0e24ec4405886fc22ab6eeb3954fba5a964
2024-02-08 01:19:46 +00:00
drh
0f777cd622 Fix an #endif (added in the wrong place by [8f4b1ceafe4a271b]) so that
the build works with SQLITE_OMIT_VIRTUAL_TABLE.

FossilOrigin-Name: 7070924eebce1d089fde911dc0427ab8f3764d57ace24caff2b79954b42d1b51
2024-02-07 20:45:38 +00:00