1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

1674 Commits

Author SHA1 Message Date
drh
3b2a3fa42e Enable cell overflow checking in sqlite3BtreeInitPage() using the
compile-time option SQLITE_ENABLE_OVERSIZE_CELL_CHECK.  Change the tests
so that they recognize different error messages depending on the setting
of this macro. (CVS 6735)

FossilOrigin-Name: 56bff6eb2fc5f0afbd96afc986671ec744bd40e1
2009-06-09 13:42:24 +00:00
danielk1977
80929b3de9 Avoid calling fillInCell() to create an internal node intkey cell from balance_nonroot(). A single putVarint() does the same thing more quickly. (CVS 6734)
FossilOrigin-Name: 2e5d42aeb40c3c6eea373a9ae3fbdf4e8087cd58
2009-06-09 11:34:10 +00:00
drh
f061be9c6f Only do the cell overread checks in sqlite3BtreeInitPage if
SQLITE_OVERREAD_CHECK is defined at compile-time. (CVS 6733)

FossilOrigin-Name: 49f544ebae8dc3cf7cf6189536c56ebb7d258a86
2009-06-09 10:37:03 +00:00
danielk1977
6067a9bbfe Do not clear the MemPage.nFree variable when insertCell() adds an overflow cell to a page. Not doing this means balance_quick() can avoid a call to sqlite3BtreeInitPage(). (CVS 6732)
FossilOrigin-Name: 8f1c1f61f7bc5270212725cf0a056872df983f49
2009-06-09 09:41:00 +00:00
danielk1977
a50d9aa784 Change the btree balance code so that it does not call balance_nonroot() recursively. (CVS 6729)
FossilOrigin-Name: 7863db904d6fc36417c923e3d135eb2c145b9013
2009-06-08 14:49:45 +00:00
drh
acfc72bea4 Detect when database corruption causes an attemp to set the pointer map
value for a pointer map page and report the corruption. (CVS 6722)

FossilOrigin-Name: 3ae4880bee3a0312c61cdd36f4fa50286cc2ef48
2009-06-05 18:44:15 +00:00
drh
35cd643cc7 Take care that a corrupt variable-length integer does not cause 32-bit
integer overflow when parsing a record format, nor cause excessively large
memory allocations. (CVS 6719)

FossilOrigin-Name: 38b20327a80996c7044b88be32161ac4ac0ec3a9
2009-06-05 14:17:21 +00:00
drh
1662b5a6f9 Earlier detection of freelist corruption in the page allocation routines. (CVS 6718)
FossilOrigin-Name: e557c8e5846f9c4eaaeb3bd07614ac101bb0b3d0
2009-06-04 19:06:09 +00:00
drh
d46b6c23d3 Fix an assertion fault in balance_quick() that occurs when an interior
btree node has zero cells due to database corruption.  Also update the
corrupt7.test result vectors for a couple of cases where the error report
on database corruption changed due to earlier detection. (CVS 6717)

FossilOrigin-Name: 1335e4440f5a3d24ce9ce187e0e23fc9b166ca98
2009-06-04 17:02:51 +00:00
drh
c85240dbf6 If the root page of a btree is empty and is also not a leaf page and the
page is not page 1, then report database corruption. (CVS 6716)

FossilOrigin-Name: 52b02ca5f3e5fdf2f3e02e9d8e016028d0842818
2009-06-04 16:14:33 +00:00
danielk1977
6f235cc5de Reduce the stack usage of balance_quick(). (CVS 6715)
FossilOrigin-Name: e7ad68e93b19b59cb16205c4b48fd9d6492dbb02
2009-06-04 14:46:08 +00:00
drh
c5e47ac238 Fix two instances where a malformed header in a database file (in other words
a corrupt database file) can lead to an assertion fault. (CVS 6712)

FossilOrigin-Name: 4e92c7f20afa51849128aa1d784ab885b517a73d
2009-06-04 00:11:56 +00:00
drh
69e931e7bb Change the pcache1.c implementation so that the "header" occurs at the end
of page buffer, not at the beginning.  This insures that the 20 bytes
immediately following the page buffer are mapped if a read of the page
buffer overruns due to a malformed cell. (CVS 6711)

FossilOrigin-Name: c54de1f54080de7e134d7b562498abb5337a0a46
2009-06-03 21:04:35 +00:00
danielk1977
93c829c110 Add corruptD.test, a container for testing the "cell overflow" problem. Also shuffle a small amount of code in BtreeInitPage() to check that the page header pointer to the start of the cell offset array is set to a sane value. (CVS 6710)
FossilOrigin-Name: 7fa5d3cb0fa05f7d901bcc139c2c037ce5944caa
2009-06-03 17:26:17 +00:00
danielk1977
0d19f7ac57 Define a set of constants to use as the "index" argument to sqlite3BtreeGetMeta and UpdateMeta. This makes some parts of the code easier to follow. (CVS 6709)
FossilOrigin-Name: 6dbf4eca00f845baa7200aba421d0bc158ba96aa
2009-06-03 11:25:07 +00:00
danielk1977
4b0aa4cf3e Workaround the need for internal API sqlite3BtreeCursorDb(). It was only being used for an assert() statement, which can be done differently. (CVS 6683)
FossilOrigin-Name: 5904af6e6df3effdaaa30e7cf96ee316fc09b28d
2009-05-28 11:05:57 +00:00
shane
60a4b53823 Changes to silence compiler warnings under MSVC. (CVS 6613)
FossilOrigin-Name: df599237e1ca8b4f361477a712cf761aa1fac3df
2009-05-06 18:57:09 +00:00
danielk1977
11c327aabe Avoid parsing cells that fit entirely on the b-tree page when searching a b-tree index. (CVS 6601)
FossilOrigin-Name: 77a8239548722f702ead9d7c60df0d68180948fb
2009-05-04 19:01:26 +00:00
danielk1977
de630353d8 Speed up INSERT operations that add data to UNIQUE or PRIMARY KEY indexes by rationalizing duplicate seek operations. (CVS 6599)
FossilOrigin-Name: cac4f3d812f0a02ca5c1fa78d366f694403929a8
2009-05-04 11:42:29 +00:00
danielk1977
3f632d5bd2 When a cursor points at the last entry of an intkey btree after an insert, leave it there (instead of moving it to the tree root node). This speeds up statements of the form "INSERT INTO ... SELECT ..." that use auto-generated rowids. (CVS 6592)
FossilOrigin-Name: 9950c0a79c82eb7d8495b0b1a8fe117d566e2387
2009-05-02 10:03:09 +00:00
danielk1977
9c3acf3cfe Do not reset the cursor before seeking it in sqlite3BtreeInsert(). This speeds up INSERT operations that use auto-generated rowid values. (CVS 6591)
FossilOrigin-Name: 20c4acc291def33980f584f882c76e85ee1c8238
2009-05-02 07:36:49 +00:00
drh
b56cd55b9a Update PRAGMA integrity_check so that it treats SQLITE_IOERR_NOMEM errors
from underlying components the same as SQLITE_NOMEM errors. (CVS 6587)

FossilOrigin-Name: 26444f2a4426d2e51464ef69ed83d3c78be2c11f
2009-05-01 13:16:54 +00:00
drh
c47fd8e031 Disallow attaching the same database multiple times to the same db connection
in shared cache mode, since doing so leads to deadlock. (CVS 6578)

FossilOrigin-Name: 715f14f1dcaf604d4794bf3e18e245d4f8c5d5a9
2009-04-30 13:30:32 +00:00
danielk1977
d829335e42 When SQLite is configured to use in-memory temp files (either by setting SQLITE_TEMP_STORE during compilation or using the temp_store pragma at run time), store statement/savepoint journals in memory also. Ticket #3825. (CVS 6575)
FossilOrigin-Name: 38f8c5a14cd221af9e115a0fea689f2ff39e30e5
2009-04-30 09:10:37 +00:00
drh
c0b61810ed Remove always-true tests from attach.c. In btree.c, always test the return
from sqlite3PagerSetPagesize() since it might return SQLITE_NOMEM. (CVS 6572)

FossilOrigin-Name: 8bf60b24ffcf6ac15f41eaa7f976b810e0c66734
2009-04-30 01:22:41 +00:00
danielk1977
fad9194453 Modify the assemblePage() function in btree.c so that it runs slightly faster. (CVS 6569)
FossilOrigin-Name: 7ec42e989f1d4abdc6d52f8feebf51985f36b2bd
2009-04-29 17:49:59 +00:00
danielk1977
ae5558b2ae Add a version of cellSizePtr() that is faster than using sqlite3BtreeParseCellPtr(). This speeds up balance_nonroot(). (CVS 6566)
FossilOrigin-Name: e8f7f7b787fe941093edaea44db4d361fad1e002
2009-04-29 11:31:47 +00:00
danielk1977
7b801388f5 Simplify a conditional expression in btree.c. (CVS 6565)
FossilOrigin-Name: fc3a5ac2353142082fe14d47f9c2b662407ea3f7
2009-04-29 06:27:56 +00:00
drh
51898cf727 Update comments and remove unused code in btree.c. No functional changes. (CVS 6521)
FossilOrigin-Name: bd860184909b7a9cc32c59770ebcee0efdc491f0
2009-04-19 20:51:06 +00:00
danielk1977
e589a67f6c Fix a case where a corrupt database could cause an assert() to fail. (CVS 6496)
FossilOrigin-Name: 2c560e057e1da8a603efc36deea036f2392a4ab9
2009-04-11 16:06:15 +00:00
danielk1977
2a50ff0309 Always set BtShared.db when entering the BtShared mutex. Ticket #3793. (CVS 6480)
FossilOrigin-Name: ed6620ba589ddbb6ca86f42a7652e3b019195647
2009-04-10 09:47:06 +00:00
drh
8c5d152b53 Force 8-byte alignment of sqlite3_value objects in the
sqlite3VdbeUnpackRecord() primitive.  Ticket #3777. (CVS 6479)

FossilOrigin-Name: 2cc68272b1f70701268075cfa82fa64bb2a8179d
2009-04-10 00:56:28 +00:00
danielk1977
5d189858e9 Fix an incorrect assert in btree.c. (CVS 6465)
FossilOrigin-Name: 2c1f59834ab7a16066ee12cb8a8342d438c23ce9
2009-04-07 14:38:58 +00:00
danielk1977
ef165cedeb Test cases and minor code changes to increase coverage of btree.c. (CVS 6456)
FossilOrigin-Name: def3a016914f683818b5f013ec4efecbb8fd4c0d
2009-04-06 17:50:03 +00:00
drh
ea598cbd8d Additional code to make sure and to assert that memory allocations have
8-byte alignment.  Ticket #3777. (CVS 6450)

FossilOrigin-Name: 208382e032134d9c78fe1cfcb98ce9defb4e3e26
2009-04-05 12:22:08 +00:00
drh
ce4869f893 Make sure the VACUUM statement locks down the page_size and auto_vacuum
modes after it runs.  Otherwise, pragmas might change these settings on
a populated database, resulting in problems. (CVS 6442)

FossilOrigin-Name: 85e6a4740d6db731c8c35a331031c346e9189c27
2009-04-02 20:16:58 +00:00
danielk1977
fa542f1fc8 Fix a problem causing the BtShared.isPending flag to be cleared to early. Also coverage improvements for btree.c. (CVS 6440)
FossilOrigin-Name: 8f1423445b29a5f52ed907de6db82128a96ebfe2
2009-04-02 18:28:08 +00:00
danielk1977
295dc10573 Remove an unreachable branch from lockBtree(). Add comments. (CVS 6428)
FossilOrigin-Name: 859792958b4d4a3623d68526ff773f778bdf3f0d
2009-04-01 19:07:03 +00:00
danielk1977
20c6cc2b1b Remove the unused SQLITE_Vtab flag. (CVS 6425)
FossilOrigin-Name: fdd78962fcb988edfb4147394045fc5d3944c620
2009-04-01 18:03:00 +00:00
danielk1977
d217e6f16d In pageReinit() in btree.c, only reinitialize a page if there are one or more references to it, not including the transient reference held by pager.c. This was always the intent. (CVS 6424)
FossilOrigin-Name: 0c5a7d1117cfb322d1c89da89e8887b0bb091602
2009-04-01 17:13:51 +00:00
danielk1977
6011a75c0c Remove an unreachable branch from allocateSpace() in btree.c. Add comments and asserts to the same function. (CVS 6422)
FossilOrigin-Name: f8e15a542df67fd9dc1c91c7d9e1c4df59acb82b
2009-04-01 16:25:32 +00:00
danielk1977
5b413d785f Add some assert() statements to querySharedCacheTableLock(). (CVS 6421)
FossilOrigin-Name: 3e3b5e861aeff2e4ef568c422236fdf7fa22bed3
2009-04-01 09:41:54 +00:00
danielk1977
f4027782b0 Fix a case where a pointer map page was not being journalled before a file truncation that occurs as part of an incremental vacuum. (CVS 6413)
FossilOrigin-Name: c5890935a0247090162feda73cfea85012317050
2009-03-30 18:50:04 +00:00
drh
5e8d8878fe Add a comment to the pageReinit() routine explaining why the return code from
sqlite3BtreeInitPage() is ignored.  Comment change only - no changes to code. (CVS 6412)

FossilOrigin-Name: 10f605be8c92ff94625a0da0e23b2ffd55ec7509
2009-03-30 17:19:48 +00:00
danielk1977
5be31f519b Modify integrity-check to prevent a buffer overread when dealing with a corrupted database. (CVS 6411)
FossilOrigin-Name: 3c9097f19adae071a12e1114f64993d0c1da1163
2009-03-30 13:53:43 +00:00
danielk1977
ac86169fff The fix in (6395) was not correct. Fix #3756 a different way. (CVS 6397)
FossilOrigin-Name: 9278f7b1e1f2d0d4c2f8829ca801a769e512c2a6
2009-03-28 10:54:22 +00:00
danielk1977
357864ecb6 Fix a problem preventing sqlite3_extended_errcode() from working correctly. (CVS 6385)
FossilOrigin-Name: de469c46f55bf772ab8a49a185dc1b87360a937f
2009-03-25 15:43:08 +00:00
shane
ca18d20fd6 Fix compiler warning in MSVC. (CVS 6371)
FossilOrigin-Name: 83a4d5b3d7abe983c2be00a694cc7d4c4847f253
2009-03-23 02:34:32 +00:00
drh
7555d8ec40 Rename the unused MEM2 static mutex to OPEN and reuse it to serialize access
to the sqlite3BtreeOpen() routine to prevent a race condition on detection
of sharable caches.  Ticket #3735. (CVS 6363)

FossilOrigin-Name: 19fa5a29b97f017a9e176e48c848100299ba6920
2009-03-20 13:15:30 +00:00
danielk1977
bd43455c38 Fix some cases where executing SQL from within a user-function callback could cause problems related to statement-transactions. (CVS 6355)
FossilOrigin-Name: a60f4191791dd7bb49d5c95b350a9924845b59a8
2009-03-18 10:33:00 +00:00