Skip to content

Commit

Permalink
fix clear copyset creating flag when create copyset success
Browse files Browse the repository at this point in the history
  • Loading branch information
cw123 committed May 12, 2022
1 parent 48fb6d9 commit a8f909c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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);
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

0 comments on commit a8f909c

Please sign in to comment.