Skip to content

Commit b2d2787

Browse files
committed
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 <[email protected]>
1 parent be4fc03 commit b2d2787

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/rgw/radosgw-admin/radosgw-admin.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,6 +3652,7 @@ int main(int argc, const char **argv)
36523652
int skip_zero_entries = false; // log show
36533653
int purge_keys = false;
36543654
int yes_i_really_mean_it = false;
3655+
int tech_preview = false;
36553656
int delete_child_objects = false;
36563657
int fix = false;
36573658
int remove_bad = false;
@@ -4112,6 +4113,8 @@ int main(int argc, const char **argv)
41124113
// do nothing
41134114
} else if (ceph_argparse_binary_flag(args, i, &yes_i_really_mean_it, NULL, "--yes-i-really-mean-it", (char*)NULL)) {
41144115
// do nothing
4116+
} else if (ceph_argparse_binary_flag(args, i, &tech_preview, NULL, "--tech-preview", (char*)NULL)) {
4117+
// do nothing
41154118
} else if (ceph_argparse_binary_flag(args, i, &fix, NULL, "--fix", (char*)NULL)) {
41164119
// do nothing
41174120
} else if (ceph_argparse_binary_flag(args, i, &remove_bad, NULL, "--remove-bad", (char*)NULL)) {
@@ -9237,6 +9240,18 @@ int main(int argc, const char **argv)
92379240
dedup_type = dedup_req_type_t::DEDUP_TYPE_ESTIMATE;
92389241
}
92399242
else {
9243+
if (!yes_i_really_mean_it) {
9244+
cerr << "Full Dedup is dangerous and could lead to data loss!\n"
9245+
<< "do you really mean it? (requires --yes-i-really-mean-it)"
9246+
<< std::endl;
9247+
return EINVAL;
9248+
}
9249+
if (!tech_preview) {
9250+
cerr << "Full Dedup is supplied as a tech-preview only and should not be used on production systems!\n"
9251+
<< "Please acknowledge that you understand this is a tech preview (requires --tech-preview)"
9252+
<< std::endl;
9253+
return EINVAL;
9254+
}
92409255
dedup_type = dedup_req_type_t::DEDUP_TYPE_FULL;
92419256
#ifndef FULL_DEDUP_SUPPORT
92429257
std::cerr << "Only dedup estimate is supported!" << std::endl;

src/rgw/rgw_dedup_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "include/encoding.h"
2424
#include "common/dout.h"
2525

26-
//#define FULL_DEDUP_SUPPORT
26+
#define FULL_DEDUP_SUPPORT
2727
namespace rgw::dedup {
2828
using work_shard_t = uint16_t;
2929
using md5_shard_t = uint16_t;

src/test/rgw/dedup/test_dedup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ def exec_dedup_internal(expected_dedup_stats, dry_run, max_dedup_time):
10761076
result = admin(['dedup', 'estimate'])
10771077
reset_full_dedup_stats(expected_dedup_stats)
10781078
else:
1079-
result = admin(['dedup', 'restart'])
1079+
result = admin(['dedup', 'restart', '--yes-i-really-mean-it', '--tech-preview'])
10801080

10811081
assert result[1] == 0
10821082
log.debug("wait for dedup to complete")
@@ -1308,14 +1308,14 @@ def check_full_dedup_state():
13081308
global full_dedup_state_was_checked
13091309
global full_dedup_state_disabled
13101310
log.debug("check_full_dedup_state:: sending FULL Dedup request")
1311-
result = admin(['dedup', 'restart'])
1311+
result = admin(['dedup', 'restart', '--yes-i-really-mean-it', '--tech-preview'])
13121312
if result[1] == 0:
1313-
log.debug("full dedup is enabled!")
1313+
log.info("full dedup is enabled!")
13141314
full_dedup_state_disabled = False
13151315
result = admin(['dedup', 'abort'])
13161316
assert result[1] == 0
13171317
else:
1318-
log.debug("full dedup is disabled, skip all full dedup tests")
1318+
log.info("full dedup is disabled, skip all full dedup tests")
13191319
full_dedup_state_disabled = True
13201320

13211321
full_dedup_state_was_checked = True

0 commit comments

Comments
 (0)