Skip to content

Commit 657aea8

Browse files
authored
fix: disk cache failed to build on macOS (#17643)
* fix: disk cache failed to build on macOS let's focus on linux for now * fix: incorrect cfg attribute used : (
1 parent d5de83e commit 657aea8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/query/storages/common/cache/benches/read_cache_content.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ fn bench_read_cache_content(c: &mut Criterion) {
3939
let large_file_path = create_test_file(&temp_dir, "large.bin", 1024 * 1024); // 1MB
4040

4141
// Benchmark Unix specific implementation (open with O_NOATIME, read with libc::read without stat / seek)
42-
#[cfg(unix)]
42+
#[cfg(target_os = "linux")]
4343
{
44-
let mut group = c.benchmark_group("read_cache_content_unix_specific_impl");
44+
let mut group = c.benchmark_group("read_cache_content_linux_specific_impl");
4545

4646
group.bench_function("small_file_4KB", |b| {
4747
b.iter(|| {

src/query/storages/common/cache/src/providers/disk_cache/disk_cache_lru.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl LruDiskCacheBuilder {
177177
}
178178
}
179179

180-
#[cfg(not(unix))]
180+
#[cfg(not(target_os = "linux"))]
181181
pub fn read_cache_content(path: PathBuf, size: usize) -> std::io::Result<Vec<u8>> {
182182
use std::fs::File;
183183
use std::io::Read;
@@ -188,12 +188,13 @@ pub fn read_cache_content(path: PathBuf, size: usize) -> std::io::Result<Vec<u8>
188188
Ok(v)
189189
}
190190

191-
#[cfg(unix)]
191+
#[cfg(target_os = "linux")]
192192
pub fn read_cache_content(path: PathBuf, size: usize) -> std::io::Result<Vec<u8>> {
193-
unix_read::read_cache_content_with_syscall(path, size, unix_read::LibcRead)
193+
linux_read::read_cache_content_with_syscall(path, size, linux_read::LibcRead)
194194
}
195195

196-
mod unix_read {
196+
#[cfg(target_os = "linux")]
197+
mod linux_read {
197198

198199
#[cfg(test)]
199200
use mockall::automock;
@@ -223,7 +224,6 @@ mod unix_read {
223224
}
224225
}
225226

226-
#[cfg(unix)]
227227
pub(super) fn read_cache_content_with_syscall<R: CallRead>(
228228
path: PathBuf,
229229
size: usize,

0 commit comments

Comments
 (0)