Atomic Commit In SQLite
来源:互联网 发布:百度指数数据来源 编辑:程序博客网 时间:2024/05/16 18:18
1.0 Introduction
An important feature of transactional databases like SQLite is "atomic commit". Atomic commit means that either all database changes within a single transaction occur or none of them occur. With atomic commit, it is as if many different writes to different sections of the database file occur instantaneously and simultaneously. Real hardware serializes writes to mass storage, and writing a single sector takes a finite amount of time. So it is impossible to truly write many different sectors of a database file simultaneously and/or instantaneously. But the atomic commit logic within SQLite makes it appear as if the changes for a transaction are all written instantaneously and simultaneously.
SQLite has the important property that transactions appear to be atomic even if the transaction is interrupted by an operating system crash or power failure.
This article describes the techniques used by SQLite to create the illusion of atomic commit.
The information in this article applies only when SQLite is operating in "rollback mode", or in other words when SQLite is not using a write-ahead log. SQLite still supports atomic commit when write-ahead logging is enabled, but it accomplishes atomic commit by a different mechanism from the one describe in this article. See the write-ahead log documentation for additional information on how SQLite supports atomic commit in that context.
2.0 Hardware Assumptions
Throughout this article, we will call the mass storage device "disk" even though the mass storage device might really be flash memory.
We assume that disk is written in chunks which we call a "sector". It is not possible to modify any part of the disk smaller than a sector. To change a part of the disk smaller than a sector, you have to read in the full sector that contains the part you want to change, make the change, then write back out the complete sector.
原文地址
- Atomic Commit In SQLite
- SQLite语法 COMMIT TRANSACTION
- Atomic Access in thread
- Using ISVNEditor in commit operations
- Built-in functions for atomic memory access
- In C is “i+=1;” atomic?
- Lock-free atomic operations in Android
- Built-in functions for atomic memory access
- Built-in functions for atomic memory access
- Atomic
- atomic
- Atomic
- commit() should not be called while in auto-commit mode
- svn-commit遇上aborting commit: remains in conflict 解决办法
- 《C++ Concurrency in Action》笔记24 std::atomic<T*>、std::atomic<整型>
- Aborting commit: 'XXXXXXXX'remains in conflict错误
- ORA-04092: cannot COMMIT in a trigger
- Git remove a file in a commit
- get table info by column name
- Java GUI API
- Java子类的构造方法与多态
- Java异常处理
- Java抽象类与接口
- Atomic Commit In SQLite
- DLL文件脱壳(重定位表修复部分)
- 55个常用的JavaScript网页脚本
- 着色器中语义的理解
- Redis persistence demystified
- Daniel Jebaraj谈Orubase
- Android SAX解析xml文件
- fedora源重复
- Window、Document、Location、History对象的常用属性和方法