Commit Graph

10662 Commits

Author SHA1 Message Date
drh
a539c8a464 Add a comment to xUnfetch on windows to say that the call to winUnmapfile()
might be unnecessary.

FossilOrigin-Name: e3c63c31a21b27806592d066a013a111b280c61f
2013-04-01 18:25:48 +00:00
drh
db56bcbe42 In windows, round down the size of the memory mapped region to the next
smaller multiple of the page size.

FossilOrigin-Name: 0e44ed1badde6d766f18d1373d968e5b286b15bd
2013-04-01 18:15:50 +00:00
dan
57d6b25ec9 Merge accidental fork.
FossilOrigin-Name: 5f4437c0e35c8aa740515aac3e81e0146716d2bb
2013-04-01 17:58:10 +00:00
dan
e6ecd6630d Attempt to emulate mremap() on non-Linux systems by allocating a second mapping immediately following the first in virtual memory.
FossilOrigin-Name: 4d67433db8fb4754ae6b192945e479f3d7bad579
2013-04-01 17:56:59 +00:00
drh
f9d18e472b Bug fix in the winMapfile() subroutine: Be sure to record the map object
handle in the sqlite3_file object.

FossilOrigin-Name: ee4d188e207efa24a26776fa4f025c6ac39cce73
2013-04-01 17:56:28 +00:00
drh
5175b324b8 Add xFetch and xUnfetch methods to the os_win.c VFS.
FossilOrigin-Name: a1653a257d6af6e8b10c819e68b12f6c2f485811
2013-04-01 17:22:51 +00:00
dan
f55a4cf80c Ensure that a checkpoint does not use an out-of-date mapping.
FossilOrigin-Name: a1040f0397d57855500926494c978623286ddc77
2013-04-01 16:56:41 +00:00
dan
0943f0bdc8 Fix a typo in a log message in wal.c.
FossilOrigin-Name: 83fc48d16572443373e5de62adbd4cd53c2f7786
2013-04-01 14:35:01 +00:00
dan
71be5c5c87 Fix a problem in btree.c that could cause a crash following an OOM.
FossilOrigin-Name: b724aa5889f2e09cf0cbef133a672e6486755104
2013-04-01 14:29:33 +00:00
drh
6c5696381e Fix a comment in os_unix.c. No code changes.
FossilOrigin-Name: 72813b8ec924b91583c679668f7c4561dff82a02
2013-03-26 18:48:11 +00:00
drh
c86e51358b Change the name of the Pager.pFree field to Pager.pMmapFreelist.
FossilOrigin-Name: 611bd824c24a60d298f28705de323fa2e813a308
2013-03-26 14:36:11 +00:00
dan
0aed84d19f In btree.c, save the positions of any open cursors before moving any pages around to auto-vacuum the database on commit.
FossilOrigin-Name: 30c0a69363931a72d1c34e5be71646932398d172
2013-03-26 14:16:20 +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
dan
b7e3a326fe Use mremap() on Linux.
FossilOrigin-Name: 431aecc8600c29c203546e48d256510510238887
2013-03-25 20:30:13 +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
df737fe6f5 Change the signature of the xUnfetch method to "int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p)".
FossilOrigin-Name: 115b830509e8f0aa9d5965c1e9cd4f2ed9d01938
2013-03-25 17:00:24 +00:00
dan
aef49d7141 Remove unnecessary code to round the size of a memory mapping to 4KB from os_unix.c. Rename SQLITE_IOERR_MREMAP to SQLITE_IOERR_MMAP. Fix other small issues in os_unix.c.
FossilOrigin-Name: dce35c01a5fe66d2970075b1e3f0376026485e4c
2013-03-25 16:28:54 +00:00
dan
11ac84635b Do not return SQLITE_IOERR when the user attempts to open a small file that is not a database with mmap enabled. Instead return SQLITE_NOTADB.
FossilOrigin-Name: bbcaab3e80d0ff776d8567094b137d1483b3377b
2013-03-25 14:31:39 +00:00
dan
a1afc7425a Fix a case in the pager where an xFetch() reference was being leaked following an OOM error.
FossilOrigin-Name: 5885ba6ce768658ec25b60747430d147b315b55c
2013-03-25 13:50: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
drh
dba0cb2351 Remove the SQLITE_OMIT_MERGE_SORT compile-time option and its related code.
The merge sorter is now a required component.

FossilOrigin-Name: 8b44d6fb159e85267095e846cded2764c3bcb895
2013-03-24 22:56:49 +00:00
dan
f23da96636 Replace the sqlite3_io_methods.xMremap interface with sqlite3_io_methods.xFetch and xUnfetch.
FossilOrigin-Name: 1431be95579160fb70408d43e17fc23c7b69ab4a
2013-03-23 21:00:41 +00:00
dan
e5586a1a79 Improve a comment in wal.c. No code changes.
FossilOrigin-Name: 60b9f5e4dd2af54975ba78437239f0bebd472fd2
2013-03-23 17:29:06 +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
mistachkin
2753388e8a In the winMremap VFS function, unmap the region prior to attempting to truncate the file.
FossilOrigin-Name: 8870c4cc6cda07154936644f7df25bd81d6ba38a
2013-03-23 12:15:27 +00:00
mistachkin
46fce002d9 Do not unmap the mapped file region in winTruncate as there may be outstanding pointers to it.
FossilOrigin-Name: f57a9c91e993f76ce8b923e06e721414980e8e61
2013-03-23 10:09:46 +00:00
mistachkin
daf9a5a402 Preliminary changes to support the xMremap VFS method on Windows.
FossilOrigin-Name: 75a85a1c6ac59f2d021c28fa2161afb1118deea4
2013-03-23 09:56:39 +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
drh
23f29ec628 Fix a potential NULL-pointer dereference in btreeSwapOutMmap().
FossilOrigin-Name: e81ccdcd87a1387f7ca08d4d7c899311e2180d32
2013-03-22 19:56:27 +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
dan
99bd10979a Allow the database file to be memory mapped in wal mode.
FossilOrigin-Name: d190ddabc386bc9654b99e33fb81b2f6e67b54d6
2013-03-22 18:20:14 +00:00
dan
c00033125d Add a fix for the assert() statements added by the previous commit.
FossilOrigin-Name: 19345416ed5e1ab5b0b35993b0b9069c2fb1683b
2013-03-22 17:46:11 +00:00
dan
6101d50471 Add assert statements to os_unix.c to ensure that any mapped region of the database file is not being read or written using the xRead() or xWrite() methods.
FossilOrigin-Name: 765615f9fba7c1765eb741cb98a09a28b464ee55
2013-03-22 08:58:38 +00:00
mistachkin
48864df97d Many spelling fixes in comments. No changes to code.
FossilOrigin-Name: 6f6e2d50941e444ebc83604daddcc034137a05b7
2013-03-21 21:20:32 +00:00
dan
b26e6c14fe Fix cases where xRead() was being used to read from a memory mapped part of the database file.
FossilOrigin-Name: 5c9e9df27b9f2c46cd55388a858d4e78ee564975
2013-03-21 20:39:55 +00:00
dan
7c49427fc2 Avoid calling xRead() on a part of the database file that is memory mapped.
FossilOrigin-Name: c8eac290a7240d69494bd0dad5ed1fdc2505f703
2013-03-21 20:00:07 +00:00
dan
5b068f8632 Fix a problem when opening a write-transaction while there exist read-only b-tree cursors in mmap mode.
FossilOrigin-Name: 32e0bbb73609ac3ad096a60f1de3095bc79fb0cc
2013-03-21 15:57:32 +00:00
dan
c71b45e619 Do not use the Linux mremap() call. Use the same strategy for xMremap() as on OSX instead.
FossilOrigin-Name: 5ed8ad780c991d2ca44003ee84350fb5e95ad58e
2013-03-21 14:47:47 +00:00
dan
d306e1a3a1 Optimize the xMremap method in os_unix.c some.
FossilOrigin-Name: 9529ed88a71fee02fae72dc86f0669bd6856ff92
2013-03-20 18:25:49 +00:00
dan
eb97b29345 When possible, use memory mapping when appending new pages to a database file.
FossilOrigin-Name: 14135da3cdbafd699563a29608f32347cda28338
2013-03-20 14:26:59 +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
drh
339d6c6d17 Bring makefiles and build scripts into alignment with the sessions branch.
No changes to code.

FossilOrigin-Name: d1f41089aba075eef45fd696599e5d3a74c84d0c
2013-03-19 16:12:40 +00:00
drh
ce3ca25cbc Clarifications to the documentation for the sqlite3_aggregate_context() API.
Also, shorten an over-length source line in sqlite.h.in.

FossilOrigin-Name: 4fe2db1d866c80fe51f7fddbf9ce6753fb55b5f6
2013-03-18 17:18:18 +00:00