Browse Source

show error if backend is mis-configured

related to https://github.com/seaweedfs/seaweedfs/discussions/6472
pull/6475/head
chrislu 1 month ago
parent
commit
be15fee8e7
  1. 4
      weed/storage/volume_loading.go
  2. 6
      weed/storage/volume_tier.go

4
weed/storage/volume_loading.go

@ -52,7 +52,9 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
v.noWriteCanDelete = true v.noWriteCanDelete = true
v.noWriteOrDelete = false v.noWriteOrDelete = false
glog.V(0).Infof("loading volume %d from remote %v", v.Id, v.volumeInfo) glog.V(0).Infof("loading volume %d from remote %v", v.Id, v.volumeInfo)
v.LoadRemoteFile()
if err := v.LoadRemoteFile(); err != nil {
return fmt.Errorf("load remote file %v: %v", v.volumeInfo, err)
}
alreadyHasSuperBlock = true alreadyHasSuperBlock = true
} else if exists, canRead, canWrite, modifiedTime, fileSize := util.CheckFile(v.FileName(".dat")); exists { } else if exists, canRead, canWrite, modifiedTime, fileSize := util.CheckFile(v.FileName(".dat")); exists {
// open dat file // open dat file

6
weed/storage/volume_tier.go

@ -1,6 +1,7 @@
package storage package storage
import ( import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
"github.com/seaweedfs/seaweedfs/weed/storage/backend" "github.com/seaweedfs/seaweedfs/weed/storage/backend"
@ -60,7 +61,10 @@ func (v *Volume) HasRemoteFile() bool {
func (v *Volume) LoadRemoteFile() error { func (v *Volume) LoadRemoteFile() error {
tierFile := v.volumeInfo.GetFiles()[0] tierFile := v.volumeInfo.GetFiles()[0]
backendStorage := backend.BackendStorages[tierFile.BackendName()]
backendStorage, found := backend.BackendStorages[tierFile.BackendName()]
if !found {
return fmt.Errorf("backend storage %s not found", tierFile.BackendName())
}
if v.DataBackend != nil { if v.DataBackend != nil {
v.DataBackend.Close() v.DataBackend.Close()

Loading…
Cancel
Save