fix(master): avoid split during volume creation

Signed-off-by: tangdeyi <tangdeyi@oppo.com>
This commit is contained in:
tangdeyi 2023-10-19 19:01:46 +08:00 committed by tangdeyi
parent 41f2dc7a2b
commit 1fba8dbee3

View File

@ -439,6 +439,8 @@ func (vol *Vol) getRWMetaPartitionNum() (num uint64, isHeartBeatDone bool) {
}
if mp.Status == proto.ReadWrite {
num++
} else {
log.LogWarnf("The mp[%v] of vol[%v] is not RW", mp.PartitionID, vol.Name)
}
}
return num, true
@ -664,6 +666,11 @@ func (vol *Vol) checkMetaPartitions(c *Cluster) {
tasks = append(tasks, mp.replicaCreationTasks(c.Name, vol.Name)...)
}
c.addMetaNodeTasks(tasks)
// avoid split during volume creation
if len(mps) < defaultReplicaNum {
log.LogDebugf("The vol[%v] is being created", vol.Name)
return
}
vol.checkSplitMetaPartition(c, metaPartitionInodeIdStep)
}