MongoDB 基础系列十六:增删查改 CRUD Concepts 之隔离性,一致性以及相似性

前言

此篇博文是 Mongdb 基础系列之一;

本文为作者的原创作品,转载需注明出处;

隔离级别

Read Uncommitted

在 MongoDB 中,客户端可以在结果持久化写入以前访问到该数据;

  • 不管是否使用了 write concern,其它客户端只要是使用了 “local” (the default) 的 readConcern 记性读取,它就可以看到写入操作的结果而无需等待写入操作响应给客户端以后;
  • 客户端使用 “local” readConcern 也可以读取到正在回滚的数据

Read uncommitted is the default isolation level and applies to mongod standalone instances as well as to replica sets and sharded clusters.

Read Uncommitted And Single Document Atomicit

写入操作的原子性的级别是在单个文档上的;比如,如果一个写入的操作同时更新一个文档的多个字段的同时,那么在该事务结束以前,另外一个客户端是无论如何也看不到正在更新的字段的值的;

如果是一个单机版的 mongod 实例,那么对同一个文档的的一系列读取和写入操作是线性的,一个接一个执行的;
如果是在主从集群中,一系列的读取和写入操作当且仅当 rollback 不会发生的情况下,才是线性的;

However, although the readers may not see a partially updated document, read uncommitted means that concurrent readers may still see the updated document before the changes are durable.

Read Uncommitted And Multiple Document Write

TODO