Skip to content

Commit

Permalink
sqld: improve conn.is_primary error message
Browse files Browse the repository at this point in the history
  • Loading branch information
LucioFranco committed Sep 19, 2024
1 parent 8f6df20 commit 529b854
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions libsql-server/src/rpc/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,6 @@ impl Proxy for ProxyService {
tracing::debug!("connected: {client_id}");
match connection_maker.create().await {
Ok(conn) => {
if !conn.is_primary() {
return Err(tonic::Status::failed_precondition(
"cannot run schema migration against a replica",
));
}

let conn = Arc::new(TimeoutConnection::new(conn));
let mut lock = RwLockUpgradableReadGuard::upgrade(lock).await;
lock.insert(client_id, conn.clone());
Expand Down Expand Up @@ -710,7 +704,7 @@ impl Proxy for ProxyService {
Ok(conn) => {
if !conn.is_primary() {
return Err(tonic::Status::failed_precondition(
"cannot run schema migration against a replica",
"cannot run schema migration against a replica from a replica",
));
}

Expand Down
2 changes: 1 addition & 1 deletion libsql-server/tests/cluster/schema_dbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn schema_migration_basics() {
}

#[test]
fn error_on_replicate() {
fn schema_migration_via_replica() {
let mut sim = Builder::new()
.simulation_duration(Duration::from_secs(1000))
.build();
Expand Down

0 comments on commit 529b854

Please sign in to comment.