From 54571ffacbafd8210174b5df909bac002eeb3f60 Mon Sep 17 00:00:00 2001 From: Ernest Zaslavsky Date: Tue, 5 May 2026 16:29:57 +0300 Subject: [PATCH] sstables: fix load_metadata to check S3 for scylla metadata component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sstable_stream_sink_impl::load_metadata() used file_exists() on a local filesystem path to check whether the Scylla metadata component exists. For S3-backed storage this always returns false because the file lives on object storage, not locally. This means that when streaming encrypted SSTables, each component gets a fresh encryption key (because the previous key from scylla metadata is never loaded). Only the last key survives in the metadata on S3, so all other components become unreadable — decryption with the wrong key produces garbage, leading to parse failures or OOM crashes on sst->load(). Replace file_exists() with _sst->_storage->exists() which correctly checks for the component on whatever backend the SSTable uses (local filesystem or object storage). Fixes https://scylladb.atlassian.net/browse/SCYLLADB-1704 --- sstables/sstables.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 4f045e7513..70a2603220 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -4281,8 +4281,7 @@ public: {} private: future<> load_metadata() const { - auto metafile = _sst->filename(sstables::component_type::Scylla); - if (!co_await file_exists(fmt::to_string(metafile))) { + if (!co_await _sst->_storage->exists(*_sst, component_type::Scylla)) { // for compatibility with streaming a non-scylla table (no scylla component) co_return; }