From: myoungwon oh Date: Fri, 3 Nov 2023 03:18:32 +0000 (+0000) Subject: tools/ceph_dedup_tool: add a test to check the memory limit works correctly X-Git-Tag: v19.0.0~73^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c4275c9842cbd5f80b87b84a34bcb56d480129fc;p=ceph.git tools/ceph_dedup_tool: add a test to check the memory limit works correctly Signed-off-by: Myoungwon Oh --- diff --git a/qa/workunits/rados/test_dedup_tool.sh b/qa/workunits/rados/test_dedup_tool.sh index 352e9ef09c193..381094c57c271 100755 --- a/qa/workunits/rados/test_dedup_tool.sh +++ b/qa/workunits/rados/test_dedup_tool.sh @@ -515,6 +515,76 @@ function test_sample_dedup_snap() $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it } +function test_dedup_memory_limit() +{ + CHUNK_POOL=dedup_chunk_pool + $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it + $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it + + sleep 2 + + run_expect_succ "$CEPH_TOOL" osd pool create "$POOL" 8 + run_expect_succ "$CEPH_TOOL" osd pool create "$CHUNK_POOL" 8 + + # 6 dedupable objects + CONTENT_1="There hiHI" + echo $CONTENT_1 > foo + for num in `seq 1 6` + do + $RADOS_TOOL -p $POOL put foo_$num ./foo + done + + # 3 Unique objects + for num in `seq 7 9` + do + CONTENT_="There hiHI"$num + echo $CONTENT_ > foo + $RADOS_TOOL -p $POOL put foo_$num ./foo + done + + # 6 dedupable objects + CONTENT_2="There hiHIhi" + echo $CONTENT_2 > foo + for num in `seq 10 15` + do + $RADOS_TOOL -p $POOL put foo_$num ./foo + done + + #Since the memory limit is 100 bytes, adding 3 unique objects causes a memory drop, leaving + #the chunk of the 6 dupable objects. If we then add 6 dedupable objects to the pool, + #the crawler should find dedupable chunks because it free memory space through the memory drop before. + # 1 entry == 46 bytes + + sleep 2 + + # Execute dedup crawler + RESULT=$($DEDUP_TOOL --pool $POOL --chunk-pool $CHUNK_POOL --op sample-dedup --chunk-algorithm fastcdc --fingerprint-algorithm sha1 --chunk-dedup-threshold 2 --sampling-ratio 100 --fpstore-threshold 100) + + CHUNK_OID_1=$(echo $CONTENT_1 | sha1sum | awk '{print $1}') + CHUNK_OID_2=$(echo $CONTENT_2 | sha1sum | awk '{print $1}') + + RESULT=$($DEDUP_TOOL --op dump-chunk-refs --chunk-pool $CHUNK_POOL --object $CHUNK_OID_1 | grep foo) + if [ -z "$RESULT" ] ; then + $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it + $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it + die "There is no expected chunk object" + fi + + RESULT=$($DEDUP_TOOL --op dump-chunk-refs --chunk-pool $CHUNK_POOL --object $CHUNK_OID_2 | grep foo) + if [ -z "$RESULT" ] ; then + $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it + $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it + die "There is no expected chunk object" + fi + + rm -rf ./foo + for num in `seq 1 15` + do + $RADOS_TOOL -p $POOL rm foo_$num + done + + $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it +} test_dedup_ratio_fixed test_dedup_chunk_scrub @@ -522,6 +592,7 @@ test_dedup_chunk_repair test_dedup_object test_sample_dedup test_sample_dedup_snap +test_dedup_memory_limit $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it