Files
scylla/db/sstables-format-selector.hh
Kefu Chai 54d49c04e0 db, sstable: bump up default sstable format to "md"
before this change, we defaults to use "mc" sstable format, and
switch to "md" if the cluster agrees on using it, and to
"me" if the cluster agrees on using this. the cluster feature
is used to get the consensus across the members in the cluster,
if any of the existing nodes in the cluster has its `sstable_format`
configured to, for instance, "mc", then the cluster is stuck with
"mc".

but we disabled "mc" sstable format back in 3d345609, the first LTS
release including that change was scylla v5.2.0. which means, the
cluster of the last major version Scylla should be using "md" or
"me". per our document on upgrade, see docs/upgrade/index.rst,

> You should perform the upgrades consecutively - to each
> successive X.Y version, without skipping any major or minor version.
>
> Before you upgrade to the next version, the whole cluster (each
> node) must be upgraded to the previous version.

we can assume that, a 6.x node will only join a cluster
with 5.x or 6.x nodes. (joining a 7.x cluster should work, but
this is not relevant to this change). in both cases, since
5.x and up scylla can only configured with "md" `sstable_format`,
there is no need to switch from "mc" to "md" anymore. so we can
ditch the code supporting it.

Refs #16551
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-01-11 22:43:05 +08:00

82 lines
2.1 KiB
C++

/*
* Copyright (C) 2020-present ScyllaDB
*
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <seastar/core/semaphore.hh>
#include <seastar/core/future.hh>
#include <seastar/core/gate.hh>
#include <seastar/core/sharded.hh>
#include "sstables/version.hh"
#include "gms/feature.hh"
using namespace seastar;
namespace replica {
class database;
}
namespace gms {
class gossiper;
class feature_service;
}
namespace db {
class system_keyspace;
class sstables_format_listener;
class feature_enabled_listener : public gms::feature::listener {
sstables_format_listener& _listener;
sstables::sstable_version_types _format;
public:
feature_enabled_listener(sstables_format_listener& l, sstables::sstable_version_types format)
: _listener(l)
, _format(format)
{ }
void on_enabled() override;
};
class sstables_format_selector {
sharded<replica::database>& _db;
db::system_keyspace* _sys_ks = nullptr;
sstables::sstable_version_types _selected_format = sstables::sstable_version_types::mc;
future<> select_format(sstables::sstable_version_types new_format);
future<> read_sstables_format();
public:
explicit sstables_format_selector(sharded<replica::database>& db);
future<> on_system_tables_loaded(db::system_keyspace& sys_ks);
inline sstables::sstable_version_types selected_format() const noexcept {
return _selected_format;
}
future<> update_format(sstables::sstable_version_types new_format);
};
class sstables_format_listener {
gms::gossiper& _gossiper;
sharded<gms::feature_service>& _features;
sstables_format_selector& _selector;
seastar::named_semaphore _sem = {1, named_semaphore_exception_factory{"feature listeners"}};
seastar::gate _sel;
feature_enabled_listener _me_feature_listener;
public:
sstables_format_listener(gms::gossiper& g, sharded<gms::feature_service>& f, sstables_format_selector& selector);
future<> start();
future<> stop();
future<> maybe_select_format(sstables::sstable_version_types new_format);
};
} // namespace sstables