File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ common = { path = "../common" }
2121mysql = { path = " ../mysql" }
2222postgres = { path = " ../postgres" }
2323sqlite = { path = " ../sqlite" }
24+ tokio-postgres = { workspace = true }
2425tracing = { workspace = true }
2526
2627[dev-dependencies ]
Original file line number Diff line number Diff line change @@ -129,14 +129,22 @@ pub async fn connect_persistence_reader<RT: Runtime>(
129129 match args {
130130 PersistenceArgs :: Postgres { url, schema } => {
131131 let options = PostgresReaderOptions { version, schema } ;
132+ let mut tokio_postgres_config: tokio_postgres:: Config = url
133+ . as_str ( )
134+ . parse ( )
135+ . context ( "Invalid postgres cluster url" ) ?;
136+ if !db_should_be_leader {
137+ let mut pg_options = tokio_postgres_config
138+ . get_options ( )
139+ . unwrap_or_default ( )
140+ . to_owned ( ) ;
141+ pg_options. push_str ( " -c pg_hint_plan.enable_hint=off" ) ;
142+ tokio_postgres_config. options ( pg_options) ;
143+ }
132144 Arc :: new (
133145 PostgresPersistence :: new_reader (
134- PostgresPersistence :: create_pool (
135- url. as_str ( )
136- . parse ( )
137- . context ( "Invalid postgres cluster url" ) ?,
138- )
139- . context ( "failed to create postgres pool" ) ?,
146+ PostgresPersistence :: create_pool ( tokio_postgres_config)
147+ . context ( "failed to create postgres pool" ) ?,
140148 options,
141149 )
142150 . await ?,
You can’t perform that action at this time.
0 commit comments