Commit Graph

7940 Commits

Author SHA1 Message Date
dan
0cc5b2b6c6 Fix a bug in checkpoint introduced by [181ceb32ea].
FossilOrigin-Name: b499dbc88a67b4200b5f527be88be4ac90f7043f
2010-05-31 11:39:53 +00:00
dan
d54ff60bf4 Fix some asserts and other things in the new WAL branch.
FossilOrigin-Name: 181ceb32ead7f540a7c6437f53a5b0f3e78162db
2010-05-31 11:16:30 +00:00
dan
8521abfd48 Changes to the way one of the WAL/OOM tests works.
FossilOrigin-Name: 15abbc34168f7a5bd418254c2b16aac97029e6ea
2010-05-31 06:38:34 +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
dan
a7a0c615d7 Add tests to fkey2.test to check that ON CONFLICT clauses do not affect SQLite's behaviour when an FK constraint is violated.
FossilOrigin-Name: e9e5b1001986348ef0f88c19de87b94559a5451e
2010-05-29 08:40:37 +00:00
dan
94b7f76b96 i
i
Minor changes to checksum related test cases.

FossilOrigin-Name: 60c22bde52121993d4bea11eef38ab285c737e2c
2010-05-29 06:18:54 +00:00
dan
5f168a5d53 Add a test to walcksum.test to stress the checksum calculation.
FossilOrigin-Name: 778d0c1768f73057be912793631e0cf0575858fb
2010-05-28 04:16:28 +00:00
drh
bab7b91e99 Make sure the wal-index mapping is always large enough to cover the entire
active area of the wal-index.

FossilOrigin-Name: 42705babba0e9d2ef078845854bebbd168f23366
2010-05-26 17:31:58 +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
51b21b169a Updated header comments in wal.c. No functional code changes.
FossilOrigin-Name: 687632a6b3a0aeb006c1eda5c27d5489f08c230e
2010-05-25 15:53:31 +00:00
dan
fa408ada0a Add a busy-handler to a test case in walthread.test to prevent errors.
FossilOrigin-Name: d3d348aa975c58c37088eb2830081880896b85e7
2010-05-25 15:23:51 +00:00
dan
d77766edf7 Modify walcrash2.test so that it works with DEFAULT_AUTOVACUUM=1.
FossilOrigin-Name: 77438882dd53ac4d98b24e2846c87a2418b4e3d8
2010-05-25 13:49:09 +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
dan
ca6b5baba4 If a writer exits unexpectedly in the middle of a transaction, have the following writer remove any wal-index hash-table entries left by the interrupted transaction.
FossilOrigin-Name: ed77556adcdf7011b95b9969b360269fb2ebe4e5
2010-05-25 10:50:56 +00:00
drh
82043b3077 Remove unreachable code associated with WAL from the pager.
FossilOrigin-Name: 54c1718e6d15a20414cae15895eb5e83217722e2
2010-05-25 02:24:01 +00:00
drh
f53303573a OOM errors during an auto-checkpoint are benign.
FossilOrigin-Name: 3d252ce5d0d843e4e65beed672598e65c5745129
2010-05-24 20:27:44 +00:00
drh
0b9441354b Remove the walmode.test case from the inmemory_journal test of
permutations.test.

FossilOrigin-Name: 27ba9c21fb591190b73010ced394cc62c1edff54
2010-05-24 20:24:38 +00:00
drh
c2857bf2a5 Fix the wal2.test script so that it works in auto_vacuum mode.
FossilOrigin-Name: 6a818afb93ca8383abb55e3835e14c74c3e3de23
2010-05-24 17:00:19 +00:00
dan
71d8991932 Change the checksum used in WAL files so that each frames checksum depends on the content of the WAL header and all frame headers and content up to and including the frame to which the checksum is attached.
FossilOrigin-Name: 8a53f12c83a107684b99f4a9de371b5ea3ca810a
2010-05-24 13:57:42 +00:00
drh
c81791573a Make sure a WAL frame of all zeros is detected as an invalid frame.
FossilOrigin-Name: 02d99ad4b51065c67cc7689916130774be1c4c87
2010-05-24 13:28:36 +00:00
drh
00f699d57b Fix up test_osinst.c to work with SQLITE_OMIT_VIRTUALTABLE.
FossilOrigin-Name: 51fd38152b92db637d1d346fca35ec2d3e4d4f57
2010-05-24 12:34:14 +00:00
dan
b8fd6c2fe6 Change the WAL file format to support two kinds of checksums - one that is fast to calculate on little-endian architectures and another that is fast on big-endian architectures. A flag in the wal-header indicates which the file uses.
FossilOrigin-Name: 65ba804dd1d31d1eef6ae3f40a3ade344a410b84
2010-05-24 10:39:36 +00:00
dan
9c0928dcb6 Add a couple of missing methods to test_osinst.c..
FossilOrigin-Name: 5c9e9c06ae350043e66f36087da4021a52e6ee17
2010-05-22 08:22:39 +00:00
drh
4fa95bfc39 Add several EXPENSIVE_ASSERT code blocks to validate the wal-index hash table.
Fix the bugs that these code blocks fine.  Rename walClearHash() to 
walCleanupHash() and simplify its interface.

FossilOrigin-Name: 7aade899e55f4565f02d301e1e83fb0bac2ea500
2010-05-22 00:55:39 +00:00
dan
3b1eca0ade Fix another bug in walClearHash().
FossilOrigin-Name: 40f80ffe70ca691dfa146f6d84956ed0784fc63d
2010-05-21 19:15:04 +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
dan
8067adbc3f Correct an off-by-one bug in the previous commit.
FossilOrigin-Name: 75a1130d86faf18e73cb46cda5d029f1e913e4e6
2010-05-21 16:23:43 +00:00
dan
6f1501481f Remove entries from wal-index hash tables when a rollback or savepoint rollback occurs.
FossilOrigin-Name: 36795c2b23a78978528cace193e386138adacd41
2010-05-21 15:31:56 +00:00
drh
f0b20f8801 Fix the wal-index header read routine so that it correctly detects a zero
header as being malformed and in need of a wal-index rebuild.

FossilOrigin-Name: 1a4eb3a3efe86c7caff4d9a5894953bce378f841
2010-05-21 13:16:18 +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
7e263728f2 Make use of the extra information in the WAL header and frame header to
enhance robustness.

FossilOrigin-Name: 9580ecb7e3beb1949a71784a3dcd1823a88e4a9d
2010-05-20 21:21:09 +00:00
drh
23ea97b641 Convert the wal-header and frame-header to 24 bytes. Extra information in
both headers is designed to enhance robustness after crashes, though the
extra information is currently unused.  This is a snapshot of a work in
progress.

FossilOrigin-Name: 669706431f186f92fdc0856a6206419a1e843f46
2010-05-20 16:45:58 +00:00
shaneh
7c767e1113 Merge WIN32 WAL support into trunk. Still some issues with locking to resolve.
FossilOrigin-Name: 43377663fc3569c361867cdea19e8abaf91a163f
2010-05-19 23:41:55 +00:00
drh
f5d6e478d3 Add the SQLITE_FCNTL_SIZE_HINT to the os_win.c VFS.
FossilOrigin-Name: 9894118d20c08951565c2096552d4a3d2413f7b0
2010-05-19 19:39:26 +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
4c1cb6ab05 Fix a bug in the new checkpoint computation. Also update the checkpoint
algorithm in the test scripts to align with the new implementation.

FossilOrigin-Name: 8b6056f2ee596f31b157a792fac05d11f7cb63bb
2010-05-19 19:09:37 +00:00
drh
584c754d65 Revise the checksumming algorithm in wal.c. More variable refactoring.
FossilOrigin-Name: 542b90eba6440a0bccef329788fd17a2d3fbeee6
2010-05-19 18:08:10 +00:00
drh
6e81096fa2 Refactoring some variable names in wal.c.
FossilOrigin-Name: 1d201ff51f7c5ecdf71a91ed25204b7130894282
2010-05-19 17:49:50 +00:00
drh
027a128a78 Add a large comment to wal.c describing the WAL and wal-index file formats.
FossilOrigin-Name: a71a22b52f4570e934063553a81b39268127dc44
2010-05-19 01:53:53 +00:00
drh
29d4dbefaf Update the wal-index hash format so that hash-table space is reused following
a rollback, thus preventing hash table overflows.  Add assert()s to verify
that hash tables do not overfill.  Further refactoring of the wal-index code.

FossilOrigin-Name: ada9a8c7b69c5dd2d66bbf62b61181651e6d2142
2010-05-18 23:29:52 +00:00
drh
a2a42013d2 Refactoring of the WalIterator implementation.
FossilOrigin-Name: b5b60fdcc5dcf41f2c79912075ac241f7ce220d6
2010-05-18 18:01:08 +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
e730fec883 Comment clarifications in wal.c.
FossilOrigin-Name: a029be10172e2e6a2ef4e3eb2ea1bd0ca85b16ed
2010-05-18 12:56:50 +00:00
drh
69c4696784 Remove an unreachable test from wal.c.
FossilOrigin-Name: 7162c45673d1068d1fda55a70207a3cd77575502
2010-05-17 20:16:50 +00:00
dan
982d4c0c72 Add a note to the documentation of sqlite3_wal_hook() to say not to return SQLITE_ROW or SQLITE_DONE. Or any other value that is not a valid SQLite error code.
FossilOrigin-Name: 2f0b6cbf7b4fa31242ff4f6163226c22ae4f8c9b
2010-05-15 10:24:46 +00:00
drh
89c3f2ff43 Silently ignore errors trying to set the default journal_mode while doing
an ATTACH.

FossilOrigin-Name: b9af4ad2efadfb2fb9e338dc081a6231f1536700
2010-05-15 01:09:38 +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
5c092e8a4f Make sure the value of an INTEGER PRIMARY KEY column supplied to triggers
and especially to FK constraints really contains the ROWID and not the
NULL that is stored in the column itself.  Ticket [dd08e5a988d00dec].

FossilOrigin-Name: 636f86095eb1f4bdcfb0c9ed846c4c6b3589c10b
2010-05-14 19:24:02 +00:00
drh
8323521440 Pull in all the latest changes from the trunk.
Update the win32 SHM methods to work with the new interface design.

FossilOrigin-Name: 4b69f2cd315b6b66d10e5190d235114788853258
2010-05-14 16:34:34 +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
dan
a9f0fc8edc Fix test_osinst.c so that it does not depend on gettimeofday() unless SQLITE_OS_UNIX is defined and NO_GETTOD is not defined.
FossilOrigin-Name: 2a4014b79b852d8b62b4941495b826f154308d86
2010-05-14 10:43:28 +00:00
dan
14740f1cd5 Add xShmXXX methods to test_osinst.c.
FossilOrigin-Name: b8a9b37a3c8d1005a16185c1fc4c414ca11d736a
2010-05-14 08:39:48 +00:00
drh
72339a3e24 Make debugging elements of the sqlite3_mutex object volatile and make them
only appear when compiling with SQLITE_DEBUG.  Ticket [51914f6acd2cb462].

FossilOrigin-Name: e823c60ca4c3d515b8b12dada4631fe8f44975e9
2010-05-13 20:19:17 +00:00
drh
5cccc940cc Allow sqlite3WalCheckpoint() to be called even if the WAL is in the
SQLITE_SHM_READ state, as sometimes happens after an error.

FossilOrigin-Name: 175b296f9b9680f605537f52a8a53944deaa5391
2010-05-13 15:44:00 +00:00
dan
0bfad1171f Remerge mistaken test_osinst.c changes.
FossilOrigin-Name: e8c10d3cf601cc81a620f6c0ba5f195945a3f725
2010-05-13 09:40:30 +00:00
dan
a49ba7c835 Fix mistake in test_osinst.c.
FossilOrigin-Name: 4c3e137803f86ec5a6c68bfaa29a2847ba48fd65
2010-05-13 09:32:30 +00:00
drh
5500a1f1e6 Make sure xShmGet is never called while already holding the shared-memory
segment.

FossilOrigin-Name: 92ebdbc5f64ac63796ff56c1e1aec3b95c6bdd20
2010-05-13 09:11:31 +00:00
drh
043c20e63e The refactored of VFS SHM primitives are now working so merge the
wal-refactor branch back into the trunk.

FossilOrigin-Name: bce21c18380715e894eac9c173c97315e0d69d93
2010-05-13 08:53:41 +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
dan
bd50ddeb42 Fix for a segfault that can follow a malloc failure.
FossilOrigin-Name: 3cab9022457ce50f82c5822d8ba6c04a3a85cb6a
2010-05-13 07:08:53 +00:00
dan
7fd555a634 Modify the VFS in test_vfs.c to match the refactoring of the xShmXXX methods.
FossilOrigin-Name: 25e72f81561575051c63e9bf5d2c8e76f9fcf5c6
2010-05-13 06:19:37 +00:00
dan
fbefb894cc Change the vfs instrumentation code in test_osinst.c to make it easier to deploy. Add a vtab implementation for reading the binary log file format.
FossilOrigin-Name: ee13c8849d234931bb3be36e42383d228b3cbfcb
2010-05-12 19:02:35 +00:00
drh
365e2d255b Fix for the test_devsym.c test module for the VFS-SHM refactoring.
FossilOrigin-Name: 49d62933759d4e160ee3a4dd2aa316a2f5bbb4e6
2010-05-12 18:30:36 +00:00
drh
686138fe88 A couple simple fixes to get wal.test mostly working.
FossilOrigin-Name: c74458127468f30b16715594c8d68e9d3c05d292
2010-05-12 18:10:52 +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
shaneh
50f6455f41 Updates to WAL support in os_win.c: pulled in latest changes from src/os_unix.c; updated tracing; misc. improvements.
FossilOrigin-Name: 76504726a1ef7f6a0445ec800776462138b22d72
2010-05-12 17:14:59 +00:00
drh
eaf52d883a Remove the OP_Variable optimization of check-in [48b77b04935d894] since it
can lead to malfunctions as described in ticket [26ff0c82d1e90].

FossilOrigin-Name: 7838163d087780a6fb403a17641b96f71baec088
2010-05-12 13:50:23 +00:00
dan
ed36020daf Remove a branch made redundant by the earlier exclusive-mode changes.
FossilOrigin-Name: c501b2ede6aad123bef0aa7ce8b356a134eb6d26
2010-05-12 06:54:31 +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
be5481578a When an attempt to change journal_mode fails due to locks, be sure to
leave internal structures in a consistent state.

FossilOrigin-Name: cf3d1e0b8a739302cf2848ac3e6eaaae04e6a44c
2010-05-11 14:00:39 +00:00
dan
5543759b1b Changes so that WAL and exclusive-locking mode work together.
FossilOrigin-Name: 71e7b1cf9f4cd02a2a9bc8a3e58acd7a7e3c7e60
2010-05-11 12:19:26 +00:00
shaneh
04882a9e4a Initial port of WAL VFS support from os_unix.c to os_win.c.
FossilOrigin-Name: 111ad59f21d53d1ec63c084ca5f98f2aaf7cd070
2010-05-11 02:49:39 +00:00
shaneh
a10069dd22 Updates for to WAL TCL test scripts to support running on Windows.
FossilOrigin-Name: 6a5630806c87b0f4e5632c37c357f98effd9608a
2010-05-11 02:46:16 +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
dan
7ddccd2aad Merge [96d6eaf4d2] and [40b0a6357b].
FossilOrigin-Name: c67756c404669141fa06a1ce3f1efadefa277bc6
2010-05-10 18:10:17 +00:00
drh
1c5bb4d69c Fix an uninitialized variable in OSX proxy locking.
FossilOrigin-Name: 96d6eaf4d2be453191b36875811d9556ad0763ed
2010-05-10 17:29:28 +00:00
dan
bb23aff3df Modify the format of the wal-index to use a hash table to index log file segments.
FossilOrigin-Name: 40b0a6357b160e04326ab176955a68a1cf3f8b7c
2010-05-10 14:46:09 +00:00
drh
acd0781892 If an ATTACH command files due to OP_JournalMode but still attaches the
database, make sure VACUUM still detaches it when done.

FossilOrigin-Name: 6ecdc7ba2b5e79e8b5862fb49cf6c2b99a40659a
2010-05-10 14:10:57 +00:00
drh
ab9b74443c Enhance the OP_JournalMode opcode with an ignore-errors option and use that
option the ATTACH command.

FossilOrigin-Name: 0bdea4cfbd7832f2a00c01b93c92ba13d20139ef
2010-05-10 11:20:05 +00:00
drh
2905f053ef When running a checkpoint while in locking_mode=EXCLUSIVE, be sure to move
the wal-index lock to UNLOCK from READ prior to promoting to CHECKPOINT.

FossilOrigin-Name: be114bdf9bb98c7287f8cb54340c630b0c412e9d
2010-05-07 20:34:17 +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
drh
6a2607a131 Additional tweaks to API documentation. No functional code changes.
FossilOrigin-Name: e1230782a371f09cd46dacc8ecbc6a0c5baab2d5
2010-05-07 18:23:24 +00:00
drh
005e19c4c1 Updates to documentation on the C interfaces supporting WAL. No functional
changes to code.

FossilOrigin-Name: 681ba20cf077e9a0fccd51ed50101ad0f2c67eb3
2010-05-07 13:57:11 +00:00
dan
c6315a44b2 Fix a recently introduced problem in wal.test.
FossilOrigin-Name: 79b52d0ff7a7b717bde55b97ff05ad17418bc7d7
2010-05-07 13:52:42 +00:00
dan
65bddc1223 Change wal.test and walhook.test so that they work with DEFAULT_AUTOVACUUM=1 builds.
FossilOrigin-Name: 4cde92909c20982f7d4e6b550f55d786df398ccd
2010-05-07 12:49:22 +00:00
dan
65f2ac58b6 Test another IO error case in wal.c.
FossilOrigin-Name: 8b3b5ab8fa61ca4ef22c98abaab397707ee74ea3
2010-05-07 09:43:50 +00:00
dan
998ad21271 Fix a problem with checkpointing large log files created by an external process.
FossilOrigin-Name: 8f94bde568be52ecc5a976b7a09776ea7b4bb511
2010-05-07 06:59:08 +00:00
dan
846705021d Since walIndexTryHdr() can no longer encounter any error conditions, change tehe function signature so that it does not return an error code. This removes unreachable branches from other code.
FossilOrigin-Name: 061a282cc0bf76541ab1f99b351a49d489ff93ec
2010-05-07 05:46:23 +00:00
drh
2c47d194a2 Another attempt to fix permutations.test so that it excludes WAL tests
from the journaltest permutation.

FossilOrigin-Name: 58c404429c5af167a82899fc4c736ed7489ed746
2010-05-07 00:28:41 +00:00
drh
6763e3550d Remove savepoint6.test from the set of tests run by journaltest since
savepoint6.test uses journal_mode=WAL.

FossilOrigin-Name: 811b45a96bfaa0ef2394b86c06e8f099a07ee9f0
2010-05-06 22:21:14 +00:00
drh
3ebaee9633 The PRAGMA journal_mode=WAL; command now makes WAL the default journal mode
for new databases added with ATTACH, so the behavior is consistent with the
other journal modes.

FossilOrigin-Name: c3520460a4a39fc5e981c3033068ffbb422a4af2
2010-05-06 21:37:22 +00:00
drh
72af0774f9 Make sure to do a clean shutdown of the library upon existing the shell
in order to remove WAL files.

FossilOrigin-Name: c1762dda00b8bdb7c3247617ac4cb654f1d95cf7
2010-05-06 20:19:55 +00:00
drh
fb4a626da0 Exclude all WAL tests from the journaltest permutation.
FossilOrigin-Name: 46c97d7eee9359cd21139a6520633f5d16594ab0
2010-05-06 19:55:57 +00:00
shaneh
fd06863881 Changes to support SQLITE_OMIT_WAL.
FossilOrigin-Name: 32a8501d78714cc390eba5f993f329ef3b499878
2010-05-06 19:20:29 +00:00
drh
08fba00781 Updates to the VFS SHM locking documentation.
FossilOrigin-Name: 9927ce421090ac20285cf05768b38e1f91826a68
2010-05-06 19:04:48 +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
dan
5273f58f37 If recovery is run before a checkpoint, change back to a CHECKPOINT lock before performing the actual checkpoint.
FossilOrigin-Name: dc98ee169cfa43c89f1b36fb1150d4788710fda3
2010-05-06 18:27:19 +00:00
dan
576bc3294d Only pass -1 as the size parameter to xShmGet when the caller does not care what size mapping is returned. Only call xShmSize when the underlying allocation (not the mapping) should be resized.
FossilOrigin-Name: 637f51ddf9e4a57e1f171b6d2c6c93152074267e
2010-05-06 18:04:50 +00:00
dan
b7d53f54ae Fix a bug whereby an old snapshot could be checkpointed (and subsequent transactions discarded) if the last connection to disconnect from a WAL database happended to be holding an out-of-date wal-index header.
FossilOrigin-Name: d0c0034b0baa83046c1d6b94c886f7039e4e06f5
2010-05-06 17:28:08 +00:00
drh
6e5b37faef After throwing an error to say that one cannot change into WAL mode within
a tranactions, do not then go and change into WAL mode.

FossilOrigin-Name: 56a17dae91600a3863903f8d654ed52a0f720caf
2010-05-06 16:06:38 +00:00
dan
d41a29a653 Further coverage tests.
FossilOrigin-Name: 98a9713e0030a36ea99a18a12a2e7685c6db72b3
2010-05-06 15:56:28 +00:00
shaneh
84aab39782 Update configure scripts for WAL support.
FossilOrigin-Name: 2edc5129f216abec9b13a0ad9b6640606caa9f72
2010-05-06 15:35:59 +00:00
dan
a861469a07 Add tests to cover a couple of branches in wal.c.
FossilOrigin-Name: 429f437fb776fc974a6adf791b729e25bea82fef
2010-05-06 14:42:34 +00:00
dan
c9e4665e7d Unset a tcl variable before reusing it in wal.test.
FossilOrigin-Name: e83efb232fe8d30714f4c7cffeef80092aea4df7
2010-05-06 13:36:47 +00:00
dan
ff6dfc73fe Add tests for some lock-contention cases.
FossilOrigin-Name: f0fcb9c9a67e2bf7bbedbedbc27791b605a21dd1
2010-05-06 12:15:48 +00:00
drh
e404de05c0 Remove the noop-mutex implementations of mutex_held() and mutex_notheld()
since they are both unreachable.

FossilOrigin-Name: 6767b62a9a063582889f5ceb42f95eab24c697da
2010-05-06 11:56:52 +00:00
drh
24e3971197 Add two text files containing pager design notes to the doc/ subfolder.
FossilOrigin-Name: ed817fc893e7162ae0ff4022591f7e9e3b81d622
2010-05-06 11:55:56 +00:00
dan
9a6b4e9adb Add test cases to test the libraries handling of corrupt wal-index headers.
FossilOrigin-Name: 9465b267d420120c050bbe4f143ac824146a9e4a
2010-05-06 11:32:09 +00:00
dan
8f6097c244 Add tests for handling errors returned by xShm VFS methods.
FossilOrigin-Name: fbbcacb137e8f5246b88ad09331236aaa1900f60
2010-05-06 07:43:58 +00:00
drh
5def0843f1 Change the behavior of the sqlite3_wal_hook() callback. It should now return
SQLITE_OK or an error code and the error code is propagated back up the 
stack.  If a checkpoint is desired, the callback should invoke
sqlite3_wal_callback() itself.

FossilOrigin-Name: 1b14195e05fe5551992a39246ec3bcf6a33bbfac
2010-05-05 20:00:25 +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
dan
c7991bdf29 Test the handling of errors returned by the xShmXXX() APIs.
FossilOrigin-Name: 72663123d6be2b194cad7a6057d0f20dd0d9fe05
2010-05-05 19:04:59 +00:00
drh
5c10f77d52 Do not compare page sizes on source and destination of backup until
transactions are started and the page sizes are locked.  This is a
fix to check-in [7bd44794c4].

FossilOrigin-Name: ec7157788b16936b4b6e4642107b3c86aa44df24
2010-05-05 18:46:44 +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
3289c5efc8 Prohibit backup if the destination is using WAL and has a different page
size from the source.

FossilOrigin-Name: 7bd44794c482beee16c684712545275e2bf63dfa
2010-05-05 16:23:26 +00:00
dan
1018e90b1e When closing a WAL database, if the exclusive lock on the database file is obtained and the database successfully checkpointed, delete the wal-index file from the file system.
FossilOrigin-Name: 2ac5d96c8e5831b392d83c86491d9ed8bc9c8db7
2010-05-05 15:33:05 +00:00
drh
16adb77623 Make sure the page size of the main database is fixed following a
failed VACUUM attempt.  Otherwise, two consecutive failed VACUUM attempts
with attempted page_size changes on encrypted or WAL databases could
result in database corruption.

FossilOrigin-Name: 208e7d5d3a8915433dbf50c6cc6698ec6c8df944
2010-05-05 04:11:44 +00:00
drh
811bdbd206 Do not attempt to modify the page_size when running VACUUM on a WAL database.
FossilOrigin-Name: 58a1a59be89b33c6d5fa8b43571037d7d96625a1
2010-05-05 03:39:53 +00:00
drh
fc34ad291e Get the previous mutex fix working with SQLITE_DEBUG and with the amalgamation.
FossilOrigin-Name: df19928f7ee94bca3989313ff16507c15d6efe2b
2010-05-05 00:22:21 +00:00
drh
92d7652379 When the in single-threaded mode, the sqlite3_mutex_alloc() interface
still returns a non-NULL value.  The mutex doesn't do anything, but it
tests non-NULL.  This way, extensions (or VFSes) that use sqlite3_mutex_alloc()
can tell the difference between an OOM error and mutexes being disabled.

FossilOrigin-Name: 451fd175758983c335aab449fdc4cb838156c4cb
2010-05-05 00:05:24 +00:00
drh
7721b23e0a When sqlite3PagerPagecount() is called without any locks, always return
the physical file size, not the logical file size.

FossilOrigin-Name: 4016b422286587beda7323052d27821adb1fed73
2010-05-04 18:50:40 +00:00
drh
a8e654eb38 Be sure to release all wal-index locks before closing the wal-index.
FossilOrigin-Name: b15b67fa14ff77963f470678ff6188c63be8e079
2010-05-04 17:38:42 +00:00
drh
cd058ec4ef Relax an over-zealous assert() in sqlite3WalUndo().
FossilOrigin-Name: 8f9d22d58c75ad7476c1eea8ba296347e30b7beb
2010-05-04 17:20:09 +00:00
drh
33bec22fb1 Take care not to invoke the xShmClose method of the VFS with a NULL
shared memory object.

FossilOrigin-Name: 1465d3842c52aa7471f63deb47fe5b256d4e01c2
2010-05-04 16:33:37 +00:00
dan
2cee6abf8e Add a test case to verify that log files containing pages that are not a power-of-two bytes in size are handled correctly.
FossilOrigin-Name: c2bf693f933313991d85394009e79a7903037a18
2010-05-04 15:20:45 +00:00
dan
b6e099a973 Fix problems with recovering wal files that use a page-size other than the default.
FossilOrigin-Name: 1a391f3c55dc9d4266552fa26d2a9839c6bafce4
2010-05-04 14:47:39 +00:00
dan
ef37802545 Fix a typo in walfault.test.
FossilOrigin-Name: 232dbe8ecec16485be5c5995fdf7a0ed951c2097
2010-05-04 11:06:03 +00:00
dan
8d6ad1cc2c Test that the correct number of padding frames are appended to the log file after committing a transaction in synchronous=FULL mode.
FossilOrigin-Name: a60104aa7e38e7d9f2ff2eae02687dc9c5dd5d77
2010-05-04 10:36:20 +00:00
drh
d0b2677b78 Unset some global TCL variables prior to use in test where prior tests can
have those same variables set to an array value.

FossilOrigin-Name: 49bef00e5cda600ceb964148bf745de4aff1ab62
2010-05-03 19:20:46 +00:00
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