1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00
Commit Graph

1354 Commits

Author SHA1 Message Date
drh
27fb746cde Put BtCursor objects on a singly-linked list instead of a doubly-linked list.
Add the BTCF_Multiple flag.  Only invoke saveAllCursors() when using a cursor
that has BTCF_Multiple set.

FossilOrigin-Name: 429ccef2b36fc46e92914eb54afd5f800b1a40ff
2015-06-30 02:47:36 +00:00
drh
98ef0f6c48 Convert several 5-year-old and older NEVER() macros into assert().
FossilOrigin-Name: ed54c14ea8a72d69d69e0c0d7f6936f54efc04c2
2015-06-30 01:25:52 +00:00
drh
207c817365 From sqlite3BtreeInsert(), bypass the btreeMoveto() routine for table inserts
and go directly to sqlite3BtreeMovetoUnpacked().

FossilOrigin-Name: 53fe685d56368af78238c8981cc41704929f7660
2015-06-29 23:01:32 +00:00
drh
325d087aa7 Move an assert() and testcase() into their correct position within
getAndInitPage().

FossilOrigin-Name: 18115164e12509ec21f34598089a7f1310048819
2015-06-29 00:52:33 +00:00
drh
c75d886b05 Make greater use of BtCursor.curIntKey.
FossilOrigin-Name: 63998471d023dd846d5583ac856e2acc47ad41ea
2015-06-27 23:55:20 +00:00
drh
408efc0664 Add the BtCursor.curIntKey field and use it for a small size reduction and
performance boost.

FossilOrigin-Name: 4a17df139ac41e29c9a2e58afbd1238a5e94bd36
2015-06-27 22:49:10 +00:00
drh
15a0021b3e Enhancements to the previous check-in to make it a little smaller and faster.
FossilOrigin-Name: 291d9e0c328a7bd0f255b0b7e819ca2c909701a3
2015-06-27 20:55:00 +00:00
drh
28f58dd60e Performance improvements in moveToChild() by shifting some work over
to getAndInitPage().  Net improvement is about 800K cycles at cost of 30 bytes.

FossilOrigin-Name: 1956a4ce8eca650d98a7f68fd2d82eb8a3d6069f
2015-06-27 19:45:03 +00:00
drh
375beb0ec0 Manually inline the call from getAndInitPage() to btreeGetPage() for a
savings of 2.5 million cycles at a cost of less than 100 bytes.

FossilOrigin-Name: 7f65b96b4017413bd19624570efe8fb2b0f7b991
2015-06-27 15:51:06 +00:00
drh
bbf0f867d2 Add releasePageNotNull() as an alternative to releasePage() when the argument
is guaranteed to be non-NULL, and use it for a small performance gain.

FossilOrigin-Name: 9383a688701ac2c366a308efc287c9c0f8977d4e
2015-06-27 14:59:26 +00:00
drh
f44890a7c4 Add the Mempage.aDataOfst field and use it in sqlite3BtreeMovetoUnpacked()
for about a 2 million cycle gain.

FossilOrigin-Name: bee94dc3510745ba2efa044e8f3299793cfc7e34
2015-06-27 03:58:15 +00:00
mistachkin
68cdd0eda2 Fix harmless compiler warning in assert statement.
FossilOrigin-Name: 7097716caed9d4aef49c7e766e41ea74abf5967f
2015-06-26 03:12:27 +00:00
drh
2c8fb926da Simplifications and performance improvements in insertCell().
FossilOrigin-Name: 7d02e6c992ef92e1f77ebc13889e17c028454b06
2015-06-25 19:53:48 +00:00
drh
b7580e84a8 More simplifications and performance improvements to cell allocation
logic associated with allocateSpace().

FossilOrigin-Name: 78da0f69cb3289e332018864004f319f2764a5c8
2015-06-25 18:36:13 +00:00
drh
e674bf1648 Reorder the terms of a conditional for a small performance gain.
FossilOrigin-Name: d67b0ed1054cbb7ea2cdd74720d4d6e0227cec14
2015-06-25 16:01:44 +00:00
drh
ae6cd72318 Remove a NEVER() that is in fact reachable.
FossilOrigin-Name: f824e66b0dc120bed227c7446e2663fcad7cc4f6
2015-06-25 15:21:52 +00:00
drh
ded340e4fc Minor optimization to allocateSpace().
FossilOrigin-Name: d007bc339b9ea6d59a3dd2b0c5e77e9c801b16f6
2015-06-25 15:04:56 +00:00
drh
6918095d81 Enhance the Btree object to remember whether or not it is holding an
Incrblob cursor.  Use this knowledge to improve performance in the common
case where it does not.

FossilOrigin-Name: 476b11563c08c6d9c0abd69e4d865c4edcdd45f5
2015-06-25 13:03:10 +00:00
drh
526b17db13 Remove a line of code that doesn't do any useful work.
FossilOrigin-Name: 3ee888beb974e015bd11ae79381b208eaa310f6f
2015-06-25 02:26:45 +00:00
drh
c6e956f038 Fix a harmless compiler warning.
FossilOrigin-Name: 3b6fa95eebfa01703d9ef4f530674d17e965c512
2015-06-24 13:32:10 +00:00
drh
9e7804dfd4 Prevent an infinite loop while searching a corrupt freelist.
FossilOrigin-Name: 4e5424fe89eed346f6cf26a05c72694d1eb9f58f
2015-06-24 12:24:03 +00:00
drh
672073a41b Strengthen the new balance_nonroot() code against various corrupt database
problems.

FossilOrigin-Name: 5ba983432069714afebbb2f0ef22d41be52f7a4c
2015-06-24 12:07:40 +00:00
drh
b468ce1256 Remove an invalid NEVER() and add a test case to cover it.
FossilOrigin-Name: 14b73d201509d3c04f760a08d21f3c499f2870a8
2015-06-24 01:07:30 +00:00
drh
ea82b37302 Testability improvement.
FossilOrigin-Name: eed6a3314518cdab809264284d7680385f0d5d2a
2015-06-23 21:35:28 +00:00
drh
fe647dc9ee Multiple overflow cells are always adjacent and sequential. Exploit this
invariant for a small size reduction and performance increase and add
assert()s to prove the invariant.

FossilOrigin-Name: f77f2f48f48e374a72b6c054142f7a3ec0b1483c
2015-06-23 18:24:25 +00:00
drh
4f4bf7747a Faster loading of cell pointers into the b.apCell array in balance_nonroot.
FossilOrigin-Name: fda89b0512477f9da09fd0f4e548ed4b13efd49d
2015-06-23 17:09:53 +00:00
drh
008d64c23a Avoid unnecessary cachedCellSize() calls in the cell partition adjustment
phase of balance_nonroot().

FossilOrigin-Name: 6319ee1256b1f7c39dd39a536a39b77b3d10dcac
2015-06-23 16:00:24 +00:00
drh
f783893b8d Change pageInsertArray() and pageFreeArray() so that they use the CellArray
object and compute cell sizes as needed, resulting in smaller and faster code.

FossilOrigin-Name: f7f41818119bb7bfbd1f1297d294b32f32769cd3
2015-06-23 15:36:34 +00:00
drh
4edfdd38fb Improvements to the way balance_nonroot() constructs the b.apCell array of
pointers to cells.

FossilOrigin-Name: ee44bb25b2a88e25ba2afe37cf03ba199692a3a0
2015-06-23 14:49:42 +00:00
drh
1ffd247c0c Avoid computing cell sizes in balance_nonroot() until they are really needed.
This gives an overall 1.7% performance gain for about 1000 extra bytes of
code space.

FossilOrigin-Name: 43844537e8a372953386663f8177202901ba7566
2015-06-23 02:37:30 +00:00
drh
658873bdb3 Change the way that balance_nonroot() partitions cells between the sibling
pages such that a scan of the cell size array is not required.

FossilOrigin-Name: 168728715156d756ac8c0df45710d054eee027ec
2015-06-22 20:02:04 +00:00
drh
eeab2c63a9 Fix corner cases involving corrupt varint values in record headers.
FossilOrigin-Name: 3189116b42c5ecef5e30c8b317f4458bbf8b9086
2015-06-19 20:08:39 +00:00
drh
56cb04efc8 Performance improvements in btreeParseCell() by inlining the varint decoder.
FossilOrigin-Name: faab0ed928074f3ec7c25e1a2058414fbd9b013c
2015-06-19 18:24:37 +00:00
drh
5fa605142f Add the MemPage.xParseCell method and provide various implementations
(variations on the former btreeParseCellPtr()) depending on the page type.

FossilOrigin-Name: 41d03d883c4f7ca279eb9dd679f3ab81c8d957d9
2015-06-19 17:19:34 +00:00
drh
25ada07ab4 Make cellSizePtr() a method on the MemPage object, with alternative
implementations depending on the page type.  This results is a small performance
improvement and size reduction.

FossilOrigin-Name: 02f7e9d7d7b93d0b6bbd6cc0d0359b3b741b9931
2015-06-19 15:07:14 +00:00
drh
c5b41ac8ee Make getCellInfo() a real function instead of a macro, for a size reduction
and a 0.2% performance gain.

FossilOrigin-Name: 55c393ea14197ae5fa56ebca7a47e7d980511fa7
2015-06-17 02:11:46 +00:00
drh
3e24a34324 Fix a harmless comment typo. No code changes.
FossilOrigin-Name: ae6876521819e7a8ce473c8f96617cba35e2156d
2015-06-15 16:09:35 +00:00
drh
e4d38707ea Improved detection of database corruption in freeSpace().
FossilOrigin-Name: 29bcb56887f862a1f06677a7b4bfae6475d29732
2015-06-15 12:58:15 +00:00
drh
24dee9d214 Always check for cell overflow before returning a slot from the
pageFindSlot routine in btree.c.

FossilOrigin-Name: 9f035c45a4b84203e67b6e1b23cf11691dc43f1e
2015-06-02 19:36:29 +00:00
drh
cd8fb7cfd5 Fix a faulty assert() in btree.c. Update the database fuzz test file with
new test cases.

FossilOrigin-Name: 4e621af1345a001360938de76e3b0a14deb5e991
2015-06-02 14:02:18 +00:00
drh
1c8badeb26 Ensure that allocateBtreePage() always clears the MemPage pointer when
it fails due to an I/O or memory allocation error.

FossilOrigin-Name: 09a38bf665902834936d39341627ded88142e6ae
2015-05-29 18:42:11 +00:00
drh
e726622579 Move two unreachable conditionals inside of NEVER() or assert().
FossilOrigin-Name: db4e9728fae5f7b0fad6aa0a5be317a7c9e7c417
2015-05-29 17:51:16 +00:00
drh
1f2d968622 Remove a corruption test in balance_nonroot that is superceded by a prior
better check.

FossilOrigin-Name: 00693682d8664fa608ba43684f6376a9bd5b84eb
2015-05-29 17:13:14 +00:00
drh
c68275032e Added comments and testcase() macros to error cases in the btree search.
FossilOrigin-Name: 7da7dc714bf1fe34b38fc33a923490dfd3e4f070
2015-05-28 15:14:32 +00:00
drh
73d340adff Earlier detection of incompatible sibling pages in balance_nonroot.
FossilOrigin-Name: 60a09f17d8b70dbc4b020586a1b81bce76882729
2015-05-28 11:23:11 +00:00
drh
7e8c6f1c2e Add the btreeGetUnusedPage() routine to btree.c, and use it to detect content
pages on the freelist and to cause that condition to trigger an SQLITE_CORRUPT.

FossilOrigin-Name: fe15d1f70360d6fef8ef1a111dd43e060d059623
2015-05-28 03:28:27 +00:00
drh
b52e9c89df All bytes of a page are initialized, even bytes that follow a 2-byte cell
on a malformed page.

FossilOrigin-Name: 7373a004ed0e2781cda503c73e9a94f24350ef79
2015-05-27 18:13:35 +00:00
drh
f9705d4b66 A different approach to preventing buffer overreads when comparing a vector
of values with a corrupt index record that spans at least one overflow page.

FossilOrigin-Name: 95eaa49f4ee071c7a0f690a695f1f2d1ebca68a8
2015-05-27 15:42:53 +00:00
dan
3548db7c13 A different approach to preventing buffer overreads when comparing a vector of values with a corrupt index record that spans at least one overflow page.
FossilOrigin-Name: 7e9e1b6123bc455dd7d1c894b6154ccd27acec18
2015-05-27 14:21:05 +00:00
drh
1421d980c5 Add the "PRAGMA cell_size_check=ON" command.
FossilOrigin-Name: 2ead43f074d01312c7642e1df9abccc95547f019
2015-05-27 03:46:18 +00:00