Files
scylladb/streaming/stream_reason.hh
Tomasz Grabiec e5dcf03b88 tablets: Add support for removenode and replace handling
New tablet replicas are allocated synchronously with node
operations. They are safely rebuilt from all existing replicas.
The list of ignored nodes passed to node operations is respected.

Tablet scheduler is responsible for scheduling tablet transition which
changes the replicas set. The infrastructure for handling decommission
in tablet scheduler is reused for this.

Scheduling is done incrementally, respecting per-shard load
limits. Rebuilding transitions are recognized by load calculation to
affect all tablet replicas.

New kind of tablet transition is introduced called "rebuild" which
adds new tablet replica and rebuilds it from existing replicas. Other
than that, the transition goes through the same stages as regular
migration to ensure safe synchronization with request coordinators.

In this PR we simply stream from all tablet replicas. Later we should
switch to calling repair to avoid sending excessive amounts of data.

Fixes #16690.
2024-01-23 01:19:42 +01:00

59 lines
1.6 KiB
C++

/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <cstdint>
#include <string_view>
#include <fmt/format.h>
namespace streaming {
enum class stream_reason : uint8_t {
unspecified,
bootstrap,
decommission,
removenode,
rebuild,
repair,
replace,
tablet_migration,
tablet_rebuild,
};
}
template <>
struct fmt::formatter<streaming::stream_reason> : fmt::formatter<std::string_view> {
template <typename FormatContext>
auto format(const streaming::stream_reason& r, FormatContext& ctx) const {
using enum streaming::stream_reason;
switch (r) {
case unspecified:
return formatter<std::string_view>::format("unspecified", ctx);
case bootstrap:
return formatter<std::string_view>::format("bootstrap", ctx);
case decommission:
return formatter<std::string_view>::format("decommission", ctx);
case removenode:
return formatter<std::string_view>::format("removenode", ctx);
case rebuild:
return formatter<std::string_view>::format("rebuild", ctx);
case repair:
return formatter<std::string_view>::format("repair", ctx);
case replace:
return formatter<std::string_view>::format("replace", ctx);
case tablet_migration:
return formatter<std::string_view>::format("tablet migration", ctx);
case tablet_rebuild:
return formatter<std::string_view>::format("tablet rebuild", ctx);
}
std::abort();
}
};