@@ -7,6 +7,7 @@ use crate::cloud::CloudConfig;
77use crate :: frame:: types:: LegacyConsistency ;
88use crate :: history;
99use crate :: history:: HistoryListener ;
10+ use crate :: retry_policy:: RetryPolicy ;
1011use arc_swap:: ArcSwapOption ;
1112use async_trait:: async_trait;
1213use bytes:: Bytes ;
@@ -581,6 +582,7 @@ impl Session {
581582 . run_query (
582583 RoutingInfo :: default ( ) ,
583584 & query. config ,
585+ query. get_retry_policy ( ) . map ( |rp| & * * rp) ,
584586 |node : Arc < Node > | async move { node. random_connection ( ) . await } ,
585587 |connection : Arc < Connection > ,
586588 consistency : Consistency ,
@@ -920,6 +922,7 @@ impl Session {
920922 . run_query (
921923 statement_info,
922924 & prepared. config ,
925+ prepared. get_retry_policy ( ) . map ( |rp| & * * rp) ,
923926 |node : Arc < Node > | async move {
924927 match token {
925928 Some ( token) => node. connection_for_token ( token) . await ,
@@ -1117,6 +1120,7 @@ impl Session {
11171120 . run_query (
11181121 statement_info,
11191122 & batch. config ,
1123+ batch. get_retry_policy ( ) . map ( |rp| & * * rp) ,
11201124 |node : Arc < Node > | async move {
11211125 match first_value_token {
11221126 Some ( first_value_token) => {
@@ -1430,6 +1434,7 @@ impl Session {
14301434 & ' a self ,
14311435 statement_info : RoutingInfo < ' a > ,
14321436 statement_config : & ' a StatementConfig ,
1437+ statement_retry_policy : Option < & dyn RetryPolicy > ,
14331438 choose_connection : impl Fn ( Arc < Node > ) -> ConnFut ,
14341439 do_query : impl Fn ( Arc < Connection > , Consistency , & ExecutionProfileInner ) -> QueryFut ,
14351440 request_span : & ' a RequestSpan ,
@@ -1479,7 +1484,7 @@ impl Session {
14791484 }
14801485 }
14811486
1482- let retry_policy = & execution_profile. retry_policy ;
1487+ let retry_policy = statement_retry_policy . unwrap_or ( & * execution_profile. retry_policy ) ;
14831488
14841489 let speculative_policy = execution_profile. speculative_execution_policy . as_ref ( ) ;
14851490
@@ -1754,6 +1759,7 @@ impl Session {
17541759 . run_query (
17551760 info,
17561761 & config,
1762+ None , // No specific retry policy needed for schema agreement
17571763 |node : Arc < Node > | async move { node. random_connection ( ) . await } ,
17581764 do_query,
17591765 & span,
0 commit comments