Berkeley DB 源代码分析 (4) --- 事务和日志

原创 2012年03月25日 15:54:45


1. in nested txns, when child txns of any level commit, __txn_child logs are always written, no matter the child txn commits explicitly or implicitly by its parent's commit.

2. Read only txns don't write anything into the log because the __txn_regop is only written if any log records are written before the commit.

3. when the outermost txn aborts, all its children aborts. At recovery, we can not figure out the parent-children relationship, and we don't need to know this, we simply regard all abort txns as indepent outermost txns, and undo their changes. However, during verification without this information, we may report false alarms: we may report a parant txn T0's aborted child T1 to be modifying a page owned by T0, since from the log we only know T1 aborted but can't know T1 is child txn of T0.

4. So we have to add a "__txn_begin" log record for each txn to record a txn's parent txnid. But it's impossible to add a "__txn_begin" log record only for txns that has written any thing, because we don't know the begin_lsn of a txn before its first log record is written into the log, and at the same time we need the begin_lsn to write the __txn_begin record. However if we don't record __txn_begin before any other logs of this txn (e.g. log it after the 1st record of this txn), we can avoid writing it for read only txns.


Before checkpointing, we write a __dbreg_register of type DBREG_CHKPNT for each db handle, and then write a __txn_ckp record; Before recovery completes, we write a __dbreg_register of type DBREG_RCLOSE for each db handle, and then write the __txn_ckp record, and followed by a __txn_recycle record.
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

Berkeley DB 源代码分析 (7) --- 事务和日志 (2)

这篇和上篇一样,也是含有一些wiki格式控制字符,看的时候直接忽略这些格式字符。 = Logging subsystem = == Architecture == Log sub...

Berkeley DB 源代码分析 (5) --- 事务锁模块

Locking Subsystem Learning Notes 0. locking API __db_lput/__db_lget are txnal lock put/get, often ...

Berkeley DB 源代码分析 --- 小结

刚才贴了一些文章,都是我之前读Berkeley DB的代码时候记下来的笔记,基于Berkeley DB 4.6 ~ Berkeley DB 4.8版本的代码,不过相信与现在最新的代码差别也不大,有兴趣...

Berkeley DB 源代码分析 (1) --- 代码特征与游标的实现

I. General Notes 1. use a cursor to access db internally. cursor connects lock/txn/logging/AM, etc....

Berkeley DB 源代码分析 (3) --- Btree的实现 (2)

__bam_ditem In btree we store on-page duplicate key/data pairs this way: 1. we only put the key...

Berkeley DB 源代码分析 (6) 缓存模块

这篇文字原来是贴在wiki里面的,所以有一些wiki系统使用的格式标记,大家将就看吧,不好意思哈。 = Memory Pool subsystem = == Architecture ==...

Berkeley DB 源代码分析 (2) --- Btree的实现 (1)

II. Type Dictionary 1. BTREE The DB handle's DB->bt_internal structure, stores per-process and p...

Berkeley DB事务篇

Berkeley DB事务篇       目录 前言.... 3 在这本书中使用的约定... 3 欲了解更多信息... 3 1.      介绍.... 3 1.1.  &...

Berkeley DB数据库和日志文件归档

Berkeley DB数据库和日志文件归档 归档数据库和日志文件目的是提供面对数据库的灾难性故障的可恢复性,最大限度地减少发生物理硬件故障导致数据丢失。 首先,你可能需要定期创建数据库快照(也就是...

Berkeley DB内核源码分析

Berkeley DB是一个优秀的数据库存储引擎,虽然它比起那些大块头的DBMS来说显的很小,但是size并不与能力呈正比,Berkeley DB拥有那些大块头DBMS的存储引擎所拥有的全部功能,而且...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)