1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-13 21:02:00 +03:00
Commit Graph

106 Commits

Author SHA1 Message Date
drh
d4de9f7b1e Fix an obsolete comment and other minor issues from code inspection.
FossilOrigin-Name: cd084427319394386844d6651479256a2fd57a412fccb79ba53172ce76693eb1
2019-04-14 00:34:20 +00:00
dan
e385d33a29 Ensure all bytes of the PgHdr1 structure are initialized. This avoids a valgrind error when running corruptI.test.
FossilOrigin-Name: a505e34d4ec31159a4508ec827fcffed0cf3bd5ea5ef0ac293016da02367a53a
2019-02-06 20:49:49 +00:00
drh
1757fed87f Adjustments to the page cache to try to avoid harmless TSAN warnings.
FossilOrigin-Name: 383437be276719ac1c72688ae81017c63907ac561f2ffb8e42c43b012248f294
2019-01-09 14:49:58 +00:00
drh
d7a5e49840 Back out the expansion of the temporary buffer size from
[32754ca6f86da816] and replace it with an explicit test for buffer
overreads.

FossilOrigin-Name: 8ba3d9f38090c4bbbcffba1930e5c26f69ff61f49b72a4a5a59253d37341380f
2018-12-14 16:20:54 +00:00
drh
d6401e869b Expand the size of the temporary page used during btree rebalancing by a
few bytes, to avoid problems with small buffer overreads that can occur
on corrupted database files.

FossilOrigin-Name: 32754ca6f86da8165e274f98f35fc3df3aebd273e9da08387e2d0c3c89abda0f
2018-12-14 13:35:48 +00:00
drh
de72d2a81a Remove two lines of unnecessary code, for a very small performance increase
and size decrease.

FossilOrigin-Name: 15824ccda0f110794a479b58fbf36082d8c383f34bae9dc0921d96547fb37869
2018-12-03 01:58:02 +00:00
drh
26505e5f51 Follow-up to [0bf0fd242b93c3bd30]: only reset the pager when adding a
new codec, not when overwriting an existing codec.  Also, improve a
comment in the pcache1 subsystem.

FossilOrigin-Name: 5c040fdb013d178e5dffa300621eab91b92beb085ffb9ef2ba08f6bf1dd4013e
2018-11-28 11:09:09 +00:00
drh
617b7b42e3 Small performance optimization in pcache1.
FossilOrigin-Name: ffd437da9541f8a2792e3e07c0a43f388f856fdc211fe42755eb51bfa5995d9f
2017-08-30 04:44:59 +00:00
drh
52df6f5e5c Avoid unnecessary mutexes in the pcache1 implementation in the common case
where no auxiliary page cache memory is configured.

FossilOrigin-Name: 1ba051e34d7512ab5e8fc969c1b5aaaf827b8e6493ba4235895257aca78b500f
2017-08-28 16:11:05 +00:00
drh
eabb67fb61 Microoptimization in pcache1.c makes the code slightly smaller and faster.
FossilOrigin-Name: 422cd9f39403feeacd70133c7a147e23572c75d617ac564344f016ae6611162c
2017-08-05 15:49:03 +00:00
drh
4eb8d7fa89 Slightly smaller and faster implementation of pcache1InitBulk().
FossilOrigin-Name: 06c2b685e15b3ee045a3e7ea018701392771c7664e59a51c9aba87cdefeb37af
2017-03-29 17:06:14 +00:00
drh
bf96228754 Fix the sqlite3_release_memory() interface so that it works even if
SQLITE_DEFAULT_PCACHE_INITSZ is non-zero.

FossilOrigin-Name: 5d902b7fea3144bf57f02aca87b9795fdcec4774310ade6ef01f37d206c3d74f
2017-03-29 15:18:40 +00:00
drh
989412a1cf Take care to avoid integer overflow when doing the initial page cache
allocation with an excessively large cache_size setting.

FossilOrigin-Name: 4d66ac98deaa85218be7ff0eb254f78b96d8e8d4
2016-10-13 12:56:18 +00:00
drh
f5dbe7f8d8 Tweaks to pcache1TruncateUnsafe() to make it slightly smaller and faster and
easier to test.

FossilOrigin-Name: 059f4e2efefb7b9deaf539110c19bceaeb10c6ce
2016-08-10 15:02:49 +00:00
drh
d9fabbcc5b Fix pcache1TruncateUnsafe() run faster for the case where iLimit is
very close to iMaxKey.

FossilOrigin-Name: b07a26df06a2ffb946ff8a1cc7f43eaf701a94b5
2016-08-10 11:50:12 +00:00
drh
97a7e5e68c The pcache and the built-in VFSes should not use mutexes when
SQLITE_CONFIG_SINGLETHREAD is set.

FossilOrigin-Name: 12418b100196abbfbfb85e0ab4bb6b1cbf335df7
2016-04-26 18:58:54 +00:00
drh
9493cafe6f Fix harmless compiler warnings that arise with -DSQLITE_OMIT_LOAD_EXTENSION
FossilOrigin-Name: 65ba2f0b465a1493de6e467f55e0300ac3fb08e1
2016-03-17 23:16:37 +00:00
drh
8b0ba7b0b8 Make greater use of the SQLITE_WITHIN macro.
FossilOrigin-Name: f2fc3aede55c8fa0351697f9f5ce4e544334c9af
2015-12-16 13:07:35 +00:00
drh
a6082f699e The first argument to SQLITE_CONFIG_PAGECACHE, SQLITE_CONFIG_SCRATCH, and
SQLITE_CONFIG_HEAP must always be a pointer.

FossilOrigin-Name: 5e14cadff09d7425c8e1cc5e817f2b0609e52a46
2015-11-26 22:12:41 +00:00
drh
b02392e6f0 Change sqlite3StatusSet() into sqlite3StatusHighwater() so that only the
highwater mark is recorded.  This gives a small size reduction and
performance improvement.

FossilOrigin-Name: 6422d223dd10018703c6b083d29a3c35c837fc97
2015-10-15 15:28:56 +00:00
drh
8faee877cb Fix compiler warnings.
FossilOrigin-Name: 5c31ee62a196b914673384a611534fd778dc64b0
2015-09-19 18:08:13 +00:00
drh
0b19c96935 Fix a potential NULL pointer deref in the testing logic of pcache1.
NB: The -DSQLITE_TEST compile-time option is needed to hit the problem.

FossilOrigin-Name: f5580f08538636ffb1367e717a33756288ccddde
2015-09-10 19:22:25 +00:00
drh
8820250e8d Fix a possible NULL pointer deref when using SQLITE_ENABLE_MEMORY_MANAGEMENT.
FossilOrigin-Name: 89bfdbfe943adce8e02c84ede014fcfed504c5d3
2015-09-09 19:27:10 +00:00
drh
92af02c939 Simplification of the LRU list handling in pcache1.
FossilOrigin-Name: 05a3a2cd140587265b5427d23c93c5be1f39e199
2015-09-04 04:31:56 +00:00
drh
95a0b37156 Change the pcache module to keep track of the total number of references to
all pages rather than the number of pages references, for a performance
improvement and size reduction.

FossilOrigin-Name: f00a9e1e998c4bd249a45444dc2d71a7e4903b8b
2015-09-03 20:43:55 +00:00
drh
3c0c43191a Reduce the number of calls to sqlite3BeginBenignMalloc().
FossilOrigin-Name: 0bee6583665782fac5d9e82bdf19b6f07e7bd03f
2015-09-01 19:51:37 +00:00
drh
0dfbe064de Fix typo in comment. No changes to code.
FossilOrigin-Name: 7b8d17dd840f64dac9a018a4547a97de799e94ab
2015-08-21 12:37:49 +00:00
drh
939d4bcd77 Fix harmless compiler warnings.
FossilOrigin-Name: 9a592cf91c74b369bacf6a0e69d45f3e73dfdbce
2015-07-16 18:37:53 +00:00
drh
957026ac78 Defer the bulk pcache1 memory allocation until the first page allocation
request.  Limit the size of the pcache1 bulk allocation to the cache_size
setting.  Deallocate the bulk allocation on a sqlite3_db_release_memory()
request, if the bulk allocation is completely unused.

FossilOrigin-Name: b79a4affe44bd0c8e155cae19f3f62c715684cd6
2015-07-16 18:18:19 +00:00
drh
7b341e6f99 Comment fix. No changes to code.
FossilOrigin-Name: c1e2ed0ef4d3436d19d3203c5fb553caac53659e
2015-07-08 14:13:44 +00:00
drh
52d9f40b7d Do not do the bulk pcache1 allocations if SQLITE_CONFIG_PAGECACHE specifies
a global page cache buffer.

FossilOrigin-Name: 75d98dae676996a05e97b09b19e34463e8f30d51
2015-07-08 13:40:50 +00:00
drh
fd5ae9649c No need to test sqlite3GlobalConfig.bCoreMutex when SQLITE_THREADSAFE==0.
FossilOrigin-Name: 26db0fee06947d75621237a641b9652b312b3b37
2015-07-07 15:14:16 +00:00
drh
c54357cc2a Simplify the page recycling condition in pcache1. Fix test cases to work
with the latest changes.

FossilOrigin-Name: 5b60df5503f61922326b3e10e94aa197b17afe4b
2015-07-07 14:06:18 +00:00
drh
db7ae89d5b A unified cache is now only used for SQLITE_ENABLE_MEMORY_MANAGEMENT, or if
SQLITE_CONFIG_PAGECACHE defines a shared start-time page cache buffer and the
application is single-threaded.

FossilOrigin-Name: d5ff1d69054d51a55eff6e1979971822db7f8f30
2015-07-06 20:57:22 +00:00
drh
ee70a84ea7 Enhance separate pcache1 to allocate a block of pages from heap on startup,
if possible, for a 5.2% performance improvement.

FossilOrigin-Name: aa7341c8736732a0a59f6688cc34e78be02a7bfc
2015-07-06 18:54:52 +00:00
drh
01c5c00c12 Preserve the number of requested PAGECACHE pages even if the memory pointer
or size is zero.  Enhance the pcache1.c header comment to explain the memory
layout of a page cache line.

FossilOrigin-Name: dacb2a615ce1c0573baf4518000454038745cf2a
2015-07-04 18:15:04 +00:00
drh
95c91e145a Use tail recursion in pcache1Unpin() to get a small size reduction and
speed improvement.

FossilOrigin-Name: fde70472aebc09b34a517131f676e6847d02b747
2015-06-29 00:21:00 +00:00
drh
f5ed7ad63e Fix harmless compiler warnings.
FossilOrigin-Name: b0badb99023e23bef0e2064cec58f2b279af0c0b
2015-06-15 14:43:25 +00:00
drh
982215a2c5 Avoid unnecessary mutex usage in pcache1, for a significant speedup.
FossilOrigin-Name: dcf4fb8d764611de60afea27cda0a8548ba7ca82
2015-06-13 11:10:55 +00:00
drh
55a46c9b0e Add a fast-path implementation of pcache1Fetch() for the common case of
separate caches that do not use a mutex.

FossilOrigin-Name: 760700edb3ff1f5d6bf3058f874cc8e2808905c7
2015-06-12 13:49:26 +00:00
drh
b230a52892 Minor performance optimization in pcache1.c.
FossilOrigin-Name: 2e8ad2ead9d146e312c693d9b967bbd5b92429d9
2015-06-12 13:04:51 +00:00
drh
af89fe66ea Add the sqlite3_status64() interface. Make the new interface and the legacy
sqlite3_status() both atomic and threadsafe.  Check threadsafety using
assert()s.

FossilOrigin-Name: 1ce8e8fa4b866aafa12b1da0eb4d02321af9293e
2015-03-23 17:25:18 +00:00
drh
51dc84eb70 Make SQLITE_CONFIG_PCACHE_HDRSZ accurate (not an over-estimate) on 32-bit
systems.

FossilOrigin-Name: 340b347758e570db3e739b56af0dcf3fc34525be
2014-12-30 13:04:25 +00:00
drh
37c057b8ff Round all object sizes that go into computing SQLITE_CONFIG_PCACHE_HDRSZ up
to a multiple of 8 bytes.

FossilOrigin-Name: b28ce75f2d3a6343dc20d581dc55afae89ab5efa
2014-12-30 00:57:29 +00:00
drh
def6889d21 Add the SQLITE_CONFIG_PCACHE_HDRSZ option for sqlite3_config().
FossilOrigin-Name: 6eb03e62a34e8e0964175283587247b0212db604
2014-11-04 12:11:23 +00:00
dan
5bd8af7c6b Fix a failing test case in index5.test. Also tweak the way cache memory is divided between read-only and dirty pages when using SQLITE_CONFIG_PAGECACHE to reduce IO in some cases.
FossilOrigin-Name: 8541dfb3bbdf63dc9ab304d8a0ab8b290cdc9d96
2014-10-10 19:10:59 +00:00
peter.d.reid
60ec914c74 Fix typos in comments. No code changes.
FossilOrigin-Name: e62aab5e9290503869e1f4d5e0fefd2b4dee0a69
2014-09-06 16:39:46 +00:00
drh
efbf044583 Faster implementation of pcache1Fetch()
FossilOrigin-Name: 0371cc3bb07448bcd64fd671f3e71bb7f30deb4d
2014-08-23 23:15:31 +00:00
drh
693e671936 Fixes for various clang warnings.
FossilOrigin-Name: 87bf60637e5863c54c5e2d05aaaca0835b7aace8
2014-01-24 22:58:00 +00:00
drh
5d56dd2867 Enhance the pcache1PinPage() routine so that it called much less often and
runs much faster in the cases when it is actually called.

FossilOrigin-Name: a845779cd31aec3204a6a9c776bd9c9f7d47dd24
2013-12-13 18:50:40 +00:00