Files
scylladb/sstables/sstables_registry.hh
Dimitrios Symonidis c40842f60a db, sstables: add node_owner to sstables registry primary key
Add a node_owner column (locator::host_id) to system.sstables and
make it part of the partition key, so the primary key becomes
  PRIMARY KEY ((table_id, node_owner), generation).

This is the first step toward moving the sstables registry into
system_distributed: once distributed, each node's startup scan
must read only the rows it owns, which requires the owning node
to be part of the partition key. Partitioning by (table_id,
node_owner) turns that scan into a single-partition read of
exactly the local node's rows.

The new column is populated via sstables_manager::get_local_host_id().
No backward compatibility is preserved; the feature is experimental
and gated by keyspace-storage-options.
2026-04-24 16:41:09 +02:00

32 lines
1.4 KiB
C++

// Copyright (C) 2024-present ScyllaDB
// SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
#pragma once
#include "open_info.hh"
#include <seastar/core/sstring.hh>
#include <seastar/core/future.hh>
#include "locator/host_id.hh"
#include "schema/schema_fwd.hh"
#include "seastarx.hh"
namespace sstables {
// sstables_manager needs to store the names of its sstables somewhere, when
// using object storage. This is system_keyspace, but for modularity we hide
// it behind this interface.
class sstables_registry {
public:
virtual ~sstables_registry();
virtual future<> create_entry(table_id tid, locator::host_id node_owner, sstring status, sstable_state state, sstables::entry_descriptor desc) = 0;
virtual future<> update_entry_status(table_id tid, locator::host_id node_owner, sstables::generation_type gen, sstring status) = 0;
virtual future<> update_entry_state(table_id tid, locator::host_id node_owner, sstables::generation_type gen, sstables::sstable_state state) = 0;
virtual future<> delete_entry(table_id tid, locator::host_id node_owner, sstables::generation_type gen) = 0;
using entry_consumer = noncopyable_function<future<>(sstring status, sstables::sstable_state state, sstables::entry_descriptor desc)>;
virtual future<> sstables_registry_list(table_id tid, locator::host_id node_owner, entry_consumer consumer) = 0;
};
} // namespace sstables