From: Casey Bodley Date: Mon, 3 Jul 2023 19:00:17 +0000 (-0400) Subject: rgw: require zonegroup feature to compress encrypted objects X-Git-Tag: v19.0.0~910^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4bc52954ab7b38a8eac50c116196d6db728cee00;p=ceph.git 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 --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 77adef88c74..80c2894ed66 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -4199,7 +4199,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 RGWZoneGroup& zonegroup = s->penv.site->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) {