From 1df37df69d5eb04e301b265b11d029eef788dd44 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 28 Jun 2024 13:34:34 -0700 Subject: [PATCH 1/4] v8_engine: remove unused exception 'twas caught but never thrown. Signed-off-by: Noah Watkins --- src/v/kafka/server/handlers/alter_configs.cc | 10 ---------- src/v/v8_engine/data_policy.h | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/src/v/kafka/server/handlers/alter_configs.cc b/src/v/kafka/server/handlers/alter_configs.cc index 579f0f20710f0..d36f8022d6899 100644 --- a/src/v/kafka/server/handlers/alter_configs.cc +++ b/src/v/kafka/server/handlers/alter_configs.cc @@ -303,16 +303,6 @@ create_topic_properties_update( error_code::invalid_config, fmt::format( "unable to parse property {} value {}", cfg.name, cfg.value)); - } catch (const v8_engine::data_policy_exeption& e) { - return make_error_alter_config_resource_response< - alter_configs_resource_response>( - resource, - error_code::invalid_config, - fmt::format( - "unable to parse property {}, value{}, error {}", - cfg.name, - cfg.value, - e.what())); } // Unsupported property, return error diff --git a/src/v/v8_engine/data_policy.h b/src/v/v8_engine/data_policy.h index 273019baee428..cb2d70600fea2 100644 --- a/src/v/v8_engine/data_policy.h +++ b/src/v/v8_engine/data_policy.h @@ -18,17 +18,6 @@ #include namespace v8_engine { -class data_policy_exeption final : public std::exception { -public: - explicit data_policy_exeption(ss::sstring msg) noexcept - : _msg(std::move(msg)) {} - - const char* what() const noexcept final { return _msg.c_str(); } - -private: - ss::sstring _msg; -}; - // Datapolicy property for v8_engine. In first version it contains only // function_name and script_name, in the future it will contain ACLs, geo, // e.t.c. From 77b0335646f5db105a43c6157325ec777fddb51a Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 28 Jun 2024 13:51:12 -0700 Subject: [PATCH 2/4] kafka: remove unused reference to data_policy type Presumably would not have compiled if references did exist. Signed-off-by: Noah Watkins --- src/v/kafka/server/handlers/configs/config_response_utils.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/v/kafka/server/handlers/configs/config_response_utils.cc b/src/v/kafka/server/handlers/configs/config_response_utils.cc index a5107b5acb674..1a5f24dc3bcdc 100644 --- a/src/v/kafka/server/handlers/configs/config_response_utils.cc +++ b/src/v/kafka/server/handlers/configs/config_response_utils.cc @@ -100,7 +100,6 @@ consteval describe_configs_type property_config_type() { std::is_same_v || std::is_same_v || std::is_same_v || - std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v; From e03935382e7f7d175953f3ee8ea559ecea812e6d Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 28 Jun 2024 14:26:32 -0700 Subject: [PATCH 3/4] cluster: remove [create|delete]_data_policy_cmd There does not appear to be any non-test user of these types. Signed-off-by: Noah Watkins --- src/v/cluster/commands.h | 18 ------------------ src/v/cluster/controller_log_limiter.h | 2 -- src/v/cluster/tests/serialization_rt_test.cc | 7 ------- 3 files changed, 27 deletions(-) diff --git a/src/v/cluster/commands.h b/src/v/cluster/commands.h index 74a1d16fe2235..55a14f8a5444b 100644 --- a/src/v/cluster/commands.h +++ b/src/v/cluster/commands.h @@ -112,10 +112,6 @@ static constexpr int8_t create_role_cmd_type = 10; static constexpr int8_t delete_role_cmd_type = 11; static constexpr int8_t update_role_cmd_type = 12; -// data policy commands -static constexpr int8_t create_data_policy_cmd_type = 0; -static constexpr int8_t delete_data_policy_cmd_type = 1; - // node management commands static constexpr int8_t decommission_node_cmd_type = 0; static constexpr int8_t recommission_node_cmd_type = 1; @@ -309,20 +305,6 @@ using delete_acls_cmd = controller_command< model::record_batch_type::acl_management_cmd, serde_opts::adl_and_serde>; -using create_data_policy_cmd = controller_command< - model::topic_namespace, - create_data_policy_cmd_data, - create_data_policy_cmd_type, - model::record_batch_type::data_policy_management_cmd, - serde_opts::adl_and_serde>; - -using delete_data_policy_cmd = controller_command< - model::topic_namespace, - std::optional, - delete_data_policy_cmd_type, - model::record_batch_type::data_policy_management_cmd, - serde_opts::adl_and_serde>; - using decommission_node_cmd = controller_command< model::node_id, int8_t, // unused diff --git a/src/v/cluster/controller_log_limiter.h b/src/v/cluster/controller_log_limiter.h index 2e406145d5dd0..463f0b740a516 100644 --- a/src/v/cluster/controller_log_limiter.h +++ b/src/v/cluster/controller_log_limiter.h @@ -94,8 +94,6 @@ class controller_log_limiter { std::is_same_v) { return _acls_and_users_operations_limiter.try_throttle(); } else if constexpr ( - std::is_same_v || // - std::is_same_v || // std::is_same_v || // std::is_same_v) { return _configuration_operations_limiter.try_throttle(); diff --git a/src/v/cluster/tests/serialization_rt_test.cc b/src/v/cluster/tests/serialization_rt_test.cc index d37091077c3b5..fb7d809b84b59 100644 --- a/src/v/cluster/tests/serialization_rt_test.cc +++ b/src/v/cluster/tests/serialization_rt_test.cc @@ -2265,13 +2265,6 @@ SEASTAR_THREAD_TEST_CASE(commands_serialization_test) { random_generators::gen_alphanum_string(15), random_generators::gen_alphanum_string(15)); - roundtrip_cmd( - model::random_topic_namespace(), std::move(create_dp)); - - roundtrip_cmd( - model::random_topic_namespace(), - random_generators::gen_alphanum_string(20)); - roundtrip_cmd( tests::random_named_int(), 0); From 9361d63b4891463e6057cde01c5d1fccd7535db8 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 28 Jun 2024 14:30:25 -0700 Subject: [PATCH 4/4] cluster: remove create_data_policy_cmd_data There does not appear to be any non-test user of the type. Signed-off-by: Noah Watkins --- src/v/cluster/tests/serialization_rt_test.cc | 12 ----------- src/v/cluster/types.cc | 18 ---------------- src/v/cluster/types.h | 22 -------------------- 3 files changed, 52 deletions(-) diff --git a/src/v/cluster/tests/serialization_rt_test.cc b/src/v/cluster/tests/serialization_rt_test.cc index fb7d809b84b59..1ea5ad3b9772f 100644 --- a/src/v/cluster/tests/serialization_rt_test.cc +++ b/src/v/cluster/tests/serialization_rt_test.cc @@ -902,14 +902,6 @@ SEASTAR_THREAD_TEST_CASE(serde_reflection_roundtrip) { } roundtrip_test(data); } - { - cluster::create_data_policy_cmd_data data; - data.dp = v8_engine::data_policy( - random_generators::gen_alphanum_string(20), - random_generators::gen_alphanum_string(20)); - - roundtrip_test(data); - } { cluster::config_status status; status.node = tests::random_named_int(); @@ -2260,10 +2252,6 @@ SEASTAR_THREAD_TEST_CASE(commands_serialization_test) { } roundtrip_cmd(std::move(delete_acl_data), 0); - cluster::create_data_policy_cmd_data create_dp; - create_dp.dp = v8_engine::data_policy( - random_generators::gen_alphanum_string(15), - random_generators::gen_alphanum_string(15)); roundtrip_cmd( tests::random_named_int(), 0); diff --git a/src/v/cluster/types.cc b/src/v/cluster/types.cc index 8f27f0178195f..e8ac1ff57c245 100644 --- a/src/v/cluster/types.cc +++ b/src/v/cluster/types.cc @@ -1141,24 +1141,6 @@ adl::from(iobuf_parser& in) { return ret; } -void adl::to( - iobuf& out, cluster::create_data_policy_cmd_data&& dp_cmd_data) { - return serialize( - out, dp_cmd_data.current_version, std::move(dp_cmd_data.dp)); -} - -cluster::create_data_policy_cmd_data -adl::from(iobuf_parser& in) { - auto version = adl{}.from(in); - vassert( - version == cluster::create_data_policy_cmd_data::current_version, - "Unexpected set_data_policy_cmd version {} (expected {})", - version, - cluster::create_data_policy_cmd_data::current_version); - auto dp = adl{}.from(in); - return cluster::create_data_policy_cmd_data{.dp = std::move(dp)}; -} - void adl::to( iobuf& out, cluster::incremental_topic_updates&& t) { reflection::serialize( diff --git a/src/v/cluster/types.h b/src/v/cluster/types.h index 2c795d4efbcac..c699fb53ec4b6 100644 --- a/src/v/cluster/types.h +++ b/src/v/cluster/types.h @@ -1461,22 +1461,6 @@ struct backend_operation } }; -struct create_data_policy_cmd_data - : serde::envelope< - create_data_policy_cmd_data, - serde::version<0>, - serde::compat_version<0>> { - static constexpr int8_t current_version = 1; // In future dp will be vector - - auto serde_fields() { return std::tie(dp); } - - v8_engine::data_policy dp; - - friend bool operator==( - const create_data_policy_cmd_data&, const create_data_policy_cmd_data&) - = default; -}; - using config_version = named_type; constexpr config_version config_version_unset = config_version{-1}; @@ -3508,12 +3492,6 @@ struct adl { cluster::create_partitions_configuration from(iobuf_parser&); }; -template<> -struct adl { - void to(iobuf&, cluster::create_data_policy_cmd_data&&); - cluster::create_data_policy_cmd_data from(iobuf_parser&); -}; - template<> struct adl { void to(iobuf& out, cluster::incremental_topic_updates&&);