Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
|
@ -42,13 +42,12 @@ namespace mds {
|
|||
namespace heartbeat {
|
||||
HeartbeatManager::HeartbeatManager(
|
||||
const HeartbeatOption &option, const std::shared_ptr<Topology> &topology,
|
||||
const std::shared_ptr<Coordinator> &coordinator,
|
||||
const std::shared_ptr<TopologyManager> &topologyManager)
|
||||
const std::shared_ptr<Coordinator> &coordinator)
|
||||
: topology_(topology) {
|
||||
healthyChecker_ =
|
||||
std::make_shared<MetaserverHealthyChecker>(option, topology);
|
||||
|
||||
topoUpdater_ = std::make_shared<TopoUpdater>(topology, topologyManager);
|
||||
topoUpdater_ = std::make_shared<TopoUpdater>(topology);
|
||||
|
||||
copysetConfGenerator_ = std::make_shared<CopysetConfGenerator>(
|
||||
topology, coordinator, option.mdsStartTime,
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ class HeartbeatManager {
|
|||
public:
|
||||
HeartbeatManager(const HeartbeatOption &option,
|
||||
const std::shared_ptr<Topology> &topology,
|
||||
const std::shared_ptr<Coordinator> &coordinator,
|
||||
const std::shared_ptr<TopologyManager> &topologyManager);
|
||||
const std::shared_ptr<Coordinator> &coordinator);
|
||||
|
||||
~HeartbeatManager() { Stop(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -222,28 +222,6 @@ void TopoUpdater::UpdatePartitionTopo(
|
|||
LOG(WARNING) << "hearbeat report partition which is not in topo"
|
||||
<< ", copysetId = " << copySetId
|
||||
<< ", partitionId = " << it.GetPartitionId();
|
||||
|
||||
const int maxRetries = 3;
|
||||
int retries = 0;
|
||||
|
||||
// get copyset members
|
||||
std::set<std::string> copysetMemberAddr;
|
||||
TopoStatusCode ret;
|
||||
do {
|
||||
ret = topologyManager_->GetCopysetMembers(it.GetPoolId(), copySetId, ©setMemberAddr);
|
||||
if (ret == TopoStatusCode::TOPO_OK) {
|
||||
break;
|
||||
}
|
||||
++retries;
|
||||
} while (retries < maxRetries);
|
||||
|
||||
if (ret != TopoStatusCode::TOPO_OK) {
|
||||
LOG(ERROR) << "GetCopysetMembers failed, poolId = " << it.GetPoolId()
|
||||
<< ", copysetId = " << copySetId;
|
||||
}
|
||||
else {
|
||||
topologyManager_->DeleteAbnormalPartition(it.GetPoolId(), copySetId, it.GetPartitionId(), copysetMemberAddr);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ namespace heartbeat {
|
|||
using curvefs::mds::topology::CopySetIdType;
|
||||
class TopoUpdater {
|
||||
public:
|
||||
explicit TopoUpdater(const std::shared_ptr<Topology> &topo,
|
||||
const std::shared_ptr<TopologyManager> &topologyManager) : topo_(topo), topologyManager_(topologyManager){}
|
||||
explicit TopoUpdater(const std::shared_ptr<Topology> &topo) : topo_(topo) {}
|
||||
~TopoUpdater() {}
|
||||
|
||||
/*
|
||||
|
|
@ -66,7 +65,6 @@ class TopoUpdater {
|
|||
|
||||
private:
|
||||
std::shared_ptr<Topology> topo_;
|
||||
std::shared_ptr<TopologyManager> topologyManager_;
|
||||
};
|
||||
} // namespace heartbeat
|
||||
} // namespace mds
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ void MDS::InitHeartbeatManager() {
|
|||
|
||||
heartbeatOption.mdsStartTime = steady_clock::now();
|
||||
heartbeatManager_ = std::make_shared<HeartbeatManager>(
|
||||
heartbeatOption, topology_, coordinator_, topologyManager_);
|
||||
heartbeatOption, topology_, coordinator_);
|
||||
heartbeatManager_->Init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -765,16 +765,6 @@ TopoStatusCode TopologyManager::DeletePartition(uint32_t partitionId) {
|
|||
return TopoStatusCode::TOPO_OK;
|
||||
}
|
||||
|
||||
void TopologyManager::DeleteAbnormalPartition(uint32_t poolId, uint32_t copysetId, uint32_t partitionId,
|
||||
const std::set<std::string> &addrs){
|
||||
auto fret = metaserverClient_->DeletePartition(poolId, copysetId, partitionId, addrs);
|
||||
if (fret != FSStatusCode::OK) {
|
||||
LOG(ERROR) << "Failed to delete partition. PoolId: " << poolId
|
||||
<< ", CopysetId: " << copysetId
|
||||
<< ", PartitionId: " << partitionId;
|
||||
}
|
||||
}
|
||||
|
||||
void TopologyManager::DeletePartition(const DeletePartitionRequest *request,
|
||||
DeletePartitionResponse *response) {
|
||||
uint32_t partitionId = request->partitionid();
|
||||
|
|
@ -1268,10 +1258,6 @@ void TopologyManager::GetTopology(ListTopologyResponse *response) {
|
|||
ListMetaserverOfCluster(response->mutable_metaservers());
|
||||
}
|
||||
|
||||
std::shared_ptr<MetaserverClient> TopologyManager::GetMetaserverClient(){
|
||||
return metaserverclient_;
|
||||
}
|
||||
|
||||
void TopologyManager::ListZone(ListZoneResponse *response) {
|
||||
response->set_statuscode(TopoStatusCode::TOPO_OK);
|
||||
auto zoneIdVec = topology_->GetZoneInCluster();
|
||||
|
|
|
|||
|
|
@ -109,9 +109,6 @@ class TopologyManager {
|
|||
virtual void CreatePartitions(const CreatePartitionRequest *request,
|
||||
CreatePartitionResponse *response);
|
||||
|
||||
virtual void DeleteAbnormalPartition(uint32_t poolId, uint32_t copysetId, uint32_t partitionId,
|
||||
const std::set<std::string> &addrs);
|
||||
|
||||
virtual void DeletePartition(const DeletePartitionRequest *request,
|
||||
DeletePartitionResponse *response);
|
||||
|
||||
|
|
@ -165,8 +162,6 @@ class TopologyManager {
|
|||
|
||||
virtual void GetTopology(ListTopologyResponse* response);
|
||||
|
||||
virtual std::shared_ptr<MetaserverClient> GetMetaserverClient();
|
||||
|
||||
virtual void ListZone(ListZoneResponse* response);
|
||||
|
||||
virtual void ListServer(ListServerResponse* response);
|
||||
|
|
|
|||
|
|
@ -197,20 +197,12 @@ TEST_F(TestTopoUpdater, test_UpdatePartitionTopo_case4) {
|
|||
|
||||
EXPECT_CALL(*topology_, GetPartition(_, _)).WillOnce(Return(false));
|
||||
|
||||
std::set<std::string> copysetMemberAddr;
|
||||
EXPECT_CALL(*topologyManager_, GetCopysetMembers(_, _, _))
|
||||
.Times(AtMost(3))
|
||||
.WillRepeatedly(DoAll(SetArgPointee<2>(copysetMemberAddr), Return(TopoStatusCode::TOPO_OK)));
|
||||
|
||||
EXPECT_CALL(*topologyManager_, DeleteAbnormalPartition(_, _, _, _)).Times(1);
|
||||
|
||||
std::list<::curvefs::mds::topology::Partition> partitionList;
|
||||
partitionList.push_back(partition);
|
||||
|
||||
updater_->UpdatePartitionTopo(copysetId, partitionList);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(TestTopoUpdater, test_PartitionStatusAvailable) {
|
||||
ASSERT_TRUE(updater_->CanPartitionStatusChange(PartitionStatus::READWRITE,
|
||||
PartitionStatus::READWRITE));
|
||||
|
|
|
|||
Loading…
Reference in New Issue