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

fix clear copyset creating flag when create copyset success #1417

Merged
merged 1 commit into from
May 12, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion curvefs/src/mds/topology/topology_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ TopoStatusCode TopologyManager::CreateCopyset(
return TopoStatusCode::TOPO_CREATE_COPYSET_ON_METASERVER_FAIL;
}

// add copyset record to topogy
// add copyset record to topology
CopySetInfo copysetInfo(copyset.poolId, copyset.copysetId);
copysetInfo.SetCopySetMembers(copyset.metaServerIds);
auto ret = topology_->AddCopySet(copysetInfo);
Expand All @@ -866,6 +866,7 @@ TopoStatusCode TopologyManager::CreateCopyset(
return ret;
}

ClearCopysetCreating(copyset.poolId, copyset.copysetId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to move this line of code before 856 and remove line 865, so you don't have to repeat it.

and should you add some unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然都是去掉creating的标记,但是清理的时机是不一样的。如果都挪到856行,和原意还是有区别的。

Although the marking of creating is removed, the timing of cleaning is different. If it is moved to line 856, it is still different from the original intention.

return TopoStatusCode::TOPO_OK;
}

Expand Down
4 changes: 4 additions & 0 deletions curvefs/test/mds/topology/test_topology_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,7 @@ TEST_F(TestTopologyManager,
ASSERT_TRUE(topology_->GetCopySet(key, &info));
ASSERT_EQ(copysetId, info.GetId());
ASSERT_EQ(1, info.GetPartitionNum());
ASSERT_FALSE(topology_->IsCopysetCreating(key));
}

TEST_F(TestTopologyManager,
Expand Down Expand Up @@ -1965,6 +1966,7 @@ TEST_F(TestTopologyManager,
ASSERT_TRUE(topology_->GetCopySet(key, &info));
ASSERT_EQ(copysetId, info.GetId());
ASSERT_EQ(1, info.GetPartitionNum());
ASSERT_FALSE(topology_->IsCopysetCreating(key));
}

TEST_F(TestTopologyManager,
Expand Down Expand Up @@ -2097,6 +2099,7 @@ TEST_F(TestTopologyManager,
ASSERT_TRUE(topology_->GetCopySet(key, &info));
ASSERT_EQ(copysetId, info.GetId());
ASSERT_EQ(1, info.GetPartitionNum());
ASSERT_FALSE(topology_->IsCopysetCreating(key));
}

TEST_F(TestTopologyManager,
Expand Down Expand Up @@ -2182,6 +2185,7 @@ TEST_F(TestTopologyManager,
ASSERT_TRUE(topology_->GetCopySet(key, &info));
ASSERT_EQ(copysetId, info.GetId());
ASSERT_EQ(1, info.GetPartitionNum());
ASSERT_FALSE(topology_->IsCopysetCreating(key));
}

TEST_F(TestTopologyManager, test_CommitTx_Success) {
Expand Down