Merge pull request #35995 from vdimir/rename_join_ordinary_to_atomic

Create parent directories in DiskLocal::replaceFile
This commit is contained in:
Kseniia Sumarokova 2022-04-07 10:23:40 +02:00 committed by GitHub
commit 99a55a2304
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;