Skip to content

RUST-1414 disable causal consistency for implicit sessions #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/client/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,7 @@ impl Client {
}
// If this is a causally consistent session, set `readConcern.afterClusterTime`.
// Causal consistency defaults to true, unless snapshot is true.
else if session
.options()
.and_then(|opts| opts.causal_consistency)
.unwrap_or(true)
else if session.causal_consistency()
&& matches!(
session.transaction.state,
TransactionState::None | TransactionState::Starting
Expand Down
6 changes: 6 additions & 0 deletions src/client/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ impl ClientSession {
self.operation_time
}

pub(crate) fn causal_consistency(&self) -> bool {
self.options()
.and_then(|opts| opts.causal_consistency)
.unwrap_or(!self.is_implicit())
}

/// Mark this session (and the underlying server session) as dirty.
pub(crate) fn mark_dirty(&mut self) {
self.server_session.dirty = true;
Expand Down
3 changes: 1 addition & 2 deletions src/test/spec/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ use crate::{
#[cfg_attr(feature = "tokio-runtime", tokio::test(flavor = "multi_thread"))]
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
async fn run_unified() {
// TODO RUST-1414: unskip this file
let mut skipped_files = vec!["implicit-sessions-default-causal-consistency.json"];
let mut skipped_files = vec![];
let client = TestClient::new().await;
if client.is_sharded() && client.server_version_gte(7, 0) {
// TODO RUST-1666: unskip this file
Expand Down