mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #11935 from zlobober/allocated_bytes
Consider allocatedBytes() instead of bytes() in Storage{Buffer,Memory}.
This commit is contained in:
commit
8f429f6027
@ -449,7 +449,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// If it is possible to quickly determine exact number of bytes for the table on storage:
|
/// If it is possible to quickly determine exact number of bytes for the table on storage:
|
||||||
/// - memory (approximated)
|
/// - memory (approximated, resident)
|
||||||
/// - disk (compressed)
|
/// - disk (compressed)
|
||||||
///
|
///
|
||||||
/// Used for:
|
/// Used for:
|
||||||
@ -457,6 +457,10 @@ public:
|
|||||||
//
|
//
|
||||||
/// Does not takes underlying Storage (if any) into account
|
/// Does not takes underlying Storage (if any) into account
|
||||||
/// (since for Buffer we still need to know how much bytes it uses).
|
/// (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
|
virtual std::optional<UInt64> totalBytes() const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
@ -797,7 +797,7 @@ std::optional<UInt64> StorageBuffer::totalBytes() const
|
|||||||
for (const auto & buffer : buffers)
|
for (const auto & buffer : buffers)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(buffer.mutex);
|
std::lock_guard lock(buffer.mutex);
|
||||||
bytes += buffer.data.bytes();
|
bytes += buffer.data.allocatedBytes();
|
||||||
}
|
}
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ std::optional<UInt64> StorageMemory::totalBytes() const
|
|||||||
UInt64 bytes = 0;
|
UInt64 bytes = 0;
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
for (const auto & buffer : data)
|
for (const auto & buffer : data)
|
||||||
bytes += buffer.bytes();
|
bytes += buffer.allocatedBytes();
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ Check total_bytes/total_rows for TinyLog
|
|||||||
\N \N
|
\N \N
|
||||||
Check total_bytes/total_rows for Memory
|
Check total_bytes/total_rows for Memory
|
||||||
0 0
|
0 0
|
||||||
2 1
|
64 1
|
||||||
Check total_bytes/total_rows for Buffer
|
Check total_bytes/total_rows for Buffer
|
||||||
0 0
|
0 0
|
||||||
100 50
|
256 50
|
||||||
|
Loading…
Reference in New Issue
Block a user