Skip to content

Commit 810c89e

Browse files
committed
session: ExecuteQueryContext::consistency -> ...set_on_statement
There are three levels of consistency that are taken into account by the Session: default exec profile's, per-statement exec profile's and per-statement one. To avoid confusion, we should use naming that clearly distinguishes them. Therefore, ExecuteQueryContext's field is renamed from the vague `consistency` to `consistency_set_on_statement` (the one directly set), as it is exactly its semantics.
1 parent dff3b73 commit 810c89e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

scylla/src/transport/session.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ impl Session {
16191619
&execution_profile,
16201620
ExecuteQueryContext {
16211621
is_idempotent: statement_config.is_idempotent,
1622-
consistency: statement_config.consistency,
1622+
consistency_set_on_statement: statement_config.consistency,
16231623
retry_session: retry_policy.new_session(),
16241624
history_data,
16251625
query_info: &statement_info,
@@ -1655,7 +1655,7 @@ impl Session {
16551655
&execution_profile,
16561656
ExecuteQueryContext {
16571657
is_idempotent: statement_config.is_idempotent,
1658-
consistency: statement_config.consistency,
1658+
consistency_set_on_statement: statement_config.consistency,
16591659
retry_session: retry_policy.new_session(),
16601660
history_data,
16611661
query_info: &statement_info,
@@ -1710,8 +1710,9 @@ impl Session {
17101710
ResT: AllowedRunQueryResTType,
17111711
{
17121712
let mut last_error: Option<QueryError> = None;
1713-
let mut current_consistency: Consistency =
1714-
context.consistency.unwrap_or(execution_profile.consistency);
1713+
let mut current_consistency: Consistency = context
1714+
.consistency_set_on_statement
1715+
.unwrap_or(execution_profile.consistency);
17151716

17161717
'nodes_in_plan: for node in query_plan {
17171718
let span = trace_span!("Executing query", node = %node.address);
@@ -1786,7 +1787,9 @@ impl Session {
17861787
error: the_error,
17871788
is_idempotent: context.is_idempotent,
17881789
consistency: LegacyConsistency::Regular(
1789-
context.consistency.unwrap_or(execution_profile.consistency),
1790+
context
1791+
.consistency_set_on_statement
1792+
.unwrap_or(execution_profile.consistency),
17901793
),
17911794
};
17921795

@@ -2028,7 +2031,7 @@ impl AllowedRunQueryResTType for NonErrorQueryResponse {}
20282031

20292032
struct ExecuteQueryContext<'a> {
20302033
is_idempotent: bool,
2031-
consistency: Option<Consistency>,
2034+
consistency_set_on_statement: Option<Consistency>,
20322035
retry_session: Box<dyn RetrySession>,
20332036
history_data: Option<HistoryData<'a>>,
20342037
query_info: &'a load_balancing::RoutingInfo<'a>,

0 commit comments

Comments
 (0)