Introduced a new max_tablet_count tablet option that caps the maximum number of tablets a table can have. This feature is designed primarily for backup and restore workflows. During backup, when load balancing is disabled for snapshot consistency, the current tablet count is recorded in the backup manifest. During restore, max_tablet_count is set to this recorded value, ensuring the restored table's tablet count never exceeds the original snapshot's tablet distribution. This guarantee enables efficient file-based SSTable streaming during restore, as each SSTable remains fully contained within a single tablet boundary. Closes scylladb/scylladb#28450
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/*
|
|
* Copyright 2025-present ScyllaDB
|
|
*/
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
|
|
#include <seastar/core/sstring.hh>
|
|
|
|
using namespace seastar;
|
|
|
|
namespace db {
|
|
|
|
// Per-table tablet options
|
|
enum class tablet_option_type {
|
|
min_tablet_count,
|
|
max_tablet_count,
|
|
min_per_shard_tablet_count,
|
|
expected_data_size_in_gb,
|
|
};
|
|
|
|
struct tablet_options {
|
|
using map_type = std::map<sstring, sstring>;
|
|
|
|
std::optional<ssize_t> min_tablet_count;
|
|
std::optional<ssize_t> max_tablet_count;
|
|
std::optional<double> min_per_shard_tablet_count;
|
|
std::optional<ssize_t> expected_data_size_in_gb;
|
|
|
|
tablet_options() = default;
|
|
explicit tablet_options(const map_type& map);
|
|
|
|
operator bool() const noexcept {
|
|
return min_tablet_count || max_tablet_count || min_per_shard_tablet_count || expected_data_size_in_gb;
|
|
}
|
|
|
|
map_type to_map() const;
|
|
|
|
static sstring to_string(tablet_option_type hint);
|
|
static tablet_option_type from_string(sstring hint_desc);
|
|
static void validate(const map_type& map);
|
|
};
|
|
|
|
} // namespace db
|