Skip to content

Commit

Permalink
test/osd/TestRados.cc: run test after finishing redirect setup
Browse files Browse the repository at this point in the history
set-redirect test creates more objects than default due to redirect mapping
(let's assume that we create 500 objects, oid 1 -> oid 501, oid 2 -> oid 502)
But the test should use objects within pre-defined range. For example,
If the number of object is 500, only 1~500 oid are allowed for test operations.

In the failure cases, test operation tried to use wrong oids (which means
higher than 500). This is because the bug in the setup phase.
If max_inflights > 1, set-redirect can be finished after setup is completed.
(so wrong oid is included in oid_in_use).
We need to completely remove redirect objects in oid_in_use before start the test.

Fixes: http://tracker.ceph.com/issues/20114
Signed-off-by: Myoungwon Oh <[email protected]>
  • Loading branch information
myoungwon committed May 31, 2017
1 parent 37b7a1e commit a058ebb
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/test/osd/TestRados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,27 @@ class WeightedTestGenerator : public TestOpGenerator
return new SetRedirectOp(m_op, &context, oid.str(), oid2.str(), context.pool_name);
}

if (!context.oid_redirect_not_in_use.size() && m_op == set_redirect_end+1) {
for (int t_op = m_objects+1; t_op <= create_objects_end; t_op++) {
stringstream oid;
oid << t_op;
if (t_op % 2) {
oid << " " << string(300, 'o');
}
context.oid_not_flushing.erase(oid.str());
context.oid_not_in_use.erase(oid.str());
context.oid_in_use.erase(oid.str());
if (t_op > m_objects + m_initial_redirected_objects) {
context.oid_redirect_not_in_use.insert(oid.str());
}
}
if (!context.oid_redirect_not_in_use.size() && m_op > set_redirect_end) {
int set_size = context.oid_not_in_use.size();
if (set_size < m_objects + m_redirect_objects) {
return NULL;
}
for (int t_op = m_objects+1; t_op <= create_objects_end; t_op++) {
stringstream oid;
oid << t_op;
if (t_op % 2) {
oid << " " << string(300, 'o');
}
context.oid_not_flushing.erase(oid.str());
context.oid_not_in_use.erase(oid.str());
context.oid_in_use.erase(oid.str());
cout << m_op << ": " << " remove oid " << oid.str() << " from oid_*_use " << std::endl;
if (t_op > m_objects + m_initial_redirected_objects) {
context.oid_redirect_not_in_use.insert(oid.str());
}
}
cout << m_op << ": " << " oid_not_in_use: " << context.oid_not_in_use.size()
<< " oid_in_use: " << context.oid_in_use.size() << std::endl;
}
}

Expand Down

0 comments on commit a058ebb

Please sign in to comment.