]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test: add snap to send TierEvictOp to snapshotted manifest object
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 11 Feb 2021 13:48:22 +0000 (22:48 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Mon, 29 Mar 2021 08:14:16 +0000 (17:14 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/test/osd/RadosModel.h

index 1bec8d280856cf4fa568f7ae9e57203358709662..69430b3fcba2e204ea995e57c3e66a443e1a5839 100644 (file)
@@ -2844,6 +2844,7 @@ public:
   librados::ObjectReadOperation op;
   string oid;
   std::shared_ptr<int> in_use;
+  int snap;
 
   TierEvictOp(int n,
               RadosTestContext *context,
@@ -2851,13 +2852,27 @@ public:
               TestOpStat *stat)
     : TestOp(n, context, stat),
       completion(NULL),
-      oid(oid)
+      oid(oid),
+      snap(-1)
   {}
 
   void _begin() override
   {
     context->state_lock.lock();
 
+    if (0 && !(rand() % 4) && !context->snaps.empty()) {
+      snap = rand_choose(context->snaps)->first;
+      in_use = context->snaps_in_use.lookup_or_create(snap, snap);
+    } else {
+      snap = -1;
+    }
+
+    cout << num << ": tier_evict oid " << oid << " snap " << snap << std::endl;
+
+    if (snap >= 0) {
+      context->io_ctx.snap_set_read(context->snaps[snap]);
+    }
+
     pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(this,
                                               new TestOp::CallbackInfo(0));
@@ -2870,6 +2885,10 @@ public:
                                        &op, librados::OPERATION_IGNORE_CACHE,
                                        NULL);
     ceph_assert(!r);
+
+    if (snap >= 0) {
+      context->io_ctx.snap_set_read(0);
+    }
   }
 
   void _finish(CallbackInfo *info) override