]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/osd/RadosModel: assure that tid seq is contiguous 36767/head
authorKefu Chai <kchai@redhat.com>
Mon, 24 Aug 2020 13:49:28 +0000 (21:49 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 30 Aug 2020 10:34:18 +0000 (18:34 +0800)
before this change:

4:  finishing write tid 1 to gen81094472-1
4:  finishing write tid 2 to gen81094472-1
4:  finishing write tid 3 to gen81094472-1
4:  finishing write tid 5 to gen81094472-1
4:  finishing write tid 6 to gen81094472-1

after this change:

1:  finishing write tid 1 to gen81117124-1
1:  finishing write tid 2 to gen81117124-1
1:  finishing write tid 3 to gen81117124-1
1:  finishing write tid 4 to gen81117124-1
1:  finishing write tid 5 to gen81117124-1

more pleasant when reading the logging messages.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/osd/RadosModel.h

index 7612b69c1f49fe745d3b14021dd71ab1291d59a8..3eb35a600d00f3cb69a0909f4be8ceda9380b241 100644 (file)
@@ -827,7 +827,8 @@ public:
 
     waiting_on = ranges.size();
     ContentsGenerator::iterator gen_pos = cont_gen->get_iterator(cont);
-    uint64_t tid = 1;
+    // assure that tid is greater than last_acked_tid
+    uint64_t tid = last_acked_tid + 1;
     for (auto [offset, len] : ranges) {
       gen_pos.seek(offset);
       bufferlist to_write = gen_pos.gen_bl_advance(len);
@@ -838,7 +839,7 @@ public:
                << " to " << len + offset << " tid " << tid << std::endl;
       auto cb_arg =
        new pair<TestOp*, TestOp::CallbackInfo*>(this,
-                                                new TestOp::CallbackInfo(tid));
+                                                new TestOp::CallbackInfo(tid++));
       librados::AioCompletion *completion =
        context->rados.aio_create_completion((void*) cb_arg, &write_callback);
       waiting.insert(completion);
@@ -848,12 +849,11 @@ public:
       } else {
        op.write(offset, to_write);
       }
-      if (do_excl && tid == 1)
+      if (do_excl && cb_arg->second->id == last_acked_tid + 1)
        op.assert_exists();
       context->io_ctx.aio_operate(
        context->prefix+oid, completion,
        &op);
-      ++tid;
     }
 
     bufferlist contbl;
@@ -861,7 +861,7 @@ public:
     pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(
        this,
-       new TestOp::CallbackInfo(++tid));
+       new TestOp::CallbackInfo(tid++));
     librados::AioCompletion *completion = context->rados.aio_create_completion(
       (void*) cb_arg, &write_callback);
     waiting.insert(completion);
@@ -876,7 +876,7 @@ public:
     cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(
        this,
-       new TestOp::CallbackInfo(++tid));
+       new TestOp::CallbackInfo(tid++));
     rcompletion = context->rados.aio_create_completion(
          (void*) cb_arg, &write_callback);
     waiting_on++;
@@ -1006,7 +1006,8 @@ public:
 
     waiting_on = ranges.size();
     ContentsGenerator::iterator gen_pos = cont_gen->get_iterator(cont);
-    uint64_t tid = 1;
+    // assure that tid is greater than last_acked_tid
+    uint64_t tid = last_acked_tid + 1;
     for (auto [offset, len] : ranges) {
       gen_pos.seek(offset);
       bufferlist to_write = gen_pos.gen_bl_advance(len);
@@ -1017,7 +1018,7 @@ public:
                << " to " << offset + len << " tid " << tid << std::endl;
       auto cb_arg =
        new pair<TestOp*, TestOp::CallbackInfo*>(this,
-                                                new TestOp::CallbackInfo(tid));
+                                                new TestOp::CallbackInfo(tid++));
       librados::AioCompletion *completion =
        context->rados.aio_create_completion((void*) cb_arg,
                                             &write_callback);
@@ -1029,7 +1030,6 @@ public:
       context->io_ctx.aio_operate(
        context->prefix+oid, completion,
        &op);
-      ++tid;
     }
 
     bufferlist contbl;
@@ -1037,7 +1037,7 @@ public:
     pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(
        this,
-       new TestOp::CallbackInfo(++tid));
+       new TestOp::CallbackInfo(tid++));
     librados::AioCompletion *completion = context->rados.aio_create_completion(
       (void*) cb_arg, &write_callback);
     waiting.insert(completion);
@@ -1050,7 +1050,7 @@ public:
     cb_arg =
       new pair<TestOp*, TestOp::CallbackInfo*>(
        this,
-       new TestOp::CallbackInfo(++tid));
+       new TestOp::CallbackInfo(tid++));
     rcompletion = context->rados.aio_create_completion(
          (void*) cb_arg, &write_callback);
     waiting_on++;