test: Handle destructor of KvStoreBench by adding io_ctx_ready bool

Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
David Zafman 2014-09-09 17:57:07 -07:00
parent 21a0eb3618
commit 3de15e8bb8
2 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,8 @@ KvStoreBench::KvStoreBench()
ops_in_flight(0),
ops_in_flight_lock("KvStoreBench::ops_in_flight_lock"),
rados_id("admin"),
pool_name("rbd")
pool_name("rbd"),
io_ctx_ready(false)
{
probs[25] = 'i';
probs[50] = 'u';
@ -47,9 +48,11 @@ KvStoreBench::KvStoreBench()
KvStoreBench::~KvStoreBench()
{
librados::ObjectWriteOperation owo;
owo.remove();
io_ctx.operate(client_name + ".done-setting", &owo);
if (io_ctx_ready) {
librados::ObjectWriteOperation owo;
owo.remove();
io_ctx.operate(client_name + ".done-setting", &owo);
}
delete kvs;
}
@ -187,6 +190,7 @@ int KvStoreBench::setup(int argc, const char** argv) {
rados.shutdown();
return r;
}
io_ctx_ready = true;
if (clear_first) {
librados::ObjectIterator it;

View File

@ -125,6 +125,7 @@ protected:
librados::Rados rados;
string rados_id;
string pool_name;
bool io_ctx_ready;
librados::IoCtx io_ctx;
/**