Skip to content

Commit

Permalink
fix: compiler warnings on Windows (#3844)
Browse files Browse the repository at this point in the history
* chore: fix windows warnings

* test: try fix create_metadata_region on windows

* style: fix clippy

* style: fix clippy
  • Loading branch information
evenyag authored Apr 30, 2024
1 parent 81f3007 commit 777bc3b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/common/datasource/src/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn parse_url(url: &str) -> Result<(String, Option<String>, String)> {
#[cfg(windows)]
{
// On Windows, the url may start with `C:/`.
if let Some(_) = handle_windows_path(url) {
if handle_windows_path(url).is_some() {
return Ok((FS_SCHEMA.to_string(), None, url.to_string()));
}
}
Expand Down
29 changes: 15 additions & 14 deletions src/metric-engine/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ pub fn build_rows(num_tags: usize, num_rows: usize) -> Vec<Row> {

#[cfg(test)]
mod test {

use object_store::services::Fs;
use object_store::ObjectStore;
use store_api::metric_engine_consts::{DATA_REGION_SUBDIR, METADATA_REGION_SUBDIR};

use super::*;
Expand All @@ -302,21 +303,21 @@ mod test {
let env = TestEnv::new().await;
env.init_metric_region().await;
let region_id = to_metadata_region_id(env.default_physical_region_id());
let region_dir = join_dir(&env.data_home(), "test_metric_region");

// `join_dir` doesn't suit windows path
#[cfg(not(target_os = "windows"))]
{
// assert metadata region's dir
let metadata_region_dir = join_dir(&region_dir, METADATA_REGION_SUBDIR);
let exist = tokio::fs::try_exists(metadata_region_dir).await.unwrap();
assert!(exist);
let mut builder = Fs::default();
builder.root(&env.data_home());
let object_store = ObjectStore::new(builder).unwrap().finish();

// assert data region's dir
let data_region_dir = join_dir(&region_dir, DATA_REGION_SUBDIR);
let exist = tokio::fs::try_exists(data_region_dir).await.unwrap();
assert!(exist);
}
let region_dir = "test_metric_region";
// assert metadata region's dir
let metadata_region_dir = join_dir(region_dir, METADATA_REGION_SUBDIR);
let exist = object_store.is_exist(&metadata_region_dir).await.unwrap();
assert!(exist);

// assert data region's dir
let data_region_dir = join_dir(region_dir, DATA_REGION_SUBDIR);
let exist = object_store.is_exist(&data_region_dir).await.unwrap();
assert!(exist);

// check mito engine
let metadata_region_id = utils::to_metadata_region_id(region_id);
Expand Down

0 comments on commit 777bc3b

Please sign in to comment.