File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -633,7 +633,12 @@ impl Proxy for ProxyService {
633
633
tracing:: debug!( "connected: {client_id}" ) ;
634
634
match connection_maker. create ( ) . await {
635
635
Ok ( conn) => {
636
- assert ! ( conn. is_primary( ) ) ;
636
+ if !conn. is_primary ( ) {
637
+ return Err ( tonic:: Status :: failed_precondition (
638
+ "cannot run schema migration against a replica" ,
639
+ ) ) ;
640
+ }
641
+
637
642
let conn = Arc :: new ( TimeoutConnection :: new ( conn) ) ;
638
643
let mut lock = RwLockUpgradableReadGuard :: upgrade ( lock) . await ;
639
644
lock. insert ( client_id, conn. clone ( ) ) ;
@@ -703,7 +708,12 @@ impl Proxy for ProxyService {
703
708
tracing:: debug!( "connected: {client_id}" ) ;
704
709
match connection_maker. create ( ) . await {
705
710
Ok ( conn) => {
706
- assert ! ( conn. is_primary( ) ) ;
711
+ if !conn. is_primary ( ) {
712
+ return Err ( tonic:: Status :: failed_precondition (
713
+ "cannot run schema migration against a replica" ,
714
+ ) ) ;
715
+ }
716
+
707
717
let conn = Arc :: new ( TimeoutConnection :: new ( conn) ) ;
708
718
let mut lock = RwLockUpgradableReadGuard :: upgrade ( lock) . await ;
709
719
lock. insert ( client_id, conn. clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments