Changes to the comments describing the Pager.setMaster variable in pager.c. Add an assert() statement to verify that two master journal pointers are not written to a single journal file.

FossilOrigin-Name: ad78ccacb00e2f8a5ca93e2c9006266d9477fe48
This commit is contained in:
dan 2010-07-30 11:31:12 +00:00
parent abfb62f9bd
commit 1e01cf1b84
3 changed files with 34 additions and 34 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE----- C Changes\sto\sthe\scomments\sdescribing\sthe\sPager.setMaster\svariable\sin\spager.c.\sAdd\san\sassert()\sstatement\sto\sverify\sthat\stwo\smaster\sjournal\spointers\sare\snot\swritten\sto\sa\ssingle\sjournal\sfile.
Hash: SHA1 D 2010-07-30T11:31:13
C Cherry-pick\sthe\smulti-file\stransaction\sfix\sfor\sticket\s[f3e5abed55]\sout\sof\nthe\sexperimental\sbranch.
D 2010-07-30T11:20:36
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -159,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
F src/os_unix.c 3109e0e5a0d5551bab2e8c7322b20a3b8b171248 F src/os_unix.c 3109e0e5a0d5551bab2e8c7322b20a3b8b171248
F src/os_win.c 1f8b0a1a5bcf6289e7754d0d3c16cec16d4c93ab F src/os_win.c 1f8b0a1a5bcf6289e7754d0d3c16cec16d4c93ab
F src/pager.c d559cc0bb784fe5f5b812b2bc2329f09231515a5 F src/pager.c 3f2373792cb5c23043cef31878a13b37b0ade1f6
F src/pager.h 80726162dc3942f59ab27b738fb667b9ba0a89d5 F src/pager.h 80726162dc3942f59ab27b738fb667b9ba0a89d5
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@ -843,14 +840,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 451d965742cc219db709939b4ba1da2f2343dbce P 40f7f0a583e6bba66cd006253a0ef4623ea74f17
R b0221ec16dca16ffff1bd5b40fa2847e R 9a1109c31f7ded9ef1e129e63eeacbd6
U drh U dan
Z 3292246f79754c1a33410d74f4888b7e Z 55381d586c03f9b763a259356223e4c4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMUrWIoxKgR168RlERAgl9AJ9pHsRDtGgzTlt5S8NSiNWiQ7ew2QCdH2kx
84Gf1zkCE4fUgXSzHJvHTGU=
=LLzG
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
40f7f0a583e6bba66cd006253a0ef4623ea74f17 ad78ccacb00e2f8a5ca93e2c9006266d9477fe48

View File

@ -282,11 +282,9 @@ struct PagerSavepoint {
** **
** journalStarted ** journalStarted
** **
** This flag is set whenever the the main journal is opened and ** This flag is set during a write-transaction after the first
** initialized ** 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 ** After this has happened, new pages appended to the database
** do not need the PGHDR_NEED_SYNC flag set, as they do not need ** 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 ** to wait for a journal sync before they can be written out to
@ -294,18 +292,28 @@ struct PagerSavepoint {
** **
** setMaster ** setMaster
** **
** This variable is used to ensure that the master journal file name ** When PagerCommitPhaseOne() is called to commit a transaction, it may
** (if any) is only written into the journal file once. ** (or may not) specify a master-journal name to be written into the
** journal file before it is synced to disk.
** **
** When committing a transaction, the master journal file name (if any) ** Whether or not a journal file contains a master-journal pointer affects
** may be written into the journal file while the pager is still in ** the way in which the journal file is finalized after the transaction is
** PAGER_RESERVED state (see CommitPhaseOne() for the action). It ** committed or rolled back when running in "journal_mode=PERSIST" mode.
** then attempts to upgrade to an exclusive lock. If this attempt ** If a journal file does not contain a master-journal pointer, it is
** fails, then SQLITE_BUSY may be returned to the user and the user ** finalized by overwriting the first journal header with zeroes. If,
** may attempt to commit the transaction again later (calling ** on the other hand, it does contain a master-journal pointer, the
** CommitPhaseOne() again). This flag is used to ensure that the ** journal file is finalized by truncating it to zero bytes, just as if
** master journal name is only written to the journal file the first ** the connection were running in "journal_mode=truncate" mode.
** time CommitPhaseOne() is called. **
** 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 ** doNotSpill, doNotSyncSpill
** **
@ -1073,7 +1081,9 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
i64 jrnlSize; /* Size of journal file on disk */ i64 jrnlSize; /* Size of journal file on disk */
u32 cksum = 0; /* Checksum of string zMaster */ 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_MEMORY
|| pPager->journalMode==PAGER_JOURNALMODE_OFF || pPager->journalMode==PAGER_JOURNALMODE_OFF
){ ){