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 {
633633 tracing:: debug!( "connected: {client_id}" ) ;
634634 match connection_maker. create ( ) . await {
635635 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+
637642 let conn = Arc :: new ( TimeoutConnection :: new ( conn) ) ;
638643 let mut lock = RwLockUpgradableReadGuard :: upgrade ( lock) . await ;
639644 lock. insert ( client_id, conn. clone ( ) ) ;
@@ -703,7 +708,12 @@ impl Proxy for ProxyService {
703708 tracing:: debug!( "connected: {client_id}" ) ;
704709 match connection_maker. create ( ) . await {
705710 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+
707717 let conn = Arc :: new ( TimeoutConnection :: new ( conn) ) ;
708718 let mut lock = RwLockUpgradableReadGuard :: upgrade ( lock) . await ;
709719 lock. insert ( client_id, conn. clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments