]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test: use fingerprint OID when calling SetChunkOp
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 8 Feb 2021 02:29:54 +0000 (11:29 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Mon, 29 Mar 2021 08:08:49 +0000 (17:08 +0900)
To align with CDC, which uses fingerprint OID,
this commit makes SetChunkOp to use fingerprint OID

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/test/osd/RadosModel.h
src/test/osd/TestRados.cc

index 36fff7afb7ae91e93f10203ec3235e0a744cff34..63933a5e2bfa1f64924db52aa85701777665b835 100644 (file)
@@ -22,6 +22,7 @@
 #include "common/sharedptr_registry.hpp"
 #include "common/errno.h"
 #include "osd/HitSet.h"
+#include "common/ceph_crypto.h"
 
 #ifndef RADOSMODEL_H
 #define RADOSMODEL_H
@@ -2355,8 +2356,25 @@ public:
 
     if (src_value.version != 0 && !src_value.deleted())
       op.assert_version(src_value.version);
+
+    string target_oid;
+    if (!oid_tgt.empty()) {
+      target_oid = oid_tgt;
+    } else {
+      bufferlist bl;
+      int r = context->io_ctx.read(context->prefix+oid, bl, offset, length);
+      ceph_assert(r > 0);
+      string fp_oid = ceph::crypto::digest<ceph::crypto::SHA256>(bl).to_str();
+      r = context->low_tier_io_ctx.write(fp_oid, bl, bl.length(), 0);
+      ceph_assert(r == 0);
+      target_oid = fp_oid;
+      tgt_offset = 0;
+    }
+
+    cout << num << ": target oid " << target_oid << " offset " << tgt_offset << std::endl;
+
     op.set_chunk(offset, length, context->low_tier_io_ctx, 
-                context->prefix+oid_tgt, tgt_offset, CEPH_OSD_OP_FLAG_WITH_REFERENCE);
+                context->prefix+target_oid, tgt_offset, CEPH_OSD_OP_FLAG_WITH_REFERENCE);
 
     pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(this,
index 9fb8c626d32594ceae680e134d5682acf9a4175c..afb786c775f129fee47570ffde99541eea42dbc3 100644 (file)
@@ -449,14 +449,12 @@ private:
       {
        ceph_assert(m_enable_dedup);
        oid = *(rand_choose(context.oid_not_in_use));
-       /* The intention here is to mark the source object as a manifest object */
-       oid2 = *(rand_choose(context.oid_set_chunk_tgt_pool));
        uint32_t rand_offset = 0, rand_length = 0;
        get_rand_off_len(context, oid, rand_offset, rand_length);
        cout << m_op << ": " << "set_chunk oid " << oid << " offset: " << rand_offset 
-            << " length: " << rand_length <<  " target oid " << oid2 
+            << " length: " << rand_length <<  " target oid " << ""
             << " tgt_offset: " << rand_offset << std::endl;
-       return new SetChunkOp(m_op, &context, oid, rand_offset, rand_length, oid2, rand_offset, m_stats);
+       return new SetChunkOp(m_op, &context, oid, rand_offset, rand_length, "", rand_offset, m_stats);
       }
 
     case TEST_OP_TIER_EVICT: