Skip to content

Commit

Permalink
rm_stm: put kafka offset cache behind feature manager
Browse files Browse the repository at this point in the history
  • Loading branch information
rystsov committed Jul 6, 2022
1 parent b6db133 commit d0fee82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/v/cluster/feature_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
7 changes: 7 additions & 0 deletions src/v/cluster/feature_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion src/v/cluster/rm_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<class T>
void rm_stm::fill_snapshot_wo_seqs(T& snapshot) {
Expand Down

0 comments on commit d0fee82

Please sign in to comment.