From: Gabriel BenHanokh Date: Mon, 30 Jun 2025 13:01:14 +0000 (+0000) Subject: rgw/dedup: tech preview for full object dedup support which means duplicate objects X-Git-Tag: testing/wip-vshankar-testing-20250915.121327-debug~9^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b2d278793c80ddbae93989a4ff21fe996facbef0;p=ceph-ci.git rgw/dedup: tech preview for full object dedup support which means duplicate objects will be deleted (until now they were only reported) Signed-off-by: Gabriel BenHanokh --- diff --git a/src/rgw/radosgw-admin/radosgw-admin.cc b/src/rgw/radosgw-admin/radosgw-admin.cc index 2a79d9d421e..54246e68b8d 100644 --- a/src/rgw/radosgw-admin/radosgw-admin.cc +++ b/src/rgw/radosgw-admin/radosgw-admin.cc @@ -3652,6 +3652,7 @@ int main(int argc, const char **argv) int skip_zero_entries = false; // log show int purge_keys = false; int yes_i_really_mean_it = false; + int tech_preview = false; int delete_child_objects = false; int fix = false; int remove_bad = false; @@ -4112,6 +4113,8 @@ int main(int argc, const char **argv) // do nothing } else if (ceph_argparse_binary_flag(args, i, &yes_i_really_mean_it, NULL, "--yes-i-really-mean-it", (char*)NULL)) { // do nothing + } else if (ceph_argparse_binary_flag(args, i, &tech_preview, NULL, "--tech-preview", (char*)NULL)) { + // do nothing } else if (ceph_argparse_binary_flag(args, i, &fix, NULL, "--fix", (char*)NULL)) { // do nothing } else if (ceph_argparse_binary_flag(args, i, &remove_bad, NULL, "--remove-bad", (char*)NULL)) { @@ -9237,6 +9240,18 @@ next: dedup_type = dedup_req_type_t::DEDUP_TYPE_ESTIMATE; } else { + if (!yes_i_really_mean_it) { + cerr << "Full Dedup is dangerous and could lead to data loss!\n" + << "do you really mean it? (requires --yes-i-really-mean-it)" + << std::endl; + return EINVAL; + } + if (!tech_preview) { + cerr << "Full Dedup is supplied as a tech-preview only and should not be used on production systems!\n" + << "Please acknowledge that you understand this is a tech preview (requires --tech-preview)" + << std::endl; + return EINVAL; + } dedup_type = dedup_req_type_t::DEDUP_TYPE_FULL; #ifndef FULL_DEDUP_SUPPORT std::cerr << "Only dedup estimate is supported!" << std::endl; diff --git a/src/rgw/rgw_dedup_utils.h b/src/rgw/rgw_dedup_utils.h index 6a1d0fc0f45..859724acdf7 100644 --- a/src/rgw/rgw_dedup_utils.h +++ b/src/rgw/rgw_dedup_utils.h @@ -23,7 +23,7 @@ #include "include/encoding.h" #include "common/dout.h" -//#define FULL_DEDUP_SUPPORT +#define FULL_DEDUP_SUPPORT namespace rgw::dedup { using work_shard_t = uint16_t; using md5_shard_t = uint16_t; diff --git a/src/test/rgw/dedup/test_dedup.py b/src/test/rgw/dedup/test_dedup.py index a339e25b6b4..d8b3540e2be 100644 --- a/src/test/rgw/dedup/test_dedup.py +++ b/src/test/rgw/dedup/test_dedup.py @@ -1076,7 +1076,7 @@ def exec_dedup_internal(expected_dedup_stats, dry_run, max_dedup_time): result = admin(['dedup', 'estimate']) reset_full_dedup_stats(expected_dedup_stats) else: - result = admin(['dedup', 'restart']) + result = admin(['dedup', 'restart', '--yes-i-really-mean-it', '--tech-preview']) assert result[1] == 0 log.debug("wait for dedup to complete") @@ -1308,14 +1308,14 @@ def check_full_dedup_state(): global full_dedup_state_was_checked global full_dedup_state_disabled log.debug("check_full_dedup_state:: sending FULL Dedup request") - result = admin(['dedup', 'restart']) + result = admin(['dedup', 'restart', '--yes-i-really-mean-it', '--tech-preview']) if result[1] == 0: - log.debug("full dedup is enabled!") + log.info("full dedup is enabled!") full_dedup_state_disabled = False result = admin(['dedup', 'abort']) assert result[1] == 0 else: - log.debug("full dedup is disabled, skip all full dedup tests") + log.info("full dedup is disabled, skip all full dedup tests") full_dedup_state_disabled = True full_dedup_state_was_checked = True