From da843239bfc74a00b9304c5b76910bbc71dfea9f Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Tue, 20 Dec 2016 15:35:33 -0200 Subject: [PATCH] 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 Message-Id: <3ca24612e4e84d1cbdea4f2d79e431a4f4479291.1482255327.git.raphaelsc@scylladb.com> (cherry picked from commit e28537b56f1b25017f84dcabea4bc2747d157711) --- sstables/types.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sstables/types.hh b/sstables/types.hh index 3eafd88acb..6b9ff4956f 100644 --- a/sstables/types.hh +++ b/sstables/types.hh @@ -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 {