/ Check-in [118aa7e3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the wal2 header comment in wal.c to explain how the wal-hook is invoked in wal2 mode.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal2
Files: files | file ages | folders
SHA3-256: 118aa7e32a94ad971a955ab60db5bfc5b6241f93734a41ba83ab72ea71bc9aaa
User & Date: dan 2018-12-22 15:50:00
Wiki:wal2
Context
2018-12-26
19:10
Merge latest trunk changes with this branch. check-in: 404f9d99 user: dan tags: wal2
2018-12-22
15:50
Enhance the wal2 header comment in wal.c to explain how the wal-hook is invoked in wal2 mode. check-in: 118aa7e3 user: dan tags: wal2
2018-12-17
15:22
Add extra test case to wal2recover.test. check-in: 1a5aa734 user: dan tags: wal2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

   301    301   **
   302    302   ** The wal file that writers are currently appending to (the one they
   303    303   ** don't have to check the above two criteria before writing to) is called
   304    304   ** the "current" wal file.
   305    305   **
   306    306   ** The first wal file takes the same name as the wal file in legacy wal
   307    307   ** mode systems - "<db>-wal". The second is named "<db>-wal2".
          308  +**
          309  +** CHECKPOINTS
          310  +**
          311  +** The "pre-configured size" mentioned above is the value set by 
          312  +** "PRAGMA journal_size_limit". Or, if journal_size_limit is not set, 
          313  +** 1000 pages.
          314  +**
          315  +** There is only a single type of checkpoint in wal2 mode (no "truncate",
          316  +** "restart" etc.), and it always checkpoints the entire contents of a single
          317  +** wal file. A wal file cannot be checkpointed until after a writer has written
          318  +** the first transaction into the other wal file and all readers are reading a
          319  +** snapshot that includes at least one transaction from the other wal file.
          320  +**
          321  +** The wal-hook, if one is registered, is invoked after a write-transaction
          322  +** is committed, just as it is in legacy wal mode. The integer parameter
          323  +** passed to the wal-hook is the total number of uncheckpointed frames in both
          324  +** wal files. Except, the parameter is set to zero if there is no frames 
          325  +** that may be checkpointed. This happens in two scenarios:
          326  +**
          327  +**   1. The "other" wal file (the one that the writer did not just append to)
          328  +**      is completely empty, or
          329  +**
          330  +**   2. The "other" wal file (the one that the writer did not just append to)
          331  +**      has already been checkpointed.
          332  +**
   308    333   **
   309    334   ** WAL FILE FORMAT
   310    335   **
   311    336   ** The file format used for each wal file in wal2 mode is the same as for
   312    337   ** legacy wal mode.  Except, the file format field is set to 3021000 
   313    338   ** instead of 3007000.
   314    339   **