提交 801f34d3 编写于 作者: A Alexey Milovidov

Reduce number of "stat" syscalls for MergeTree data parts

上级 b6acb296
......@@ -430,6 +430,7 @@ namespace ErrorCodes
extern const int MYSQL_CLIENT_INSUFFICIENT_CAPABILITIES = 453;
extern const int OPENSSL_ERROR = 454;
extern const int SUSPICIOUS_TYPE_FOR_LOW_CARDINALITY = 455;
extern const int CANNOT_UNLINK = 458;
extern const int KEEPER_EXCEPTION = 999;
extern const int POCO_EXCEPTION = 1000;
......
......@@ -402,15 +402,19 @@ void MergeTreeDataPart::remove() const
for (const auto & [file, _] : checksums.files)
{
if (0 != unlink((to + "/" + file).c_str()))
throwFromErrno("Cannot unlink file", ErrorCodes::CANNOT_UNLINK);
String path_to_remove = to + "/" + file;
if (0 != unlink(path_to_remove.c_str()))
throwFromErrno("Cannot unlink file " + path_to_remove, ErrorCodes::CANNOT_UNLINK);
}
if (0 != unlink((to + "/checksums.txt").c_str()))
throwFromErrno("Cannot unlink file", ErrorCodes::CANNOT_UNLINK);
{
String path_to_remove = to + "/checksums.txt";
if (0 != unlink(path_to_remove.c_str()))
throwFromErrno("Cannot unlink file", ErrorCodes::CANNOT_UNLINK);
}
if (0 != rmdir(to.c_str()))
throwFromErrno("Cannot rmdir file", ErrorCodes::CANNOT_UNLINK);
throwFromErrno("Cannot rmdir file " + to, ErrorCodes::CANNOT_UNLINK);
}
catch (...)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册