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: avoid panic when the file is corrupted in disk cache #1130

Merged
merged 9 commits into from
Aug 8, 2023
11 changes: 6 additions & 5 deletions analytic_engine/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,18 @@ fn open_storage(
}
};

store = Arc::new(StoreWithMetrics::new(
store,
engine_runtimes.io_runtime.clone(),
));

if opts.disk_cache_capacity.as_byte() > 0 {
let path = Path::new(&opts.disk_cache_dir).join(DISK_CACHE_DIR_NAME);
tokio::fs::create_dir_all(&path).await.context(CreateDir {
path: path.to_string_lossy().into_owned(),
})?;

// TODO: Consider the readonly cache.
store = Arc::new(
DiskCacheStore::try_new(
path.to_string_lossy().into_owned(),
Expand All @@ -538,11 +544,6 @@ fn open_storage(
) as _;
}

store = Arc::new(StoreWithMetrics::new(
store,
engine_runtimes.io_runtime.clone(),
));

if opts.mem_cache_capacity.as_byte() > 0 {
let mem_cache = Arc::new(
MemCache::try_new(
Expand Down
Loading