AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

読み取り保証(read concern) "available"

読み取り保証(read concern "available"を指定したクエリは インスタンスからデータを返しますが、そのデータがレプリカセットのノードの大半に書き込まれた(つまり、ロールバックされる可能性がある)という保証はありません。

  • For a sharded cluster, "available" read concern provides greater tolerance for partitions.

    Queries with the "available" read concern don't require a check to ensure that the correct shard received the query.

    In the event of network partitions, these queries route to the shard considered appropriate before the network partition occurred. They do not wait for consistency guarantees from servers that may be unavailable. If the shard was undergoing chunk migration, queries with "available" can return orphaned documents.

    警告

    mongos does not guarantee that queries with read concern "available" route to the correct shards. The shard that receives the query returns data, but this shard may not be the authoritative owner of the requested data.

    これにより、クエリが誤った結果や予期しない結果を返すことがあります。

  • For unsharded collections (including collections in a standalone deployment or a replica set deployment), "local" and "available" read concerns behave identically.

読み取り保証のレベルを問わず、ノード上の最新データにシステム内のデータの最新バージョンが反映されていない場合があります。

Read concern "available" is unavailable for use with causally consistent sessions and transactions.

次の書込み (write) 操作のタイムラインを考えてみましょう。3 つのノードからなるレプリカセットに Write 0 します。

注意

単純化のため、この例では次のことを前提としています。

  • Write 0 より前のすべての書込みは、すべてのノードに正常にレプリケーションされました。

  • Write prev は Write 0 の前の書込みです。

  • Write 0 の後、他の書込みは発生していません。

3 つのノードからなるレプリカセットへの書込み操作のタイムライン
時間
イベント
最新の書込み
直近の w: "majority" 書込み

t 0

プライマリが Write 0 を適用

プライマリ: Write0
1セカンダリ: Write prev
2セカンダリ: Write prev

プライマリ: Write prev
1セカンダリ: Write prev
2セカンダリ: Write prev

t 1

セカンダリ 1 が Write 0 を適用

プライマリ: Write0
1セカンダリ: Write0
2セカンダリ: Write prev

Primary: Write prev
Secondary 1: Write prev
Secondary 2: Write prev

t 2

セカンダリ 2 が Write 0 を適用

プライマリ: 書き込み0
1セカンダリ: 書き込み0
2セカンダリ: 書き込み0

Primary: Write prev
Secondary 1: Write prev
Secondary 2: Write prev

t 3

プライマリがセカンダリ1へのレプリケーション成功を認識し、クライアントに確認応答を送信

Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0

Primary: Write 0
Secondary 1: Write prev
Secondary 2: Write prev

t 4

プライマリがセカンダリ2 へのレプリケーション成功を認識

Primary: Write 0
Secondary 1: Write 0
Secondary 2: Write 0

Primary: Write 0
Secondary 1: Write prev
Secondary 2: Write prev

t 5

セカンダリ 1 が(定期的なレプリケーションを通じて)最新の 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

セカンダリ 2 が(定期的なレプリケーションを通じて)最新の 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.

3 つのノードからなるレプリカセットへの書込み (write) 操作のタイムライン。
読み取りの対象
時間 T
データの状態

原発

t 0より後

データは Write 0を反映します。

セカンダリ 1

t 1より前

データは Write prev を反映

セカンダリ 1

t 1 より

データは Write 0 を反映

セカンダリ 2

t 2より前

データは Write prev を反映

セカンダリ 2

t 2より後

データは Write 0 を反映

このページを評価