mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add descriptive error if no free volumes
This commit is contained in:
parent
776f497469
commit
73958e357d
|
@ -77,7 +77,7 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
|
||||||
|
|
||||||
if !ms.Topo.HasWritableVolume(option) {
|
if !ms.Topo.HasWritableVolume(option) {
|
||||||
if ms.Topo.AvailableSpaceFor(option) <= 0 {
|
if ms.Topo.AvailableSpaceFor(option) <= 0 {
|
||||||
return nil, fmt.Errorf("No free volumes left!")
|
return nil, fmt.Errorf("no free volumes left for "+option.String())
|
||||||
}
|
}
|
||||||
ms.vgLock.Lock()
|
ms.vgLock.Lock()
|
||||||
if !ms.Topo.HasWritableVolume(option) {
|
if !ms.Topo.HasWritableVolume(option) {
|
||||||
|
|
|
@ -113,7 +113,7 @@ func (ms *MasterServer) dirAssignHandler(w http.ResponseWriter, r *http.Request)
|
||||||
|
|
||||||
if !ms.Topo.HasWritableVolume(option) {
|
if !ms.Topo.HasWritableVolume(option) {
|
||||||
if ms.Topo.AvailableSpaceFor(option) <= 0 {
|
if ms.Topo.AvailableSpaceFor(option) <= 0 {
|
||||||
writeJsonQuiet(w, r, http.StatusNotFound, operation.AssignResult{Error: "No free volumes left!"})
|
writeJsonQuiet(w, r, http.StatusNotFound, operation.AssignResult{Error: "No free volumes left for " + option.String()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ms.vgLock.Lock()
|
ms.vgLock.Lock()
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ReplicaPlacement struct {
|
type ReplicaPlacement struct {
|
||||||
SameRackCount int
|
SameRackCount int `json:"node,omitempty"`
|
||||||
DiffRackCount int
|
DiffRackCount int `json:"rack,omitempty"`
|
||||||
DiffDataCenterCount int
|
DiffDataCenterCount int `json:"dc,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) {
|
func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package topology
|
package topology
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
@ -25,15 +26,15 @@ This package is created to resolve these replica placement issues:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type VolumeGrowOption struct {
|
type VolumeGrowOption struct {
|
||||||
Collection string
|
Collection string `json:"collection,omitempty"`
|
||||||
ReplicaPlacement *super_block.ReplicaPlacement
|
ReplicaPlacement *super_block.ReplicaPlacement `json:"replication,omitempty"`
|
||||||
Ttl *needle.TTL
|
Ttl *needle.TTL `json:"ttl,omitempty"`
|
||||||
DiskType types.DiskType
|
DiskType types.DiskType `json:"disk,omitempty"`
|
||||||
Prealloacte int64
|
Prealloacte int64 `json:"prealloacte,omitempty"`
|
||||||
DataCenter string
|
DataCenter string `json:"dataCenter,omitempty"`
|
||||||
Rack string
|
Rack string `json:"rack,omitempty"`
|
||||||
DataNode string
|
DataNode string `json:"dataNode,omitempty"`
|
||||||
MemoryMapMaxSizeMb uint32
|
MemoryMapMaxSizeMb uint32 `json:"memoryMapMaxSizeMb,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VolumeGrowth struct {
|
type VolumeGrowth struct {
|
||||||
|
@ -41,7 +42,8 @@ type VolumeGrowth struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *VolumeGrowOption) String() string {
|
func (o *VolumeGrowOption) String() string {
|
||||||
return fmt.Sprintf("Collection:%s, ReplicaPlacement:%v, Ttl:%v, DataCenter:%s, Rack:%s, DataNode:%s", o.Collection, o.ReplicaPlacement, o.Ttl, o.DataCenter, o.Rack, o.DataNode)
|
blob, _ := json.Marshal(o)
|
||||||
|
return string(blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDefaultVolumeGrowth() *VolumeGrowth {
|
func NewDefaultVolumeGrowth() *VolumeGrowth {
|
||||||
|
|
Loading…
Reference in a new issue