下面是mysql 5.6文档中对 4个事务级别的解释
1. Read Uncommitted 能读取到其他事务未提交的内容
SELECT statements are performed in a nonlocking fashion, but a possible earlier version of a row might be used. Thus, using this isolation level, such reads are not consistent. This is also called a dirty read. Otherwise, this isolation level works like READ COMMITTED.
2. Read Committed 一个事务职能读取已经提交的
A somewhat Oracle-like isolation level with respect to consistent (nonlocking) reads: Each consistent read, even within the same transaction, sets and reads its own fresh snapshot. See Section 14.3.4, “Consistent Nonlocking Reads”. For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE statements, and DELETE statements, InnoDB locks only index records, not the gaps before them, and thus permits the free insertion of new records next to locked records.
对于 读锁 更新 修改(这里没有插入锁定), 需要显式指定 for update 或者 lock in share mode，InnoDB使用index来锁定相关的记录但是不会锁定范围记录 比如 select * from id>20 for update 是允许插入 id=22的记录的
3. Repeatable Read 可重读
This is the default isolation level for InnoDB. For consistent reads, there is an important difference from the READ COMMITTED isolation level: All consistent reads within the same transaction read the snapshot established by the first read. This convention means that if you issue several plain (nonlocking) SELECT statements within the same transaction, these SELECT statements are consistent also with respect to each other. See Section 14.3.4, “Consistent Nonlocking Reads”. For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and DELETE statements, locking depends on whether the statement uses a unique index with a unique search condition, or a range-type search condition. For a unique index with a unique search condition, InnoDB locks only the index record found, not the gap before it. For other search conditions, InnoDB locks the index range scanned, using gap locks or next-key locks to block insertions by other sessions into the gaps covered by the range.
InnoDB的默认隔离级别，和 Read Committed不同的是: 在一个事务内, 所有的一致性读, 是第一次读取时的快照，这意味着 如果在这个事务中, 执行多个select操作结果是一致的
锁依赖于 unique 索引 或者是一个范围.
1. unique索引， 只锁定相关的记录
2. 其他的情况下 依赖于扫描的索引范围(比如全表扫描或者 id>20 范围的扫描)，需要使用 gap locks 或者 next-key locks 锁定 其他的事务插入记录到这个区间
4. Serializable 序列化事务
This level is like REPEATABLE READ, but InnoDB implicitly converts all plain SELECT statements to SELECT ... LOCK IN SHARE MODE if autocommitis disabled. If autocommit is enabled, the SELECT is its own transaction. It therefore is known to be read only and can be serialized if performed as a consistent (nonlocking) read and need not block for other transactions. (To force a plain SELECT to block if other transactions have modified the selected rows, disable autocommit.)
和可重复读相似, 但是 innoDB会将所有的select语句转化为 SELECT … LOCK IN SHARE MODE