Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: metastore argument validation #3013

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions crates/cli/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,24 +288,39 @@ impl ComputeServerBuilder {
}
};

let metastore_storage_conf =
match (self.metastore_bucket.clone(), self.data_dir.clone()) {
(Some(_), Some(_)) => {
return Err(anyhow!(
"cannot specify local datadir and remote metastore bucket"
))
}
(Some(bucket), None) => StorageConfig::Gcs {
bucket: Some(bucket),
service_account_key: self.service_account_path.clone().unwrap_or_default(),
},
(None, Some(p)) => {
let p = p.join("__metastore");
ensure_dir(&p)?;
StorageConfig::Local { path: p }
}
(None, None) => StorageConfig::Memory,
};
let metastore_storage_conf = match (
self.metastore_bucket.clone(),
self.data_dir.clone(),
self.service_account_path.clone(),
) {
(None, Some(_), Some(_))
| (Some(_), Some(_), None)
| (Some(_), Some(_), Some(_)) => {
return Err(anyhow!(
"cannot specify local metastore datadir with service_account_path or bucket"
))
}
(Some(_), None, None) => {
return Err(anyhow!(
"cannot specify bucket without specifying the service_account_path"
))
}
(None, None, Some(_)) => {
return Err(anyhow!(
"cannot specify service_account_path without specifying the bucket"
))
}
(Some(bucket), None, Some(service_account_path)) => StorageConfig::Gcs {
bucket: Some(bucket),
service_account_key: std::fs::read_to_string(service_account_path)?,
},
(None, Some(p), None) => {
let p = p.join("__metastore");
ensure_dir(&p)?;
StorageConfig::Local { path: p }
}
(None, None, None) => StorageConfig::Memory,
};


let metastore_client =
Expand Down