From 599fc3c79eaf677960b36ee90737e435b7aee47f Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 3 Jul 2023 15:00:17 -0400 Subject: [PATCH] rgw: require zonegroup feature to compress encrypted objects Reef adds support for combining server-side encryption and compression, but previous releases would not replicate such objects correctly. gate the feature behind a zonegroup feature flag to require that all zones upgrade to reef before enabling. this feature is not enabled by default in new zonegroups Fixes: https://tracker.ceph.com/issues/57905 Signed-off-by: Casey Bodley (cherry picked from commit 4bc52954ab7b38a8eac50c116196d6db728cee00) Conflicts: src/rgw/rgw_op.cc: SiteConfig -> sal::ZoneGroup::supports --- src/rgw/rgw_op.cc | 6 +++++- src/rgw/rgw_zone_features.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index b9715e6b2bd..79d7e939694 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -4182,7 +4182,11 @@ void RGWPutObj::execute(optional_yield y) if (encrypt != nullptr) { filter = &*encrypt; } - if (compression_type != "none") { + // a zonegroup feature is required to combine compression and encryption + const rgw::sal::ZoneGroup& zonegroup = driver->get_zone()->get_zonegroup(); + const bool compress_encrypted = zonegroup.supports(rgw::zone_features::compress_encrypted); + if (compression_type != "none" && + (encrypt == nullptr || compress_encrypted)) { plugin = get_compressor_plugin(s, compression_type); if (!plugin) { ldpp_dout(this, 1) << "Cannot load plugin for compression type " diff --git a/src/rgw/rgw_zone_features.h b/src/rgw/rgw_zone_features.h index 7e47f8cf4a7..5e1a435d488 100644 --- a/src/rgw/rgw_zone_features.h +++ b/src/rgw/rgw_zone_features.h @@ -14,10 +14,12 @@ namespace rgw::zone_features { // zone feature names inline constexpr std::string_view resharding = "resharding"; +inline constexpr std::string_view compress_encrypted = "compress-encrypted"; // static list of features supported by this release inline constexpr std::initializer_list supported = { resharding, + compress_encrypted, }; inline constexpr bool supports(std::string_view feature) { -- 2.39.5