Commit Graph

7808 Commits

Author SHA1 Message Date
drh
d5e6e4004b Fix a bug in the computation of the current time for the alternative
CURRENT_TIMESTAMP functions used when SQLITE_OMIT_DATETIME is defined.

FossilOrigin-Name: e7ded46b5efabe521008d9043dd72bd1ca748316
2010-05-03 19:17:01 +00:00
drh
324e46d424 Documentation stubs for sqlite3_wal_autocheckpoint and sqlite3_wal_checkpoint.
FossilOrigin-Name: 313762427d96954667909887a797ea996dc6304a
2010-05-03 18:51:41 +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
5e9e482fe0 Add a test to simulate an OOM during log recovery to walfault.test.
FossilOrigin-Name: 7ed85e87dd206083310ba28afab4389885f61dac
2010-05-03 18:01:21 +00:00
drh
529b18706d Clear global variable "seconds" before use in walthread.test.
FossilOrigin-Name: a35551a5305b5160b0eb511da7f8e6fb351ef271
2010-05-03 17:24:45 +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
4c846bb148 Update the crash-test VFS in test6.c to pass-through the shared-memory
methods to the real underlying VFS.  This fixes the walcrash.test script.

FossilOrigin-Name: ea09ff37911376505e8262ee9841224995b696f2
2010-05-03 16:36:55 +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
dan
af0cfd366a Have sqlite3_wal_checkpoint() handle a zero-length string in the same way as a NULL pointer. Fix "PRAGMA wal_checkpoint" so that it checkpoints all attached databases.
FossilOrigin-Name: 7fecd21f45b9ce773ffbcef6c84066474e8cd01c
2010-05-03 15:58:50 +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
e8e1c9d50e Merge the write-ahead-logging changes into the trunk.
FossilOrigin-Name: de9ae443cc8eebfb0692dcdac93bde9e4c54199a
2010-05-03 14:08:27 +00:00
dan
6fcff07f6a If the sqlite3_wal_checkpoint() API is passed a NULL pointer in place of a database name, attempt to checkpoint all attached databases.
FossilOrigin-Name: 27a5c09ce8a35039d844d08cfe5698e8b438abfe
2010-05-03 14:05:43 +00:00
drh
b033d8b9dc Make sure the mutex is held while calling sqlite3ApiExit() in
sqlite3_wal_checkpoint().  Other cleanup of WAL logic.

FossilOrigin-Name: 11a85b821abff1ecb7ec8c37bc7783be9fc4ea6d
2010-05-03 13:37:30 +00:00
dan
87c1fe1b69 Have sqlite3_wal_checkpoint() populate the database handle error message and error code (as returned by sqlite3_errmsg() and sqlite3_errcode()).
FossilOrigin-Name: ff234cf574c7ae384ab1ebc79b2171ef0541bc91
2010-05-03 12:14:15 +00:00
dan
5a299f9134 Add the "PRAGMA wal_autocheckpoint" command. Rename "PRAGMA checkpoint" to "PRAGMA wal_checkpoint".
FossilOrigin-Name: 714e5947264571386f966aa8fcdd5607b5832238
2010-05-03 11:05:08 +00:00
dan
11398e5e54 Merge two wal leaves.
FossilOrigin-Name: 23c0e6c3f333e878fe5a2ae5d61df0d765f437b4
2010-05-03 08:19:34 +00:00
dan
586b9c8a94 Add the sqlite3_wal_checkpoint() and sqlite3_wal_autocheckpoint() APIs.
FossilOrigin-Name: 9803196dec85e3aa4105cc477e9cfe98d370e486
2010-05-03 08:04:49 +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
057f1ecddb Fix a typo in the walmode.test test script introducted yesterday.
FossilOrigin-Name: dcabc90ca588281fa7a290972ec8af6816932489
2010-05-01 11:33:13 +00:00
drh
7aba8fdef7 Fix the sqlite3_mutex_alloc() interface to return NULL (not segfault) when
operating in threadsafe mode.  (This is a general-purpose bug fix which
really ought to be ported to trunk.)

FossilOrigin-Name: 64840a3caf569959c9d5e63bdbc0cf675fda3882
2010-05-01 11:19:07 +00:00
dan
bb16ff75dd Add test case demonstrating deadlock during recovery of very large log files. No fix yet.
FossilOrigin-Name: 63ea318eb19d264667909c70185b8a5cdc4454c0
2010-05-01 08:30:34 +00:00
drh
d80b233850 Do not allow journal_mode=WAL if the underlying VFS does not support xShmOpen.
FossilOrigin-Name: d1fcccecdc8e9ac5d0d022914e51c545f4e1b04f
2010-05-01 00:59:37 +00:00
drh
27d52b2b19 Merge in changes from the trunk.
FossilOrigin-Name: 76bf0eee1fd4003a3f1c39922f8f059611d41dd0
2010-04-30 22:28:06 +00:00
drh
be837bddad Avoid assertion faults in queries using indices with redundant columns.
Ticket [3dbdcdb14e7f41].

FossilOrigin-Name: 946e06cd2a2cc209b0786b7e9d28c0746320d646
2010-04-30 21:03:24 +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
1b48aa49a4 Remove some obsolete debugging parameters.
FossilOrigin-Name: a012aed498bf41a5f6f3006182b0c4c2ab0fe1bb
2010-04-30 17:28:35 +00:00
dan
fe05aa144c Fix a problem with resizing the wal-index mapping after the mapping has been extended by an external process.
FossilOrigin-Name: 79d356fea6008a8adf8ebd4906571375f3cf5213
2010-04-30 17:05:23 +00:00
dan
c9d53dbe5a Fix a problem with calculating the required size of the wal-index when appending frames.
FossilOrigin-Name: 9526b11130f3ed2f5227386a26263c767214603a
2010-04-30 16:50:00 +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
dan
30c8629e67 Reapply commits [837d82a929] and [c05e7dca17] that were accidentally overwritten.
FossilOrigin-Name: 598de52700ba13e3228289220a74fc62073c62d4
2010-04-30 16:24:46 +00:00
dan
6ddb4bf938 Add xShmXXX() methods to the test VFS in test_devsym.test.
FossilOrigin-Name: 1d20342424b452ea96aaf161de1f98f26a9155a0
2010-04-30 16:19:39 +00:00
drh
49156b2b5e Correctly record the fact that the SHM lock reached PENDING if it did so
but failed to reach CHECKPOINT.

FossilOrigin-Name: d9250e84ac1fc6590f8670e1d801630650c7846a
2010-04-30 16:12:04 +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
dan
a7ad518ef0 When closing a WAL connection, attempt an exclusive lock on the database file. If the lock is obtained, checkpoint the database and delete the wal and wal-index files.
FossilOrigin-Name: c05e7dca172719f33e245c08d0c0e8ab47e5a537
2010-04-30 15:49:27 +00:00
dan
6045461eee If a reader attempts to upgrade to a writer, but is not reading the most recent database snapshot, return SQLITE_BUSY.
FossilOrigin-Name: 837d82a92977cbfa0963411daf8160d286a7ed32
2010-04-30 15:24:43 +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
1bc6171c23 Fix an assert() in sqlite3WalRead().
FossilOrigin-Name: 2e7a0050e192dd197d4db92393ab120897c14836
2010-04-30 10:24:54 +00:00
dan
e93808dde2 Add missing mutexes to unixShmClose().
FossilOrigin-Name: a4741cb54dd5e753d48fd05ac9dbe27ee4aa1ec0
2010-04-30 10:06:09 +00:00
dan
4c97b53425 Fix a couple of assert() statements in os_unix.c and wal.c. Combine sqlite3WalIsDirty() with sqlite3WalUndo().
FossilOrigin-Name: a8f958be804ee05c4137b3cd110db344713af5f2
2010-04-30 09:52:17 +00:00
dan
ba51590bcd Add a missing walIndexUnmap() to sqlite3WalSnapshotOpen().
FossilOrigin-Name: 72b95fde15dae56390dc8d4168fb2757447e289e
2010-04-30 09:32:06 +00:00
dan
5047af405b Merge latest bugfix into wal branch.
FossilOrigin-Name: 265e66e6984c32999bf93981e3b1d19887dfe599
2010-04-30 06:02:30 +00:00
drh
79e6c78ccc The first 6 WAL tests now work. It's a start.
FossilOrigin-Name: a92c1851da10acf51e7f6f086b8a23bd731940b3
2010-04-30 02:13:26 +00:00
dan
6908343c65 Zero the "immediate FK constraint counter" associated with a statement object when sqlite3_reset() is called. Fix for [c39ff61c43].
FossilOrigin-Name: f660be615a0c1f4641782a83744533f5d3119218
2010-04-29 22:57:56 +00:00