Skip to content

Commit

Permalink
sstable: Remove get_dir() (well, almost)
Browse files Browse the repository at this point in the history
The sstable::get_dir() is now gone, no callers know that sstable lives
in any path on a filesystem. There are only few callers left.

One is several places in code that need sstable datafile, toc and index
paths to print them in logs. The other one is sstable_directory that is
to be patched separately.

For both there's a storage.prefix() method that prepends component name
with where the sstable is "really" located.

Signed-off-by: Pavel Emelyanov <[email protected]>
  • Loading branch information
xemul committed Dec 15, 2022
1 parent 7402787 commit 6296ca3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sstables/sstable_directory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ future<> sstable_directory::delete_atomically(std::vector<shared_sstable> ssts)
gen_tracker.update(sst->generation());

if (sstdir.empty()) {
sstdir = sst->get_dir();
sstdir = sst->_storage.prefix();
} else {
// All sstables are assumed to be in the same column_family, hence
// sharing their base directory.
assert (sstdir == sst->get_dir());
assert (sstdir == sst->_storage.prefix());
}
}

Expand Down
7 changes: 3 additions & 4 deletions sstables/sstables.hh
Original file line number Diff line number Diff line change
Expand Up @@ -489,21 +489,20 @@ public:
void open(sstable& sst, const io_priority_class& pc);
future<> wipe(const sstable& sst) noexcept;
future<file> open_component(const sstable& sst, component_type type, open_flags flags, file_open_options options, bool check_integrity);

sstring prefix() const { return dir; }
};

private:
sstring filename(component_type f) const {
return filename(get_dir(), f);
return filename(_storage.prefix(), f);
}

sstring filename(const sstring& dir, component_type f) const {
return filename(dir, _schema->ks_name(), _schema->cf_name(), _version, _generation, _format, f);
}

friend class sstable_directory;
const sstring& get_dir() const {
return _storage.dir;
}

size_t sstable_buffer_size;

Expand Down

0 comments on commit 6296ca3

Please sign in to comment.