Commit Graph

4161 Commits

Author SHA1 Message Date
drh 9b4c59fa1b Refactoring the mmap interface. The controlling pragma is now "mmap_size"
instead of "mmap_limit".  Also change SQLITE_CONFIG_MMAP_LIMIT and
SQLITE_FCNTL_MMAP_LIMIT to SQLITE_CONFIG_MMAP_SIZE and
SQLITE_FCNTL_MMAP_SIZE, respecctively.  
The default mmap_size is now always 0, meaning that
memory mapped I/O is off by default.  There is a new compile-time option
SQLITE_MAX_MMAP_SIZE that determines a hard upper bound on the mmap_size.
Setting SQLITE_MAX_MMAP_SIZE to zero disables the memory-mapped I/O logic
and causes it to be omitted from the build.  An extra argument is added
to SQLITE_CONFIG_MMAP_SIZE that can optionally lower the SQLITE_MAX_MMAP_SIZE
at start-time. The SQLITE_MAX_MMAP_SIZE is zero for platforms where we 
know that it does not work, meaning that it cannot be turned on by mistake
on those platforms.

FossilOrigin-Name: ea1404a10abd7f68e1f8e0708c8a3199d1f79665
2013-04-15 17:03:42 +00:00
drh a3a5bd9b62 Only consider AS names from the result set as candidates for resolving
identifiers in the WHERE clause if there are no other matches.  In the
ORDER BY clause, AS names take priority over any column names.
Candidate fix for ticket [2500cdb9be].

FossilOrigin-Name: ad53924dcadffb95c6497c46c228c67e8f5370e4
2013-04-13 19:59:58 +00:00
dan 4b2ac35e5b Add a test case for detaching a database referenced by an fts4aux table created in the temp schema.
FossilOrigin-Name: 6d6f0592abe237256dbdf30ab0ba0bb0c365dd95
2013-04-12 16:53:19 +00:00
dan a8f60381a9 Change the fts4aux virtual table module so that fts4aux tables created in the temp database may report on fts3/fts4 tables in any attached database.
FossilOrigin-Name: 546a187f1361dad340ed8f6c28dd89e6c19f9c33
2013-04-12 16:47:27 +00:00
drh d040e76442 Add new primary error codes SQLITE_NOTICE and SQLITE_WARNING for use with
sqlite3_log().  Add new extended error codes SQLITE_NOTICE_RECOVER_WAL and
SQLITE_NOTICE_RECOVER_ROLLBACK to use with sqlite3_log() messages that occur
on each recovery.

FossilOrigin-Name: be7d2c5482c41baf000d7fb5dccc31b974e91064
2013-04-10 23:48:37 +00:00
drh 188d488409 Disable the use of memory-mapped I/O if the SQLITE_DISABLE_MMAP macro is
defined.  Automatically define this macro for OpenBSD and QNX.  Other
systems are likely to be added to the disabled list over time.

FossilOrigin-Name: 8a4314a398c6c6efb25e6993c826b7e60d9bb1f9
2013-04-08 20:47:49 +00:00
dan abd6d84a11 Add tests to "permutations.test coverage-pager" to cover uncovered branches.
FossilOrigin-Name: 07a0e4e9820a85bf1690214fef3577866c763f92
2013-04-06 11:03:09 +00:00
dan d7a558a9fb Improve the code coverage of "permutations.test coverage-pager".
FossilOrigin-Name: b095e2cdb61ca8487255687f58fb1024d40f3986
2013-04-05 20:40:43 +00:00
dan ced9813b12 Add further multi-client tests to mmap1.test.
FossilOrigin-Name: a107f75d93b8acd3403d8473a75137378041a833
2013-04-04 19:32:53 +00:00
drh 75f2d540ac Disable memory-mapped I/O for the win32lock.test module
FossilOrigin-Name: 2b3d9805a28e51f646113e22c2dff2272342306e
2013-04-04 17:28:11 +00:00
drh a478b3fa80 Try to use mmap() to speed access to the database file on windows, linux,
and mac.

FossilOrigin-Name: fff2be60779571c8fb89158db976ec3755e9a223
2013-04-04 00:40:17 +00:00
drh 34f7490311 Change the mmap_limit pragma to report the new limit, or to report the
existing limit if called with no arguments.  Report the default mmap_limit
as part of PRAGMA compile_options.  Set the default mmmap_limit to 0 for
all systems other than linux, mac, windows, and solaris.

FossilOrigin-Name: 2d9f1327fe79e40435ce1e2594d7cd9a5aea0ef2
2013-04-03 13:09:18 +00:00
dan f7679ad19e When moving a page to make way for the root page of a new table or index in an auto-vacuum database, save the positions of any cursors that may be holding xFetch references to the page being moved.
FossilOrigin-Name: 9d9b1da54a555e8fb6037d63d1952458c12956d2
2013-04-03 11:38:36 +00:00
dan 227a1c482c In btree.c, save the positions of other cursors open on the same table when writing via an incremental blob handle. Otherwise, they may be left holding an out-of-date xFetch page reference.
FossilOrigin-Name: 3f09fba18f7e61e21381ffea13c31b968efd7d77
2013-04-03 11:17:39 +00:00
drh c3d53189fc Adjustments to mmap1.test so that it works better on windows. It still gets
some answers wrong, but it no longer crashes.

FossilOrigin-Name: ee8d3ceeec40d84adb8798f084b6f1215ab56d92
2013-04-02 20:29:33 +00:00
dan 81d1765ad8 Fix a bug in mmap2.test that was leaving an invalid sqlite3_log() callback installed, causing a crash.
FossilOrigin-Name: c0cdaa07355f51bd217881b5b91ec2a609fa56f4
2013-04-02 20:19:22 +00:00
dan db082408c6 Add test cases to mmap1.test and pagerfault.test.
FossilOrigin-Name: 3050136be962427cc4dcced6077ef29b2a941405
2013-04-02 18:33:55 +00:00
dan d409792838 Change an assert in pager.c to acknowledge that it is possible for sqlite3PagerRollback() to return SQLITE_CORRUPT.
FossilOrigin-Name: d641d3d20d80fdb86d91de31fcf2eb5ca3c5c715
2013-04-02 18:31:29 +00:00
dan f6653871b2 Add new test file btreefault.test.
FossilOrigin-Name: 7fe908afeba16f64edc16824c67b396138581a8f
2013-04-02 15:37:30 +00:00
dan 4ff7bc45c6 Add test cases for errors in mmap() or mremap() is os_unix.c.
FossilOrigin-Name: 3098a3c1e7305033904a496ef534cb312a876fab
2013-04-02 12:04:09 +00:00
drh 8a1b87cb97 A fix an test-case for the ORDER BY problem identified by ticket [a179fe7465].
This change causes sorting to occur in some cases where it is not strictly
necessary.  Further work is needed to avoid those extra sorts.

FossilOrigin-Name: 488089e615e375c01b31544f06e801af950ae3db
2013-03-27 15:04:28 +00:00
drh 138eeeb1b0 Candidate fix for ticket [6bfb98dfc0c]: Make sure invalid cursors drop all
references to database pages prior to doing any insert or update.

FossilOrigin-Name: 322a5f086d9ee46017f750df81527799a54ae258
2013-03-27 03:15:23 +00:00
drh 41f89cc676 Previous check-in accidently left mmap turned off by default. This checkin
fixes that.  Unfortunately, shared.test is now segfaulting.  All other
veryquick tests appear to work, however.

FossilOrigin-Name: a850c7319c20b5757983443df05cf2aa4250053b
2013-03-26 01:07:50 +00:00
drh 0d0614bdc6 Memory-mapped I/O is now on by default. The "PRAGMA mmap_limit(N)" can be
used to issue a hint to the VFS to limit mmap space to N bytes.  The VFS
is free to ignore that hint if desired.  However, if "PRAGMA mmap_limit(0)"
is used, xFetch is never called.

FossilOrigin-Name: 1b37c4effdd03aa2ea938a71b4f22ed27391689b
2013-03-25 23:09:28 +00:00
drh d1ab8065c1 Add munmap and mremap to the set of os interfaces that can be overloaded
in os_unix.c.

FossilOrigin-Name: 8776047bd776bbf266eb9c3b56683badb84ae73e
2013-03-25 20:50:25 +00:00
drh dee6554811 Merge all recent trunk changes into the experimental-mmap branch.
FossilOrigin-Name: a607d63f0b6a3d3785e9385187d3e6b92e14fc70
2013-03-25 19:57:26 +00:00
dan 893c0ffc29 Add a test that simulates an error in mmap().
FossilOrigin-Name: 6ec7367d8e98425f00eeb8215ca8964313c1d0b7
2013-03-25 19:05:07 +00:00
dan a64d5a15b7 Simulate OOM errors in the sqlite3OsFetch() function. Run malloc.test as part of the "mmap" permutation.
FossilOrigin-Name: 77443ef2cd0b29b7822eea544ab8c6c4a93cb67b
2013-03-25 18:25:49 +00:00
dan e115ff8171 Add a second test for [38b1ae018f].
FossilOrigin-Name: 5062db672c00c3365d51cd6b39815078f5b6b525
2013-03-25 12:02:45 +00:00
dan 1cb90c668c In fts3, when filtering lists for hits in a specific column, edit the list in place in the same way as it is for NEAR filtering. Fix for [38b1ae018f].
FossilOrigin-Name: f85f9103cffa5c8ba6a63a68beb90817147ba080
2013-03-25 11:38:44 +00:00
dan 9d56c6df9a Fix a case where a checkpoint operation could write to an invalid part of a memory mapped region.
FossilOrigin-Name: 8dbe89d05ce91428c69003f0da79d883fa23e2b5
2013-03-23 14:20:42 +00:00
dan 7909e54a22 Update wal mode tests so that they work with the mmap test permutation.
FossilOrigin-Name: f7295872a36539d10edaf0c633f935f25cf73657
2013-03-22 20:15:31 +00:00
dan aa1d67b1d9 Fix a case where the mapped part of a database file may be written during a backup operation.
FossilOrigin-Name: c8d67aefff7299dd5c8abeb2a3a52109c0a823ee
2013-03-22 19:17:45 +00:00
mistachkin 48864df97d Many spelling fixes in comments. No changes to code.
FossilOrigin-Name: 6f6e2d50941e444ebc83604daddcc034137a05b7
2013-03-21 21:20:32 +00:00
drh 0e5fba790a Fix text-to-numeric type casting so that it works correctly on UTF16
strings that contain characters where the LSB is numeric but the MSB
is non-zero.  Ticket [689137afb6da41]

FossilOrigin-Name: 5b22053f918d16f593227a432a5d5b4c195bb0b5
2013-03-20 12:04:29 +00:00
dan eecc398374 Add test file mmap1.test.
FossilOrigin-Name: aee1f53a74e636776cbbc11bdd5516432ad50533
2013-03-20 10:07:43 +00:00
dan 5d8a137218 Add the sqlite3_io_methods.xMremap() method to the VFS interface. Also "PRAGMA mmap_size".
FossilOrigin-Name: 6183f1bd86ceed76d22d9762f3d7eb33262c62d1
2013-03-19 19:28:06 +00:00
dan b2d3de3bf4 Use mmap() to read from the database file in rollback mode. This branch is unix only for now.
FossilOrigin-Name: 6f21d9cbf5d457e63a7282015a89ae785526cf6d
2013-03-14 18:34:37 +00:00
dan 27e6df4e41 Enhance tests for ticket [4dd95f6943].
FossilOrigin-Name: 0b452734faa0839c817f040322e7733e423bfce2
2013-03-13 07:02:04 +00:00
drh 725e1ae52e Add a single new test case to the ORDER BY with IN logic verify that if the
RHS of the IN is a descending index that it still works.  Add testcase()
macros to the ORDER BY with IN logic to help verify that corner cases are
tested.

FossilOrigin-Name: 7e7356f1552cd53ea363d1ded3b2c221c9d0be01
2013-03-12 23:58:42 +00:00
drh 3c60421864 Fix a test case that had an ambiguous result.
FossilOrigin-Name: 38c6bddf8cf15fb358858da6da457046f40b61ce
2013-03-12 22:13:33 +00:00
dan d7e8689078 Add test cases for [4dd95f6943].
FossilOrigin-Name: 723c144c76fc171e5d19072d6d42a08013921ec6
2013-03-12 18:44:49 +00:00
dan 3da0df9d18 Add a test case for the problem fixed by the previous commit.
FossilOrigin-Name: e899b058a703158012c054974bd9a909d75144d8
2013-03-09 14:49:07 +00:00
dan 6d235cb8d8 Fix a problem with resolving "db.view.column" references that appear in UPDATE or DELETE statements executed against views.
FossilOrigin-Name: ddee56c9b2b591b9386b1072c3b3a699f7c1f853
2013-03-09 14:40:24 +00:00
drh fe7a5d11b6 Fix the char() function so that it works even if SQLITE_OMIT_UTF16 is defined.
FossilOrigin-Name: af542c82e8e7f0415530b639fa397429c5f377f6
2013-03-07 14:00:04 +00:00
mistachkin 5acefe7dbe Skip tests that require UTF-16 support when compiled with SQLITE_OMIT_UTF16.
FossilOrigin-Name: e39391422e748407d74853d3de297dc1ea6b991d
2013-03-07 09:39:18 +00:00
dan 42c4bd02f4 Fix a problem in incrvacuum_ioerr.test. Do not run ioerr6.test with an in-memory journal.
FossilOrigin-Name: 66576b450a0f0329571e344280994a964c967f8f
2013-03-06 11:44:57 +00:00
drh 459f63e7ed Fix a bug (ticket [fc7bd6358f59]) that caused incorrect query results in
three way queries that involved comparing INTEGER and TEXT columns for
equality.

FossilOrigin-Name: 7097241c1220ada318f8eda938c3e3430b94a606
2013-03-06 01:55:27 +00:00
dan b83c21e600 Do not attempt to set the permissions on an existing journal or wal file. Do this only immediately after creating a new file (or opening one zero bytes in size).
FossilOrigin-Name: 1d8086902ee96347491bce5ec04dc92ccd42efa1
2013-03-05 15:27:34 +00:00
dan e3664fb03c Add extended error code SQLITE_READONLY_ROLLBACK. Returned if a read-only connection cannot read the database because doing so would require it to roll back a hot-journal.
FossilOrigin-Name: 39247b14a52b0c0222fe5a848bf0aef0854058c4
2013-03-05 15:09:25 +00:00