Create parent directories in DiskLocal::replaceFile

This commit is contained in:
vdimir 2022-04-06 11:15:37 +00:00
parent 2ebae2d722
commit 4cb7b7e49b
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 19 additions and 0 deletions

View File

@ -333,6 +333,7 @@ void DiskLocal::replaceFile(const String & from_path, const String & to_path)
{
fs::path from_file = fs::path(disk_path) / from_path;
fs::path to_file = fs::path(disk_path) / to_path;
fs::create_directories(to_file.parent_path());
fs::rename(from_file, to_file);
}

View File

@ -0,0 +1,17 @@
-- Tags: no-parallel
DROP DATABASE IF EXISTS 02265_atomic_db;
DROP DATABASE IF EXISTS 02265_ordinary_db;
CREATE DATABASE 02265_atomic_db ENGINE = Atomic;
CREATE DATABASE 02265_ordinary_db ENGINE = Ordinary;
CREATE TABLE 02265_ordinary_db.join_table ( `a` Int64 ) ENGINE = Join(`ALL`, LEFT, a);
INSERT INTO 02265_ordinary_db.join_table VALUES (111);
RENAME TABLE 02265_ordinary_db.join_table TO 02265_atomic_db.join_table;
SELECT * FROM 02265_atomic_db.join_table;
DROP DATABASE IF EXISTS 02265_atomic_db;
DROP DATABASE IF EXISTS 02265_ordinary_db;