diff --git a/src/v/cluster/feature_table.cc b/src/v/cluster/feature_table.cc index ad280e66a194b..a2c4bffa02c63 100644 --- a/src/v/cluster/feature_table.cc +++ b/src/v/cluster/feature_table.cc @@ -28,6 +28,8 @@ std::string_view to_string_view(feature f) { return "mtls_authentication"; case feature::serde_raft_0: return "serde_raft_0"; + case feature::rm_stm_kafka_cache: + return "rm_stm_kafka_cache"; case feature::test_alpha: return "__test_alpha"; } @@ -56,7 +58,7 @@ std::string_view to_string_view(feature_state::state s) { // The version that this redpanda node will report: increment this // on protocol changes to raft0 structures, like adding new services. -static constexpr cluster_version latest_version = cluster_version{4}; +static constexpr cluster_version latest_version = cluster_version{5}; feature_table::feature_table() { // Intentionally undocumented environment variable, only for use diff --git a/src/v/cluster/feature_table.h b/src/v/cluster/feature_table.h index 2872b5c3e32ec..cc4b0d8100cab 100644 --- a/src/v/cluster/feature_table.h +++ b/src/v/cluster/feature_table.h @@ -25,6 +25,7 @@ enum class feature : std::uint64_t { maintenance_mode = 0x4, mtls_authentication = 0x8, serde_raft_0 = 0x10, + rm_stm_kafka_cache = 0x20, // Dummy features for testing only test_alpha = uint64_t(1) << 63, @@ -107,6 +108,12 @@ constexpr static std::array feature_schema{ feature::serde_raft_0, feature_spec::available_policy::always, feature_spec::prepare_policy::always}, + feature_spec{ + cluster_version{5}, + "rm_stm_kafka_cache", + feature::rm_stm_kafka_cache, + feature_spec::available_policy::always, + feature_spec::prepare_policy::always}, feature_spec{ cluster_version{2001}, "__test_alpha", diff --git a/src/v/cluster/rm_stm.cc b/src/v/cluster/rm_stm.cc index ff71a368f09de..f4bdf514e1db6 100644 --- a/src/v/cluster/rm_stm.cc +++ b/src/v/cluster/rm_stm.cc @@ -1959,7 +1959,12 @@ rm_stm::apply_snapshot(stm_snapshot_header hdr, iobuf&& tx_ss_buf) { _insync_offset = data.offset; } -uint8_t rm_stm::active_snapshot_version() { return tx_snapshot_v1::version; } +uint8_t rm_stm::active_snapshot_version() { + if (_feature_table.local().is_active(feature::rm_stm_kafka_cache)) { + return tx_snapshot::version; + } + return tx_snapshot_v1::version; +} template void rm_stm::fill_snapshot_wo_seqs(T& snapshot) {