加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

sqlite中的journal

发布时间:2020-12-12 23:33:48 所属栏目:百科 来源:网络整理
导读:journal 主要用途是,当事务要修改page时,先把未修改的page存入journal中,如果事务rollback时,就从journal中得到修改前的数据,覆盖已改的,达到事务的一致性。 journal是一个不同于数据库文件的另一个文件,它在事务开始时创建,当事务结束时就删除了 Th

journal 主要用途是,当事务要修改page时,先把未修改的page存入journal中,如果事务rollback时,就从journal中得到修改前的数据,覆盖已改的,达到事务的一致性。

journal是一个不同于数据库文件的另一个文件,它在事务开始时创建,当事务结束时就删除了

The format for the journal header is as follows:
- 8 bytes: Magic identifying journal format.
- 4 bytes: Number of records in journal,or -1 no-sync mode is on.
- 4 bytes: Random number used for page hash.
- 4 bytes: Initial database page count.
- 4 bytes: Sector size used by the process that wrote this journal.
- 4 bytes: Database page size.

** The journal file format is as follows: **** (1) 8 byte prefix. A copy of aJournalMagic[].** (2) 4 byte big-endian integer which is the number of valid page records** in the journal. If this value is 0xffffffff,then compute the** number of page records from the journal size.** (3) 4 byte big-endian integer which is the initial value for the ** sanity checksum.** (4) 4 byte integer which is the number of pages to truncate the** database to during a rollback.** (5) 4 byte big-endian integer which is the sector size. The header** is this many bytes in size.** (6) 4 byte big-endian integer which is the page size.** (7) zero padding out to the next sector size.** (8) Zero or more pages instances,each as follows:** + 4 byte page number.** + pPager->pageSize bytes of data.** + 4 byte checksum**** When we speak of the journal header,we mean the first 7 items above.** Each entry in the journal is an instance of the 8th item.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读