sstables: fix calculation of memory footprint for summary

size of keys weren't taken into account, so value reported
via collectd is much smaller than actual footprint.

Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
Message-Id: <3ca24612e4e84d1cbdea4f2d79e431a4f4479291.1482255327.git.raphaelsc@scylladb.com>
(cherry picked from commit e28537b56f)
This commit is contained in:
Raphael S. Carvalho
2016-12-20 15:35:33 -02:00
committed by Avi Kivity
parent 5c96b04f4d
commit da843239bf

View File

@@ -153,7 +153,12 @@ struct summary_ka {
* Similar to origin off heap size
*/
uint64_t memory_footprint() const {
return sizeof(summary_entry) * entries.size() + sizeof(uint32_t) * positions.size() + sizeof(*this);
auto sz = sizeof(summary_entry) * entries.size() + sizeof(uint32_t) * positions.size() + sizeof(*this);
sz += first_key.value.size() + last_key.value.size();
for (auto& e : entries) {
sz += e.key.size();
}
return sz;
}
explicit operator bool() const {