Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhancement to the how-to-corrupt document. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | branch-3.24 |
Files: | files | file ages | folders |
SHA3-256: |
06a6ca5d3429360de986f331d4b9e6f6 |
User & Date: | drh 2018-07-30 20:16:30.852 |
Context
2018-09-02
| ||
10:12 | Fix a duplicate anchor in the lang.in page. (Leaf check-in: 718909cfaf user: drh tags: branch-3.24) | |
2018-07-30
| ||
20:16 | Enhancement to the how-to-corrupt document. (check-in: 06a6ca5d34 user: drh tags: branch-3.24) | |
2018-07-23
| ||
11:16 | Prosupport edits. (check-in: fb2699cc28 user: drh tags: branch-3.24) | |
Changes
Changes to pages/fileformat2.in.
︙ | ︙ | |||
12 13 14 15 16 17 18 | <p>The complete state of an SQLite database is usually contained in a single file on disk called the "main database file".</p> <p>During a transaction, SQLite stores additional information in a second file called the "rollback journal", or if SQLite is in [WAL mode], a write-ahead log file. | > > > | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <p>The complete state of an SQLite database is usually contained in a single file on disk called the "main database file".</p> <p>During a transaction, SQLite stores additional information in a second file called the "rollback journal", or if SQLite is in [WAL mode], a write-ahead log file. <tcl>hd_fragment hotjrnl {hot journal} {hot journal files}</tcl> <h2>Hot Journals</h2> <p>If the application or host computer crashes before the transaction completes, then the rollback journal or write-ahead log contains information needed to restore the main database file to a consistent state. When a rollback journal or write-ahead log contains information necessary for recovering the state of the database, they are called a "hot journal" or "hot WAL file". Hot journals and WAL files are only a factor during error recovery scenarios and so are uncommon, but they are part of the state of an SQLite |
︙ | ︙ |
Changes to pages/howtocorrupt.in.
︙ | ︙ | |||
69 70 71 72 73 74 75 | (the <tt>*-journal</tt> file) or write-ahead log (the <tt>*-wal</tt> file) be copied together with the database file itself.</p> <tcl>hd_fragment delhotjrnl {deleting a hot journal}</tcl> <h2> Deleting a hot journal</h2> <p>SQLite normally stores all content in a single disk file. However, | | | > | | > > > > > > > > > > > > > > > > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | (the <tt>*-journal</tt> file) or write-ahead log (the <tt>*-wal</tt> file) be copied together with the database file itself.</p> <tcl>hd_fragment delhotjrnl {deleting a hot journal}</tcl> <h2> Deleting a hot journal</h2> <p>SQLite normally stores all content in a single disk file. However, while performing a transaction, information necessary to recover the database following a crash or power failure is stored in auxiliary journal files. Such journal files are described as [hot journal|"hot"]. The journal files have the same name as the original database file with the addition of <tt>-journal</tt> or <tt>-wal</tt> suffix.</p> <p>SQLite must see the journal files in order to recover from a crash or power failure. If the [hot journal files] are moved, deleted, or renamed after a crash or power failure, then automatic recovery will not work and the database may go corrupt.</p> <p>Another manifestation of this problem is [database corruption caused by inconsistent use of 8+3 filenames].</p> <tcl>hd_fragment roguejrnl {separating a database from its journal} </tcl> <h2> Mispairing database files and hot journals </h2> <p> The previous example is a specific case of a more general problem: The state of an SQLite database is controlled by both the database file and the journal file. In a quiescent state, the journal file does not exist and only the database file matters. But if the journal file does exist, it must be kept together with the database to avoid corruption. The following actions are all likely to lead to corruption: <ul> <li> Swapping journal files between two different databases. <li> Overwritting a journal file with a different journal file. <li> Moving a journal file from one database to another. <li> Copying a database file without also copying its journal. <li> Overwriting a database file with another without also deleting any hot journal associated with the original database. </ul> <h1> File locking problems</h1> <p>SQLite uses file locks on the database file, and on the [write-ahead log] or [WAL] file, to coordinate access between concurrent processes. Without coordination, two threads or processes might try to make incompatible changes to a database file at the same time, |
︙ | ︙ |
Changes to pages/lockingv3.in.
︙ | ︙ | |||
188 189 190 191 192 193 194 | of the master journal. If there are no ATTACHed databases (or if none of the ATTACHed database is participating in the current transaction) no master journal is created and the normal rollback journal contains an empty string in the place normally reserved for recording the name of the master journal.</p> | < | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | of the master journal. If there are no ATTACHed databases (or if none of the ATTACHed database is participating in the current transaction) no master journal is created and the normal rollback journal contains an empty string in the place normally reserved for recording the name of the master journal.</p> <p>A rollback journal is said to be [hot journal|hot] if it needs to be rolled back in order to restore the integrity of its database. A hot journal is created when a process is in the middle of a database update and a program or operating system crash or power failure prevents the update from completing. Hot journals are an exception condition. Hot journals exist to recover from crashes and power failures. |
︙ | ︙ |