-
-
Notifications
You must be signed in to change notification settings - Fork 153
Proper Error Message if the Storage is in an invalid state #623
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
Changes from all commits
98d7a43
a5306f6
e5581b0
691e932
3be5d05
90ae9ba
421f89d
fb50327
22a6acd
ae44f8d
e2fe24d
5f1fc55
5f5137f
f0370e8
d43728c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,7 @@ use std::sync::Arc; | |
use url::Url; | ||
|
||
use crate::oidc::{self, OpenidConfig}; | ||
use crate::storage::{FSConfig, ObjectStorageProvider, S3Config}; | ||
use crate::utils::validate_path_is_writeable; | ||
use crate::storage::{FSConfig, ObjectStorageError, ObjectStorageProvider, S3Config}; | ||
|
||
pub const MIN_CACHE_SIZE_BYTES: u64 = 1000u64.pow(3); // 1 GiB | ||
|
||
|
@@ -99,9 +98,36 @@ impl Config { | |
} | ||
} | ||
|
||
pub fn validate_staging(&self) -> anyhow::Result<()> { | ||
let staging_path = self.staging_dir(); | ||
validate_path_is_writeable(staging_path) | ||
pub async fn validate(&self) -> Result<(), ObjectStorageError> { | ||
let obj_store = self.storage.get_object_store(); | ||
let rel_path = relative_path::RelativePathBuf::from(".parseable.json"); | ||
|
||
let has_parseable_json = obj_store.get_object(&rel_path).await.is_ok(); | ||
|
||
let has_dirs = match obj_store.list_dirs_in_storage().await { | ||
Ok(dirs) => !dirs.is_empty(), | ||
Err(_) => false, | ||
}; | ||
|
||
let has_streams = obj_store.list_streams().await.is_ok(); | ||
|
||
if !has_dirs || has_parseable_json && has_streams { | ||
Ok(()) | ||
} else if has_parseable_json && !has_streams { | ||
Err(ObjectStorageError::Custom( | ||
"Could not start the server because storage contains stale data from previous deployment, please choose an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" | ||
.to_owned(), | ||
)) | ||
} else if !has_parseable_json && !has_streams && has_dirs { | ||
Err(ObjectStorageError::Custom( | ||
"Could not start the server because storage contains some stale data, please provide an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable".to_owned(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Eshanatnight please update to below error "Could not start the server because storage indicates stale data not related to parseable, please choose an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" |
||
)) | ||
} else { | ||
Err(ObjectStorageError::Custom( | ||
"Could not start the server because storage contains stale data from previous deployment.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Eshanatnight please update to below error "Could not start the server because storage indicates stale data from previous deployment, please choose an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable" |
||
.to_owned() | ||
)) | ||
} | ||
} | ||
|
||
pub fn storage(&self) -> Arc<dyn ObjectStorageProvider + Send + Sync> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Eshanatnight please update to below error message
"Could not start the server because storage indicates stale data from previous deployment, please choose an empty storage and restart the server.\nJoin us on Parseable Slack to report this incident : launchpass.com/parseable"