"available"
A query with read concern 具有读取关注"available"
returns data from the instance with no guarantee that the data has been written to a majority of the replica set members (i.e. may be rolled back)."available"
的查询从实例返回数据,但不保证数据已写入大多数副本集成员(即可能回滚)。
For a sharded cluster, 对于分片集群,"available"
read concern provides greater tolerance for partitions since it does not wait to ensure consistency guarantees. "available"
读关注点为分区提供了更大的容忍度,因为它不会等待以确保一致性保证。That is, read concern 也就是说,读关注"available"
does not contact the shard's primary nor the config servers for updated metadata. "available"
不会联系分片的主服务器或配置服务器以获取更新的元数据。However, this means that a query with 然而,这意味着如果分片正在进行块迁移,具有"available"
read concern may return orphaned documents if the shard is undergoing chunk migrations."available"
读关注点的查询可能会返回孤立文档。
For unsharded collections对于非分片集合 (including collections in a standalone deployment or a replica set deployment), (包括独立部署或副本集部署中的集合),"local"
and "available"
read concerns behave identically."local"
和"available"
读取关注点的行为相同。
Regardless of the read concern level, the most recent data on a node may not reflect the most recent version of the data in the system.无论读关注点级别如何,节点上的最新数据可能不会反映系统中数据的最新版本。
Read concern 读关注点"available"
is unavailable for usewith causally consistent sessions and transactions."available"
不可用于因果一致的会话和事务。
Consider the following timeline of a write operation Write 0 to a three member replica set:考虑以下写入操作的时间线将0写入三成员副本集:
For simplification, the example assumes:为了简化,该示例假设:
Time | Event | ||
---|---|---|---|
t 0 | Primary applies Write 0 | Primary: Write 0
Secondary 1: Write prev
Secondary 2: Write prev
| Primary: Write prev
Secondary 1: Write prev
Secondary 2: Write prev
|
t 1 | Secondary 1 applies write 0 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write prev
| Primary: Write prev
Secondary 1: Write prev
Secondary 2: Write prev
|
t 2 | Secondary 2 applies write 0 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
| Primary: Write prev
Secondary 1: Write prev
Secondary 2: Write prev
|
t 3 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
| Primary: Write 0
Secondary 1: Write prev
Secondary 2: Write prev
| |
t 4 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
| Primary: Write 0
Secondary 1: Write prev
Secondary 2: Write prev
| |
t 5 | w: "majority" 写入的快照 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
| Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write prev
|
t 6 | w: "majority" 写入的快照 | Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
| Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0
|
Then, the following tables summarizes the state of the data that a read operation with 然后,下表总结了具有"available"
read concern would see at time T
."available"
读关注点的读操作在时间T
将看到的数据状态。
T | ||
---|---|---|
Primary | After t 0 | |
Secondary 1 | Before t 1 | |
Secondary 1 | After t 1 | |
Secondary 2 | Before t 2 | |
Secondary 2 | After t 2 |