From 742f8abc501475ae9315c5d8fdd48352f6f045b2 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 24 Aug 2020 21:49:28 +0800 Subject: [PATCH] test/osd/RadosModel: assure that tid seq is contiguous 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 --- src/test/osd/RadosModel.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index 7612b69c1f49f..3eb35a600d00f 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -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(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 *cb_arg = new pair( 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( 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(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 *cb_arg = new pair( 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( this, - new TestOp::CallbackInfo(++tid)); + new TestOp::CallbackInfo(tid++)); rcompletion = context->rados.aio_create_completion( (void*) cb_arg, &write_callback); waiting_on++; -- 2.39.5