Merge pull request #2223 from sundy-li/master

Fix:ignore the format_version check when the data is empty
This commit is contained in:
alexey-milovidov 2018-04-17 22:50:26 +03:00 committed by GitHub
commit 22f7a3a545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,12 +149,15 @@ MergeTreeData::MergeTreeData(
min_format_version = MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING;
}
auto path_exists = Poco::File(full_path).exists();
/// Creating directories, if not exist.
Poco::File(full_path).createDirectories();
Poco::File(full_path + "detached").createDirectory();
String version_file_path = full_path + "format_version.txt";
if (!attach)
// When data path not exists, ignore the format_version check
if (!attach || !path_exists)
{
format_version = min_format_version;
WriteBufferFromFile buf(version_file_path);