Skip to content

Commit 87f5869

Browse files
authored
RUST-1414 disable causal consistency for implicit sessions (#969)
1 parent 31303b3 commit 87f5869

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/client/executor.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,7 @@ impl Client {
495495
}
496496
// If this is a causally consistent session, set `readConcern.afterClusterTime`.
497497
// Causal consistency defaults to true, unless snapshot is true.
498-
else if session
499-
.options()
500-
.and_then(|opts| opts.causal_consistency)
501-
.unwrap_or(true)
498+
else if session.causal_consistency()
502499
&& matches!(
503500
session.transaction.state,
504501
TransactionState::None | TransactionState::Starting

src/client/session.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ impl ClientSession {
281281
self.operation_time
282282
}
283283

284+
pub(crate) fn causal_consistency(&self) -> bool {
285+
self.options()
286+
.and_then(|opts| opts.causal_consistency)
287+
.unwrap_or(!self.is_implicit())
288+
}
289+
284290
/// Mark this session (and the underlying server session) as dirty.
285291
pub(crate) fn mark_dirty(&mut self) {
286292
self.server_session.dirty = true;

src/test/spec/sessions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ use crate::{
2727
#[cfg_attr(feature = "tokio-runtime", tokio::test(flavor = "multi_thread"))]
2828
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
2929
async fn run_unified() {
30-
// TODO RUST-1414: unskip this file
31-
let mut skipped_files = vec!["implicit-sessions-default-causal-consistency.json"];
30+
let mut skipped_files = vec![];
3231
let client = TestClient::new().await;
3332
if client.is_sharded() && client.server_version_gte(7, 0) {
3433
// TODO RUST-1666: unskip this file

0 commit comments

Comments
 (0)