提交 a6222082 编写于 作者: Z zhang2014

Not remove metadata directory when attach database fails

上级 7065a8ba
......@@ -36,16 +36,18 @@ namespace ErrorCodes
DatabasePtr DatabaseFactory::get(
const String & database_name, const String & metadata_path, const ASTStorage * engine_define, Context & context)
{
bool create = false;
try
{
Poco::File(metadata_path).createDirectory();
create = Poco::File(metadata_path).createDirectory();
return getImpl(database_name, metadata_path, engine_define, context);
}
catch (...)
{
Poco::File metadata_dir(metadata_path);
if (metadata_dir.exists())
if (create && metadata_dir.exists())
metadata_dir.remove(true);
throw;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册