311 Commits

Author SHA1 Message Date
dan
15651f61df Simpler fix for the race condition also fixed by [7c102c7b5f]
FossilOrigin-Name: 3c2de820034e01c2e939bd90a05a58159f60df50
2010-06-09 11:28:43 +00:00
dan
640aac48f3 Add further test cases for the logic in sqlite3WalBeginReadTransaction().
FossilOrigin-Name: a49713db39d0d6940b368206d4e669aa69aa1fe5
2010-06-05 19:18:59 +00:00
dan
eb8cb3a851 Clarify the purpose of a test for a race-condition in walIndexReadHdr().
FossilOrigin-Name: c041c6a9786bc9ebb82527f7a2c96d255aec927f
2010-06-05 18:34:26 +00:00
dan
493cc590b6 Remove a condition from sqlite3WalRead() that is unreachable as of the changes to clear entries out of the wal-index hash tables on transaction or savepoint rollback.
FossilOrigin-Name: 394204735a842b04b677cca20485b1578e475d4c
2010-06-05 18:12:23 +00:00
dan
0626bd65fb Mark a condition in wal.c as ALWAYS().
FossilOrigin-Name: 3fe0cc784ac586358c08f87fba458dfbb5eec6f2
2010-06-05 14:42:57 +00:00
dan
3cac5dc9bc Clarify an assert in sqlite3WalExclusiveMode().
FossilOrigin-Name: 255850699ddbf4aad8cc3223aefbada35daa0703
2010-06-04 18:37:59 +00:00
dan
0153a9bc04 Remove an unnecessary branch from wal.c.
FossilOrigin-Name: 8e54786c9a0c5c399f228f56c73271f84d75694b
2010-06-04 17:16:52 +00:00
dan
d764c7de25 If an attempt to sync the database file as part of a checkpoint fails, do not update the shared "nBackfill" variable. Otherwise, another process could wrap the log and overwrite content before it is synced into the database.
FossilOrigin-Name: b813233d7604a5fd91e1af91d5d812032eec700a
2010-06-04 11:56:22 +00:00
dan
83f42d1b38 Fix a problem where an SQLITE_BUSY in the checkpoint code was being treated as an IO error (abandoning, instead of just limiting, the checkpoint).
FossilOrigin-Name: 02c4040ce2b4c970b3dee09f7c9ad5a2a3a9aa49
2010-06-04 10:37:05 +00:00
drh
2d37e1cfb9 When a lock fails due to an I/O error (not an SQLITE_BUSY) then the checkpoint
should fail.

FossilOrigin-Name: c6eb0a27270df69018576232d8f97c16d63d8f6e
2010-06-02 20:38:20 +00:00
dan
6e6bd5658f Fix a problem with rolling back to a savepoint opened before the writer decided to wrap the log file.
FossilOrigin-Name: 6b4aed6aae7dc9e92807d27375cbe1e83c15841b
2010-06-02 18:59:03 +00:00
drh
38933f2c11 When walTryBeginRead() encounters an I/O error trying to set a lock
(as opposed to SQLITE_BUSY) be sure to propagate that error back up
the call stack.

FossilOrigin-Name: aa2c2b67a7f50c97a44cca1af5c437bf5410869c
2010-06-02 15:43:18 +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
dan
9971e710e4 Delay the decision to restart the log file until data is actually ready to be written to the log file (instead of at the start of a write transaction).
FossilOrigin-Name: b1abfaaf5309cc0d0dda4fb2c237862c8cf83261
2010-06-01 15:44:57 +00:00
drh
f77bbd9fc5 Fix a bug introduced by the previous check-in but only seen if
SQLITE_ENABLE_EXPENSIVE_ASSERTS is turned on.

FossilOrigin-Name: 9c9ec8994bf701249efce6c7bb911de4525808c8
2010-06-01 13:17:44 +00:00
drh
9c1564779e Fix an off-by-one boundary-value issue in walCleanupHash().
FossilOrigin-Name: f039552e6330b6a04281748f985b41937f534bd0
2010-06-01 12:58:41 +00:00
dan
e877296705 If the checkpoint fails to obtain an exclusive lock on one of the read-lock bytes, do not consider this an error.
FossilOrigin-Name: 9e95e35728cf69a0ae50e774d7f6c71a41b17d97
2010-06-01 10:44:28 +00:00
drh
181e091ff3 Comment edits and cleanup in wal.c. No functional code changes.
FossilOrigin-Name: e8e666ab8273f5db5265f0773b39820f75b6df1a
2010-06-01 01:08:08 +00:00
drh
61e4acecf4 Fix issues with locking_mode=EXCLUSIVE in WAL.
FossilOrigin-Name: 8deba0cebd135a18da68530fab9e7d19dc21ddcb
2010-05-31 20:28:37 +00:00
drh
4b82c387c9 Add an "isInit" field in the wal-index header that must be non-zero for
a valid header.  Use this to detect an uninitialized wal-index.

FossilOrigin-Name: a16fde190183d1ae252d1aa305b23fdb88c603dc
2010-05-31 18:24:19 +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
dan
d0aa34277f Avoid dropping the checkpoint lock after a recovery run as a precursor to a checkpoint operation.
FossilOrigin-Name: cc25cfa04630a43c1de26f2dbdacbe46c110a2b5
2010-05-31 16:41:53 +00:00
dan
3dee6da994 Zero the checkpoint header as the last step of successful WAL recovery. Avoid an unnecessary lock/unlock in WalBeginReadTransaction.
FossilOrigin-Name: db3509c55dfe288650b803622e3a0828c6e59aea
2010-05-31 16:17:54 +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
18b7f604aa Make sure WAL alway requests enough shared-memory space.
FossilOrigin-Name: 138f128317b6695530ca3fde7be4cdf22548cd22
2010-05-31 14:39:31 +00:00
drh
34116eaf6a Do not fail a checkpoint just because active readers prevent backfill.
FossilOrigin-Name: 9aa4243e0cedcc9204994d04af1b2b7a80c048bd
2010-05-31 12:30:52 +00:00
drh
c74c333408 Add WALTRACE() macros to help with debugging and analysis.
FossilOrigin-Name: 765c33181a7b9d99b452ce750d69f217b3c81a5d
2010-05-31 12:15:19 +00:00
dan
1beb939db1 Another minor fix to checkpoint on the WAL branch.
FossilOrigin-Name: 853f1e3f7720af2723b552bdf086bb106e6e93fe
2010-05-31 12:02:30 +00:00
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
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
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
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
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
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
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
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
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