From 9999ae029c350c82016232ab1a6ccb70120da1b4 Mon Sep 17 00:00:00 2001 From: Zac Wen Date: Tue, 28 Jan 2025 13:48:40 -0800 Subject: [PATCH] test: Disable O_DIRECT in cache fuzzer (#12154) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/12154 O_DIRECT requires I/O size needs to be the same as a disk file block size which is not handled in SSD cache. Misalignment can lead to EINVAL in some filesystem and kernel version. Reviewed By: xiaoxmeng, kagamiori, yuandagits Differential Revision: D68562695 fbshipit-source-id: 5a3dbdfed288dfb8cfa606f9d40fe0e2c0568f8a --- velox/common/file/tests/FaultyFileSystem.h | 4 ++-- velox/exec/fuzzer/CacheFuzzer.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/velox/common/file/tests/FaultyFileSystem.h b/velox/common/file/tests/FaultyFileSystem.h index f85314c75e8f..1dbd698df66b 100644 --- a/velox/common/file/tests/FaultyFileSystem.h +++ b/velox/common/file/tests/FaultyFileSystem.h @@ -47,8 +47,8 @@ class FaultyFileSystem : public FileSystem { // Extracts the delegated real file path by removing the faulty file system // scheme prefix. inline std::string_view extractPath(std::string_view path) const override { - VELOX_CHECK_EQ(path.find(scheme()), 0, ""); - const auto filePath = path.substr(scheme().length()); + const auto filePath = + (path.find(scheme()) == 0) ? path.substr(scheme().length()) : path; return getFileSystem(filePath, config_)->extractPath(filePath); } diff --git a/velox/exec/fuzzer/CacheFuzzer.cpp b/velox/exec/fuzzer/CacheFuzzer.cpp index d4a443e04fa0..09ce7db72ab5 100644 --- a/velox/exec/fuzzer/CacheFuzzer.cpp +++ b/velox/exec/fuzzer/CacheFuzzer.cpp @@ -28,7 +28,6 @@ #include "velox/common/memory/MmapAllocator.h" #include "velox/dwio/common/CachedBufferedInput.h" #include "velox/exec/tests/utils/TempDirectoryPath.h" -#include "velox/vector/fuzzer/Utils.h" DEFINE_int32(steps, 10, "Number of plans to generate and test."); @@ -498,6 +497,12 @@ void CacheFuzzer::go() { FLAGS_steps > 0 || FLAGS_duration_sec > 0, "Either --steps or --duration_sec needs to be greater than zero."); + // O_DIRECT requires I/O size to be the same as a disk file block size which + // is not handled in SSD cache. Misalignment can lead to EINVAL in some + // filesystem and kernel version. + // + // TODO: add this support if needed later. + FLAGS_ssd_odirect = false; auto startTime = std::chrono::system_clock::now(); size_t iteration = 0;