File tree Expand file tree Collapse file tree
frontend/client/query_engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -395,4 +395,20 @@ impl Binding {
395395 _ => false ,
396396 }
397397 }
398+
399+ /// Number of connected shards.
400+ pub fn shards ( & self ) -> Result < usize , Error > {
401+ Ok ( match self {
402+ Binding :: Admin ( _) => 1 ,
403+ Binding :: Direct ( Some ( _) ) => 1 ,
404+ Binding :: MultiShard ( ref servers, _) => {
405+ if servers. is_empty ( ) {
406+ return Err ( Error :: NotConnected ) ;
407+ } else {
408+ servers. len ( )
409+ }
410+ }
411+ _ => return Err ( Error :: NotConnected ) ,
412+ } )
413+ }
398414}
Original file line number Diff line number Diff line change @@ -284,7 +284,13 @@ impl QueryEngine {
284284 context : & mut QueryEngineContext < ' _ > ,
285285 route : & Route ,
286286 ) -> Result < bool , Error > {
287- if context. in_error ( )
287+ let shards = if let Ok ( shards) = self . backend . shards ( ) {
288+ shards
289+ } else {
290+ return Ok ( true ) ;
291+ } ;
292+ if shards > 1 // This check only matters for cross-shard queries
293+ && context. in_error ( )
288294 && !context. rollback
289295 && context. client_request . executable ( )
290296 && !route. rollback_savepoint ( )
You can’t perform that action at this time.
0 commit comments