diff --git a/cli/cmd/fmt.go b/cli/cmd/fmt.go index 9dd8f0533..54fb0bf0c 100644 --- a/cli/cmd/fmt.go +++ b/cli/cmd/fmt.go @@ -263,15 +263,15 @@ func formatVerInfoTableRow(verInfo *proto.VolVersionInfo) string { } var ( - dataPartitionTablePattern = "%-8v %-8v %-10v %-10v %-18v %-18v" + dataPartitionTablePattern = "%-8v %-8v %-10v %-10v %-10v %-18v %-18v" dataPartitionTableHeader = fmt.Sprintf(dataPartitionTablePattern, - "ID", "REPLICAS", "STATUS", "ISRECOVER", "LEADER", "MEMBERS") + "ID", "REPLICAS", "STATUS", "ISRECOVER", "MEDIA", "LEADER", "MEMBERS") ) func formatDataPartitionTableRow(view *proto.DataPartitionResponse) string { return fmt.Sprintf(dataPartitionTablePattern, - view.PartitionID, view.ReplicaNum, formatDataPartitionStatus(view.Status), view.IsRecover, view.LeaderAddr, - strings.Join(view.Hosts, ",")) + view.PartitionID, view.ReplicaNum, formatDataPartitionStatus(view.Status), view.IsRecover, + proto.MediaTypeString(view.MediaType), view.LeaderAddr, strings.Join(view.Hosts, ",")) } var ( diff --git a/master/data_partition_map.go b/master/data_partition_map.go index 84ecfd33b..062a9b3ee 100644 --- a/master/data_partition_map.go +++ b/master/data_partition_map.go @@ -39,7 +39,7 @@ type DataPartitionMap struct { lastAutoCreateTime time.Time volName string readMutex sync.RWMutex - partitionMapByMediaType map[uint32]map[uint64]struct{} //level-1 key: mediaType, level-2 key: dpId + partitionMapByMediaType map[uint32]map[uint64]struct{} // level-1 key: mediaType, level-2 key: dpId rwCntByMediaType map[uint32]int // readable and writable dp count by mediaType } diff --git a/master/vol.go b/master/vol.go index ba275db21..bb0ae9f49 100644 --- a/master/vol.go +++ b/master/vol.go @@ -651,9 +651,10 @@ func (vol *Vol) checkDataPartitions(c *Cluster) (cnt int) { shouldDpInhibitWriteByVolFull := vol.shouldInhibitWriteBySpaceFull() vol.SetReadOnlyForVolFull(shouldDpInhibitWriteByVolFull) - if vol.Status != proto.VolStatusMarkDelete && proto.IsHot(vol.VolType) && vol.IsReadOnlyForVolFull() { - //check if need create dp for each allowedStorageClass of vol + if vol.Status != proto.VolStatusMarkDelete && proto.IsHot(vol.VolType) && + (time.Now().Unix()-vol.createTime >= defaultIntervalToCheckDataPartition) { for _, asc := range vol.allowedStorageClass { + //check if need create dp for each allowedStorageClass of vol if !proto.IsStorageClassReplica(asc) { continue } @@ -666,6 +667,7 @@ func (vol *Vol) checkDataPartitions(c *Cluster) (cnt int) { c.batchCreateDataPartition(vol, 1, false, mediaType) } } + } totalPreloadCapacity := uint64(0)