Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jewel: mon: crash: crush/CrushWrapper.h: 940: FAILED assert(successful_detach) #10496

Merged
1 commit merged into from Oct 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/crush/builder.c
Expand Up @@ -1015,7 +1015,8 @@ int crush_remove_tree_bucket_item(struct crush_bucket_tree *bucket, int item)

if (bucket->h.items[i] != item)
continue;


bucket->h.items[i] = 0;
node = crush_calc_tree_node(i);
weight = bucket->node_weights[node];
bucket->node_weights[node] = 0;
Expand Down
42 changes: 42 additions & 0 deletions src/test/crush/CrushWrapper.cc
Expand Up @@ -708,6 +708,48 @@ TEST(CrushWrapper, insert_item) {
delete c;
}

TEST(CrushWrapper, remove_item) {
auto *c = new CrushWrapper;

const int ROOT_TYPE = 2;
c->set_type_name(ROOT_TYPE, "root");
const int HOST_TYPE = 1;
c->set_type_name(HOST_TYPE, "host");
const int OSD_TYPE = 0;
c->set_type_name(OSD_TYPE, "osd");

{
int root;
ASSERT_EQ(0, c->add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_RJENKINS1,
ROOT_TYPE, 0, NULL, NULL, &root));
c->set_item_name(root, "root0");
}

{
int host;
c->add_bucket(0, CRUSH_BUCKET_TREE, CRUSH_HASH_RJENKINS1,
HOST_TYPE, 0, NULL, NULL, &host);
c->set_item_name(host, "host0");
}

const int num_osd = 12;
{
map<string, string> loc = {{"root", "root0"},
{"host", "host0"}};
string name{"osd."};
for (int item = 0; item < num_osd; item++) {
ASSERT_EQ(0, c->insert_item(g_ceph_context, item, 1.0,
name + to_string(item), loc));
}
}
const int item_to_remove = num_osd / 2;
map<string, string> loc;
loc.insert(c->get_immediate_parent(item_to_remove));
ASSERT_EQ(0, c->remove_item(g_ceph_context, item_to_remove, true));
float weight;
EXPECT_FALSE(c->check_item_loc(g_ceph_context, item_to_remove, loc, &weight));
}

TEST(CrushWrapper, item_bucket_names) {
CrushWrapper *c = new CrushWrapper;
int index = 123;
Expand Down