From 4de26fdec856cb41c200af9653d07403f41aaa01 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Fri, 8 Apr 2016 16:42:44 -0400 Subject: [PATCH] sstables: allow read_toc to be called more than once We do that by bailing immediately if we detect that the components map is already populated. This allow us to call read_toc() earlier if we need to - for instance, to inquire about the existence of the Summary - without the need to re-read the components again later. Signed-off-by: Glauber Costa --- sstables/sstables.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 91623ab202..899864e5d5 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -696,6 +696,10 @@ inline void write(file_writer& out, estimated_histogram& eh) { // This is small enough, and well-defined. Easier to just read it all // at once future<> sstable::read_toc() { + if (_components.size()) { + return make_ready_future<>(); + } + auto file_path = filename(sstable::component_type::TOC); sstlog.debug("Reading TOC file {} ", file_path);