aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-07-30 14:39:13 +0000
committerdan <dan@noemail.net>2010-07-30 14:39:13 +0000
commit6037b92a4ec0a4fb56de0a66b22d6456dd6ac9cc (patch)
treefc81b6136d194c58377dc96e5ef4e7c2af62de12
parent2554ea7b0bac21683d265120bb2608ea3ea13d3d (diff)
parent1e01cf1b84238f58935e72cea54fdcfb621d04da (diff)
downloadsqlite-6037b92a4ec0a4fb56de0a66b22d6456dd6ac9cc.tar.gz
sqlite-6037b92a4ec0a4fb56de0a66b22d6456dd6ac9cc.zip
Merge trunk changes into experimental again.
FossilOrigin-Name: 87e0f4e184284bf775c2fc7c4e9a334f4f237c59
-rw-r--r--manifest14
-rw-r--r--manifest.uuid2
-rw-r--r--src/pager.c44
-rw-r--r--src/pager.h1
4 files changed, 36 insertions, 25 deletions
diff --git a/manifest b/manifest
index a82fdbb92..c592de600 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthe\stest\scases\sfor\sbug\s[f3e5abed55].
-D 2010-07-30T10:09:12
+C Merge\strunk\schanges\sinto\sexperimental\sagain.
+D 2010-07-30T14:39:13
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -156,8 +156,8 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
F src/os_unix.c ae5ca8a6031380708f3fec7be325233d49944914
F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7
-F src/pager.c 237bee4c1cec621821e05c7c808f631d4ee3aa32
-F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
+F src/pager.c d493b8164eee3339730983121cf1c6215af157aa
+F src/pager.h 80726162dc3942f59ab27b738fb667b9ba0a89d5
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
@@ -841,7 +841,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 50c0f2202d21bbf6b593d75fd20f13c0fac23eff
-R 90c2b80ec44f603bca769c7fc17c6688
+P cbbaf8e67a23dc332ce935bc7234246eacba60bf ad78ccacb00e2f8a5ca93e2c9006266d9477fe48
+R acbdc50f69dbd02f5f58643fea54f04c
U dan
-Z 1b5da3789844ce06cb648b709ee8c441
+Z 94891c66bfdc0aff59f3a65e9a0b9b92
diff --git a/manifest.uuid b/manifest.uuid
index b6eb3e72e..c68a24af7 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-cbbaf8e67a23dc332ce935bc7234246eacba60bf \ No newline at end of file
+87e0f4e184284bf775c2fc7c4e9a334f4f237c59 \ No newline at end of file
diff --git a/src/pager.c b/src/pager.c
index 2e484611b..6ebe39482 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -282,11 +282,9 @@ struct PagerSavepoint {
**
** journalStarted
**
-** This flag is set whenever the the main journal is opened and
-** initialized
+** This flag is set during a write-transaction after the first
+** journal-header is written and synced to disk.
**
-** The point of this flag is that it must be set after the
-** first journal header in a journal file has been synced to disk.
** After this has happened, new pages appended to the database
** do not need the PGHDR_NEED_SYNC flag set, as they do not need
** to wait for a journal sync before they can be written out to
@@ -294,18 +292,28 @@ struct PagerSavepoint {
**
** setMaster
**
-** This variable is used to ensure that the master journal file name
-** (if any) is only written into the journal file once.
-**
-** When committing a transaction, the master journal file name (if any)
-** may be written into the journal file while the pager is still in
-** PAGER_RESERVED state (see CommitPhaseOne() for the action). It
-** then attempts to upgrade to an exclusive lock. If this attempt
-** fails, then SQLITE_BUSY may be returned to the user and the user
-** may attempt to commit the transaction again later (calling
-** CommitPhaseOne() again). This flag is used to ensure that the
-** master journal name is only written to the journal file the first
-** time CommitPhaseOne() is called.
+** When PagerCommitPhaseOne() is called to commit a transaction, it may
+** (or may not) specify a master-journal name to be written into the
+** journal file before it is synced to disk.
+**
+** Whether or not a journal file contains a master-journal pointer affects
+** the way in which the journal file is finalized after the transaction is
+** committed or rolled back when running in "journal_mode=PERSIST" mode.
+** If a journal file does not contain a master-journal pointer, it is
+** finalized by overwriting the first journal header with zeroes. If,
+** on the other hand, it does contain a master-journal pointer, the
+** journal file is finalized by truncating it to zero bytes, just as if
+** the connection were running in "journal_mode=truncate" mode.
+**
+** Journal files that contain master journal pointers cannot be finalized
+** simply by overwriting the first journal-header with zeroes, as the
+** master journal pointer could interfere with hot-journal rollback of any
+** subsequently interrupted transaction that reuses the journal file.
+**
+** The flag is cleared as soon as the journal file is finalized (either
+** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the
+** journal file from being successfully finalized, the setMaster flag
+** is cleared anyway.
**
** doNotSpill, doNotSyncSpill
**
@@ -1073,7 +1081,9 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
i64 jrnlSize; /* Size of journal file on disk */
u32 cksum = 0; /* Checksum of string zMaster */
- if( !zMaster || pPager->setMaster
+ assert( pPager->setMaster==0 );
+
+ if( !zMaster
|| pPager->journalMode==PAGER_JOURNALMODE_MEMORY
|| pPager->journalMode==PAGER_JOURNALMODE_OFF
){
diff --git a/src/pager.h b/src/pager.h
index 6036827e4..3b724c4ba 100644
--- a/src/pager.h
+++ b/src/pager.h
@@ -129,6 +129,7 @@ void *sqlite3PagerGetExtra(DbPage *);
int sqlite3PagerPagecount(Pager*, int*);
int sqlite3PagerBegin(Pager*, int exFlag, int);
int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int);
+int sqlite3PagerExclusiveLock(Pager*);
int sqlite3PagerSync(Pager *pPager);
int sqlite3PagerCommitPhaseTwo(Pager*);
int sqlite3PagerRollback(Pager*);