]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test, qa/suite: add tier_flush test
authormyoungwon oh <omwmw@sk.com>
Fri, 12 Jul 2019 11:22:24 +0000 (20:22 +0900)
committermyoungwon oh <omwmw@sk.com>
Fri, 12 Jul 2019 13:23:22 +0000 (22:23 +0900)
Signed-off-by: Myoungwon Oh <omwmw@sk.com>
qa/suites/rados/thrash/workloads/set-chunk-promote-flush.yaml [new file with mode: 0644]
src/test/osd/RadosModel.h
src/test/osd/TestRados.cc

diff --git a/qa/suites/rados/thrash/workloads/set-chunk-promote-flush.yaml b/qa/suites/rados/thrash/workloads/set-chunk-promote-flush.yaml
new file mode 100644 (file)
index 0000000..8f7ee22
--- /dev/null
@@ -0,0 +1,16 @@
+tasks:
+- exec:
+    client.0:
+      - sudo ceph osd pool create low_tier 4
+- rados:
+    clients: [client.0]
+    low_tier_pool: 'low_tier'
+    ops: 1500
+    objects: 50
+    set_chunk: true
+    op_weights:
+      read: 100
+      write: 100
+      tier_promote: 10
+      tier_flush: 10
+
index f7cac8e16be7424cf2ab4354b0f6d403b5f38265..a97e87455b5a01012bf5b42f1914743100365318 100644 (file)
@@ -67,7 +67,8 @@ enum TestOpType {
   TEST_OP_SET_REDIRECT,
   TEST_OP_UNSET_REDIRECT,
   TEST_OP_CHUNK_READ,
-  TEST_OP_TIER_PROMOTE
+  TEST_OP_TIER_PROMOTE,
+  TEST_OP_TIER_FLUSH
 };
 
 class TestWatchContext : public librados::WatchCtx2 {
@@ -2695,6 +2696,74 @@ public:
   }
 };
 
+class TierFlushOp : public TestOp {
+public:
+  librados::AioCompletion *completion;
+  librados::ObjectWriteOperation op;
+  string oid;
+  std::shared_ptr<int> in_use;
+
+  TierFlushOp(int n,
+              RadosTestContext *context,
+              const string &oid,
+              TestOpStat *stat)
+    : TestOp(n, context, stat),
+      completion(NULL),
+      oid(oid)
+  {}
+
+  void _begin() override
+  {
+    context->state_lock.Lock();
+
+    context->oid_in_use.insert(oid);
+    context->oid_not_in_use.erase(oid);
+
+    pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
+      new pair<TestOp*, TestOp::CallbackInfo*>(this,
+                                              new TestOp::CallbackInfo(0));
+    completion = context->rados.aio_create_completion((void *) cb_arg, NULL,
+                                                     &write_callback);
+    context->state_lock.Unlock();
+
+    op.tier_flush();
+    int r = context->io_ctx.aio_operate(context->prefix+oid, completion,
+                                       &op);
+    ceph_assert(!r);
+  }
+
+  void _finish(CallbackInfo *info) override
+  {
+    context->state_lock.Lock();
+    ceph_assert(!done);
+    ceph_assert(completion->is_complete());
+
+    int r = completion->get_return_value();
+    cout << num << ":  got " << cpp_strerror(r) << std::endl;
+    if (r == 0) {
+      // sucess
+    } else {
+      ceph_abort_msg("shouldn't happen");
+    }
+    context->update_object_version(oid, completion->get_version64());
+    context->oid_in_use.erase(oid);
+    context->oid_not_in_use.insert(oid);
+    context->kick();
+    done = true;
+    context->state_lock.Unlock();
+  }
+
+  bool finished() override
+  {
+    return done;
+  }
+
+  string getType() override
+  {
+    return "TierFlushOp";
+  }
+};
+
 class HitSetListOp : public TestOp {
   librados::AioCompletion *comp1, *comp2;
   uint32_t hash;
index 8784005ad13f8bfc086c9764088fc2d48519a45a..7c975eaaa40186f01c98fbd0a56716c502ce08e6 100644 (file)
@@ -420,6 +420,11 @@ private:
       cout << m_op << ": " << "tier_promote oid " << oid << std::endl;
       return new TierPromoteOp(m_op, &context, oid, m_stats);
 
+    case TEST_OP_TIER_FLUSH:
+      oid = *(rand_choose(context.oid_not_in_use));
+      cout << m_op << ": " << "tier_flush oid " << oid << std::endl;
+      return new TierFlushOp(m_op, &context, oid, m_stats);
+
     case TEST_OP_SET_REDIRECT:
       oid = *(rand_choose(context.oid_not_in_use));
       oid2 = *(rand_choose(context.oid_redirect_not_in_use));
@@ -493,6 +498,7 @@ int main(int argc, char **argv)
     { TEST_OP_UNSET_REDIRECT, "unset_redirect", true },
     { TEST_OP_CHUNK_READ, "chunk_read", true },
     { TEST_OP_TIER_PROMOTE, "tier_promote", true },
+    { TEST_OP_TIER_FLUSH, "tier_flush", true },
     { TEST_OP_READ /* grr */, NULL },
   };