mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
test/osd/RadosModel.h: select and reserve roll_back_to atomically
Signed-off-by: Samuel Just <sam.just@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
99c5319c2c
commit
ca4c166b7e
@ -1325,11 +1325,10 @@ public:
|
||||
RollbackOp(int n,
|
||||
RadosTestContext *context,
|
||||
const string &_oid,
|
||||
int snap,
|
||||
TestOpStat *stat = 0)
|
||||
: TestOp(n, context, stat),
|
||||
oid(_oid),
|
||||
roll_back_to(snap), done(false)
|
||||
roll_back_to(-1), done(false)
|
||||
{}
|
||||
|
||||
void _begin()
|
||||
@ -1340,10 +1339,22 @@ public:
|
||||
context->state_lock.Unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
if (context->snaps.empty()) {
|
||||
context->kick();
|
||||
context->state_lock.Unlock();
|
||||
done = true;
|
||||
return;
|
||||
}
|
||||
|
||||
context->oid_in_use.insert(oid);
|
||||
context->oid_not_in_use.erase(oid);
|
||||
|
||||
roll_back_to = rand_choose(context->snaps)->first;
|
||||
context->snaps_in_use.insert(roll_back_to);
|
||||
|
||||
cout << "rollback oid " << oid << " to " << roll_back_to << std::endl;
|
||||
|
||||
context->roll_back(oid, roll_back_to);
|
||||
uint64_t snap = context->snaps[roll_back_to];
|
||||
|
||||
|
@ -123,14 +123,10 @@ private:
|
||||
}
|
||||
|
||||
case TEST_OP_ROLLBACK:
|
||||
if (context.snaps.empty()) {
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
int snap = rand_choose(context.snaps)->first;
|
||||
string oid = *(rand_choose(context.oid_not_in_use));
|
||||
cout << "rollback oid " << oid << " to " << snap << std::endl;
|
||||
return new RollbackOp(m_op, &context, oid, snap);
|
||||
cout << "rollback oid " << oid << std::endl;
|
||||
return new RollbackOp(m_op, &context, oid);
|
||||
}
|
||||
|
||||
case TEST_OP_SETATTR:
|
||||
|
Loading…
Reference in New Issue
Block a user