]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/test_dedup_tool.sh: add snapshot test during sample dedup 52261/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 29 Jun 2023 15:53:14 +0000 (15:53 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Sun, 15 Oct 2023 03:26:05 +0000 (03:26 +0000)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
qa/workunits/rados/test_dedup_tool.sh

index 18deb331b60ae20a9baebddefc77e8cac5bcb81b..352e9ef09c193d756882262d2ca11ada6d8f24bd 100755 (executable)
@@ -446,11 +446,82 @@ function test_sample_dedup()
   $CEPH_TOOL osd pool delete $CHUNK_POOL $CHUNK_POOL --yes-i-really-really-mean-it
 }
 
+function test_sample_dedup_snap()
+{
+  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
+  run_expect_succ "$CEPH_TOOL" osd pool set "$POOL" dedup_tier "$CHUNK_POOL"
+  run_expect_succ "$CEPH_TOOL" osd pool set "$POOL" dedup_chunk_algorithm fastcdc
+  run_expect_succ "$CEPH_TOOL" osd pool set "$POOL" dedup_cdc_chunk_size 8192
+  run_expect_succ "$CEPH_TOOL" osd pool set "$POOL" fingerprint_algorithm sha1
+
+  # 8 Dedupable objects
+  CONTENT_1="There hiHI"
+  echo $CONTENT_1 > foo
+  for num in `seq 1 8`
+  do
+    $RADOS_TOOL -p $POOL put foo_$num ./foo
+  done
+
+  # 1 Unique object
+  CONTENT_2="There hiHI3"
+  echo $CONTENT_2 > foo3
+  $RADOS_TOOL -p $POOL put foo3_1 ./foo3
+
+  $RADOS_TOOL -p $POOL mksnap mysnap
+
+  SNAP_CONTENT="There HIHIHI" 
+  echo $SNAP_CONTENT > foo3_new
+  $RADOS_TOOL -p $POOL put foo3_1 ./foo3_new
+
+  $RADOS_TOOL -p $POOL mksnap mysnap2
+  $RADOS_TOOL -p $POOL put foo3_1 ./foo3_new
+
+  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 1 --sampling-ratio 100 --snap)
+
+  CHUNK_OID_2=$(echo $CONTENT_2 | sha1sum | awk '{print $1}')
+  SNAP_CONTENT_OID=$(echo $SNAP_CONTENT | sha1sum | awk '{print $1}')
+
+  # Find chunk object has references of 8 dedupable meta objects
+  RESULT=$($DEDUP_TOOL --op dump-chunk-refs --chunk-pool $CHUNK_POOL --object $SNAP_CONTENT_OID | grep foo3_1)
+  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 foo3_1)
+  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 ./foo3 ./foo3_new
+  for num in `seq 1 8`
+  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
 test_dedup_chunk_repair
 test_dedup_object
 test_sample_dedup
+test_sample_dedup_snap
 
 $CEPH_TOOL osd pool delete $POOL $POOL --yes-i-really-really-mean-it