This commit is contained in:
xiedeyantu 2022-10-16 16:46:00 +08:00
parent 0e86976e2b
commit 2a356715da
2 changed files with 13 additions and 2 deletions

View File

@ -112,7 +112,18 @@ UInt32 DataPartStorageOnDisk::getRefCount(const String & file_name) const
static UInt64 calculateTotalSizeOnDiskImpl(const DiskPtr & disk, const String & from)
{
if (disk->isFile(from))
return disk->getFileSize(from);
{
try
{
return disk->getFileSize(from);
}
catch (...)
{
/// Files of detached part may be not exist, and then set file size is 0.
return 0;
}
}
std::vector<std::string> files;
disk->listFiles(from, files);
UInt64 res = 0;

View File

@ -379,7 +379,7 @@ def test_system_detached_parts(drop_detached_parts_table):
)
res = q(
"select * from system.detached_parts where table like 'sdp_%' order by table, name"
"select system.detached_parts.* except `path`, disk from system.detached_parts where table like 'sdp_%' order by table, name"
)
assert (
res == "default\tsdp_0\tall\tall_1_1_0\tdefault\t\t1\t1\t0\n"