Commit Graph

340 Commits

Author SHA1 Message Date
dan
188019153d Remove xShmGet/Size/Release from the sqlite3_vfs structure. Change the name of xShmPage to xShmMap. Remove some code that is now unused from os_unix.c and some of the test VFS implementations.
FossilOrigin-Name: fc0cabc15c97dde6a852b4f07df6d30f1d2c04bc
2010-06-14 14:07:50 +00:00
dan
13a3cb82ce Experimental change to the xShmXXX parts of the VFS interface.
FossilOrigin-Name: ca68472db01c14a899892007d1cbaff5e86ae193
2010-06-11 19:04:21 +00:00
dan
7df6c2c04b In os_unix.c, call munmap() to unmap a shared-memory region prior to closing the associated file descriptor.
FossilOrigin-Name: 95cc976f1520bdaedd8f93b0e9fbef94e4e2c8cc
2010-06-07 19:26:54 +00:00
drh
c11895b808 Make sure the directory used by os_unix.c for shared-memory files is always
the same, regardless of individual client permissions and environment
variable settings.

FossilOrigin-Name: f97bd520f06a16c61ccdd9ebeda7e138896b9ac2
2010-06-02 15:59:05 +00:00
drh
aab4c02e47 Changes to make WAL more robust against SHM locking failures and OOM errors.
FossilOrigin-Name: ebf4041383c3cdddb5861960359abd209d4a1028
2010-06-02 14:45:51 +00:00
drh
8b3cf82ddf The shared-memory used by WAL on linux now really is shared memory in /dev/shm.
On other unix flavors, the file is in a temporary directory rather than in the
same directory as the database.

FossilOrigin-Name: fc18c4aadb908c3b6f9b6481a2efca6a0daadc64
2010-06-01 21:02:51 +00:00
dan
72bcac9ca7 Do not hold the shared-memory mutex in os_unix.c if returning NULL.
FossilOrigin-Name: 9622dd468c8914262e9d8bd8dbca9e22ec6ee75c
2010-06-01 11:08:56 +00:00
drh
b29ad8502e Fix os_unix.c so that it will compile and build on a Mac.
FossilOrigin-Name: bc707c83e5f9849d9d201d695d0d071ca9ed93cb
2010-06-01 00:03:57 +00:00
drh
61e4acecf4 Fix issues with locking_mode=EXCLUSIVE in WAL.
FossilOrigin-Name: 8deba0cebd135a18da68530fab9e7d19dc21ddcb
2010-05-31 20:28:37 +00:00
drh
15d6809222 Fix an inconsistent #ifdef in wal.c. Fix os_unix.c so that it does not allow
moving an SHM lock directly exclusive to shared without going through unlocked.

FossilOrigin-Name: 552658da2845c2323167b6c7db6e5c00090f280c
2010-05-31 16:56:14 +00:00
drh
20e1f08e0b Get the new xShmLock interface design working on os_win.c.
FossilOrigin-Name: 149a7082e266edf0dc25c23823a9e240f5285215
2010-05-31 16:10:12 +00:00
drh
4222441dee Remove the tests that enable tracing based on the existance of the "vdbe_*"
files when in SQLITE_DEBUG mode.

FossilOrigin-Name: cdbb4e7ca7ec27e7e80dd66529d9d565f547887a
2010-05-31 14:28:25 +00:00
drh
c99597ca10 WAL runs but quickly deadlocks.
FossilOrigin-Name: ace58acbf1fad13d2be96cafebc3a22875098d03
2010-05-31 01:41:15 +00:00
drh
73b64e4d2e Initial code for incremental checkpoint in WAL mode. This check-in compiles
on unix and runs as long as you do not engage WAL mode.  WAL mode crashes and
burns.  Consider this check-in a baseline implementation for getting the new
capability up and running.

FossilOrigin-Name: ef3ba7a17ff90674d702e5694b9e792851ab6998
2010-05-30 19:55:15 +00:00
drh
026ac28b28 Change the semantics of xShmGet() such that it will never increase the size
of shared memory.  xShmSize() must be used to grow the size of shared memory.
A shared memory segment size cannot be shrunk (except by dropping it).

FossilOrigin-Name: 72de00731245277b2209103ec0a76e3d4f56530e
2010-05-26 15:06:38 +00:00
drh
1b78eaf0ba Update header comments in wal.c to correctly describe the WAL file format.
Update the locking region offsets in os_unix.c and os_win.c and add assert()
statement to verify that the locking region offsets are correct.

FossilOrigin-Name: 40030c0739f821ea8ee188c28c579507f10448bc
2010-05-25 13:40:03 +00:00
drh
c527669df5 Comment out the SQLITE_FCNTL_SIZE_HINT from os_unix.c since it does not
seem to provide any performance gain there.

FossilOrigin-Name: 7d01309da658d6b658c1b2e53bbdc5112fb0a4d9
2010-05-21 18:24:06 +00:00
drh
286a288493 Add a new xShmBarrier method to the VFS - a shared-memory fence operation.
Implement the same in both unix and win32.  Use it to make the WAL subsystem
more robust.

FossilOrigin-Name: 1bd011c9fed5ef29fb616b4d0a52df3b82221b1f
2010-05-20 23:51:06 +00:00
drh
9ff27ecdb2 Add the SQLITE_FCNTL_SIZE_HINT operator to sqlite3_file_control() and use it
to give the VFS hints about the ultimate size of a database file when the
file is growing.

FossilOrigin-Name: 2b7e3b4a30d6a7c4a8a4b8e7dd2ed728b565c96d
2010-05-19 19:26:05 +00:00
drh
5939f44375 Mark the shared-memory in the WAL implementation as volatile.
FossilOrigin-Name: 0a6787908e989bd5e6af25acbdc59ebc8fa61d6d
2010-05-18 13:27:12 +00:00
drh
ff59a114bd Fix a typo that (by bad luck) was not a syntax error but which caused some
important lines of code to be skipped when SQLITE_DEBUG was not used.

FossilOrigin-Name: 9ef99d97d25aae81df971d40ad10c544b8f30053
2010-05-14 20:15:51 +00:00
drh
d91c68f6cc Simplifications to the SHM implementation in os_unix.c, taking advantage
of the removal of the LinuxThreads mess.

FossilOrigin-Name: d1debe5def82a6bc72f11b8787176ac60259630f
2010-05-14 14:52:25 +00:00
drh
8af6c228f8 Simplify os_unix.c by removing support for LinuxThreads. Linux systems must
either use NPTL or else not share database connections across threads.

FossilOrigin-Name: e294b696ba91512b1ca5547774c51ea07b4cb5bc
2010-05-14 12:43:01 +00:00
drh
308c2a5c0f Change the OSTRACEn() macro to OSTRACE(()). Also rename some internal fields
and variables in os_unix.c to be more meaningful and searchable.

FossilOrigin-Name: 5fe529f239cddbf4b7ea57abb02d95cc0d94f5f5
2010-05-14 11:30:18 +00:00
drh
a925fd256b Change the xShmSize() implementation in os_unix.c so that it will only
increase and never decrease the size of a shared-memory segment.

FossilOrigin-Name: 149d2ae4a6fe2f86822f286d2a7092c51bec7ebb
2010-05-13 08:33:35 +00:00
drh
d9e5c4f6ed Refactoring the VFS-SHM methods used by WAL. This version compiles and
runs non-WAL test cases but crashes and burns on wal.test.

FossilOrigin-Name: 2b00152c1ac0b3735aa6cfab61259ff04d81c701
2010-05-12 18:01:39 +00:00
dan
97c1f6c8f2 Have os_unix.c use the suffix "-wal-index" for wal-index files instead of "-wal-inde".
FossilOrigin-Name: 885e854e7cdc79ecc9d5772d563ddc0f61753ab6
2010-05-11 16:29:54 +00:00
drh
09b1330026 Fix an off-by-one error while constructing the name of the mmap file for
the wal-index under os_unix.c.

FossilOrigin-Name: 6e3735f72cb7d2f4d16c8f9bc59ff159c75243e5
2010-05-10 19:51:32 +00:00
drh
1c5bb4d69c Fix an uninitialized variable in OSX proxy locking.
FossilOrigin-Name: 96d6eaf4d2be453191b36875811d9556ad0763ed
2010-05-10 17:29:28 +00:00
drh
e874d9ed79 Change the xShmOpen() method of the VFS to take the database file name as
its argument, not the WAL file name.  Also fix some unrelated compiler
warnings.

FossilOrigin-Name: a65c2939267ef6acec4e355a207f98f217e263d6
2010-05-07 20:02:23 +00:00
dan
65be0d8cce Instead of transitioning to RECOVER state from CHECKPOINT when a recovery is required, perform the recovery while holding the CHECKPOINT lock.
FossilOrigin-Name: bb0b6021e721c2e4f1533ab18381604c6b7b31d5
2010-05-06 18:48:27 +00:00
drh
ccd13d1f80 Further simplifications to the SHM locking logic. Remove the SQLITE_SHM_QUERY
option.  Unify the WRITE to READ and RECOVER to READ transitions.

FossilOrigin-Name: e9bfa6e4ce7d1edc6be8b9173ac3b6bfd180632a
2010-05-05 19:09:49 +00:00
drh
4bc79def36 Simplifications to the SHM locking implementation in os_unix.c.
FossilOrigin-Name: 9de05bfb09e29bafdf5782263330fe8eefcfaba3
2010-05-05 18:20:07 +00:00
drh
0dcb0a7d7b Fix a bug in the xCurrentTime() method of the os_unix.c VFS.
FossilOrigin-Name: 551df11a5613e3edc6c5de44f0ac6abc2d0e6cdf
2010-05-03 18:22:52 +00:00
dan
76ed3bc044 Fix a couple of errors in WAL code that can occur in an OOM situation.
FossilOrigin-Name: 9d3f3736be42ef8ab48b099d4712e08dfca97873
2010-05-03 17:18:24 +00:00
drh
1fbe0f2a8f Change the VFS definition so that all methods take a VFS object pointer as
their first parameter.

FossilOrigin-Name: 43b5b07f0d996d7ef7426346b1792e9ca898f487
2010-05-03 16:30:27 +00:00
drh
b7e8ea2015 Use VFS method xCurrentTimeInt64 instead of xCurrentTime when it is available.
Provide an implementation of xCurrentTimeInt64 for os_unix.c.

FossilOrigin-Name: ab77b3ae6da3370d8bc3b2c9c0edc723b69f5a95
2010-05-03 14:32:30 +00:00
drh
2d536e187f Change the SHM interface so that it does not take the name of the shared
object but rather the name of the WAL file and derives its own name from
that.  Remove the xShmDelete method from the VFS and replace it with a
delete flag on xShmClose.

FossilOrigin-Name: 94dea5f9c11a68564220cec76ac3fae2ba90e907
2010-05-01 20:17:30 +00:00
drh
f72a8751c9 Remove the xShmPush and xShmPull methods from the VFS.
FossilOrigin-Name: 69e07fdbde5054593de948b76dfac157cf5d4058
2010-05-01 18:23:08 +00:00
drh
bee6f4ebe2 Define an invariant to guarantee deadlock-free operation of SHM in os_unix.c
and check that invariant with assert() statements.

FossilOrigin-Name: 6af2dca75b8139134ea394c1d71aefc6523f02e9
2010-05-01 17:57:36 +00:00
drh
77b95a379c Rework mutexes on the SHM implemention for os_unix to avoid a deadlock during
WAL recovery.

FossilOrigin-Name: 1a0f69bef2c489e81a3d4b910b426972e9ed4054
2010-05-01 17:50:37 +00:00
dan
5cf53537a8 Support compile-time option SQLITE_OMIT_WAL, for building without WAL support.
FossilOrigin-Name: 9b230c43dfa112e3e1589f9775926807bd36b36e
2010-05-01 16:40:20 +00:00
drh
6dea3248ae Change the SHM VFS logic in os_unix.c so that it does not hold an exclusive
lock n the mapped memory when also holding a CHECKPOINT lock.  This
improves concurrency between readers and checkpointers.

FossilOrigin-Name: 8660cda6f8ef43bd276897ef3b5fc2376b5684dc
2010-04-30 17:47:51 +00:00
drh
400df2ea70 In the debugging output for SHM-LOCK in os_unix.c, use symbolic names
for the lock states rather than raw numbers.

FossilOrigin-Name: 2afc33de2b2012d034fb0d2057a5a45e304516ca
2010-04-30 16:48:19 +00:00
dan
43a56b812c Fix a problem in the previous commit. Both unixShm.lockState and unixShm.readLock should be set to READ when downgrading from a WRITE to a READ lock
FossilOrigin-Name: 90119fecbce06c8db82194dfd9d5045be29b1cda
2010-04-30 16:41:53 +00:00
dan
78daa5a7d9 Fix a bug whereby upgrading from a READ_FULL to a WRITE lock, and then back to a read lock was dropping all WAL locks.
FossilOrigin-Name: 55f5af5e174df7a28deeb36faa51138926669897
2010-04-30 16:38:59 +00:00
drh
d749084ad0 Fix a couple uninitialized variables in the xShmLock method of the unix VFS.
Improved debugging logic for xShmLock.

FossilOrigin-Name: 69567c5fca9e30b7660e6f56350be929c3890d7e
2010-04-30 15:54:46 +00:00
drh
5530b764a8 Separate the concepts of underlying storage size and mapped size in the
VFS shared-memory implementation.

FossilOrigin-Name: 4cbe49f13fed288f94ff305bcfd99df907bf7baf
2010-04-30 14:39:50 +00:00
dan
87bfb51ef8 Add a missing walIndexUnmap() call to the checkpoint code. Change a couple of SQLITE_CANTOPEN constants to SQLITE_CANTOPEN_BKPT.
FossilOrigin-Name: 1f9e8c5c27ae2c68bc01d8e2bb2c662be7b3f161
2010-04-30 11:43:28 +00:00
dan
e93808dde2 Add missing mutexes to unixShmClose().
FossilOrigin-Name: a4741cb54dd5e753d48fd05ac9dbe27ee4aa1ec0
2010-04-30 10:06:09 +00:00