diff --git a/src/Storages/FileLog/StorageFileLog.cpp b/src/Storages/FileLog/StorageFileLog.cpp index 1ba16fc821c..1ff2502f2c3 100644 --- a/src/Storages/FileLog/StorageFileLog.cpp +++ b/src/Storages/FileLog/StorageFileLog.cpp @@ -119,7 +119,8 @@ void StorageFileLog::loadMetaFiles(bool attach) "Metadata files already exist by path: {}, remove them manually if it is intended", root_meta_path); } - std::filesystem::create_directories(root_meta_path); + /// We do not create the root_meta_path directory at creation time, create it at the moment of serializing + /// meta files, such that can avoid unnecessarily create this directory if create table failed. } } diff --git a/tests/queries/0_stateless/02125_fix_storage_filelog.reference b/tests/queries/0_stateless/02125_fix_storage_filelog.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/02125_fix_storage_filelog.sql b/tests/queries/0_stateless/02125_fix_storage_filelog.sql new file mode 100644 index 00000000000..7586df1ee00 --- /dev/null +++ b/tests/queries/0_stateless/02125_fix_storage_filelog.sql @@ -0,0 +1,3 @@ +CREATE TABLE log (A String) ENGINE= FileLog('/tmp/aaa.csv', 'CSV'); -- {serverError 36 } +CREATE TABLE log (A String) ENGINE= FileLog('/tmp/aaa.csv', 'CSV'); -- {serverError 36 } +CREATE TABLE log (A String) ENGINE= FileLog('/tmp/aaa.csv', 'CSV'); -- {serverError 36 }