提交 29d2928f 编写于 作者: M Maxim Akhmedov

Consider allocatedBytes() instead of bytes() in Storage{Buffer,Memory}.

上级 3e6da7d7
......@@ -449,7 +449,7 @@ public:
}
/// If it is possible to quickly determine exact number of bytes for the table on storage:
/// - memory (approximated)
/// - memory (approximated, resident)
/// - disk (compressed)
///
/// Used for:
......@@ -457,6 +457,10 @@ public:
//
/// Does not takes underlying Storage (if any) into account
/// (since for Buffer we still need to know how much bytes it uses).
///
/// Memory part should be estimated as a resident memory size.
/// In particular, alloctedBytes() is preferable over bytes()
/// when considering in-memory blocks.
virtual std::optional<UInt64> totalBytes() const
{
return {};
......
......@@ -797,7 +797,7 @@ std::optional<UInt64> StorageBuffer::totalBytes() const
for (const auto & buffer : buffers)
{
std::lock_guard lock(buffer.mutex);
bytes += buffer.data.bytes();
bytes += buffer.data.allocatedBytes();
}
return bytes;
}
......
......@@ -169,7 +169,7 @@ std::optional<UInt64> StorageMemory::totalBytes() const
UInt64 bytes = 0;
std::lock_guard lock(mutex);
for (const auto & buffer : data)
bytes += buffer.bytes();
bytes += buffer.allocatedBytes();
return bytes;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册