Skip to content

Commit a8d167b

Browse files
gautamg795Convex, Inc.
authored andcommitted
Fix db-verifier for planetscale replicas (#39005)
GitOrigin-RevId: 5939144ed276eb31672f45ae2a2215a4ad323cb0
1 parent a54f04d commit a8d167b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/db_connection/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ common = { path = "../common" }
2121
mysql = { path = "../mysql" }
2222
postgres = { path = "../postgres" }
2323
sqlite = { path = "../sqlite" }
24+
tokio-postgres = { workspace = true }
2425
tracing = { workspace = true }
2526

2627
[dev-dependencies]

crates/db_connection/src/lib.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff 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?,

0 commit comments

Comments
 (0)