Browse Source

revert ErrXyz to ErrorXyz temporarily.

pull/1823/head
bingoohuang 4 years ago
parent
commit
a6d421508a
  1. 2
      weed/server/volume_server_handlers_read.go
  2. 4
      weed/storage/store_ec.go
  3. 4
      weed/storage/volume_checking.go
  4. 12
      weed/storage/volume_read_write.go
  5. 2
      weed/util/chunk_cache/chunk_cache_on_disk.go
  6. 2
      weed/util/chunk_cache/on_disk_cache_layer.go

2
weed/server/volume_server_handlers_read.go

@ -93,7 +93,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
} else if hasEcVolume {
count, err = vs.store.ReadEcShardNeedle(volumeId, n)
}
if err != nil && err != storage.ErrDeleted && r.FormValue("type") != "replicate" && hasVolume {
if err != nil && err != storage.ErrorDeleted && r.FormValue("type") != "replicate" && hasVolume {
glog.V(4).Infof("read needle: %v", err)
// start to fix it from other replicas, if not deleted and hasVolume and is not a replicated request
}

4
weed/storage/store_ec.go

@ -130,7 +130,7 @@ func (s *Store) ReadEcShardNeedle(vid needle.VolumeId, n *needle.Needle) (int, e
return 0, fmt.Errorf("locate in local ec volume: %v", err)
}
if size.IsDeleted() {
return 0, ErrDeleted
return 0, ErrorDeleted
}
glog.V(3).Infof("read ec volume %d offset %d size %d intervals:%+v", vid, offset.ToActualOffset(), size, intervals)
@ -143,7 +143,7 @@ func (s *Store) ReadEcShardNeedle(vid needle.VolumeId, n *needle.Needle) (int, e
return 0, fmt.Errorf("ReadEcShardIntervals: %v", err)
}
if isDeleted {
return 0, ErrDeleted
return 0, ErrorDeleted
}
err = n.ReadBytes(bytes, offset.ToActualOffset(), size, localEcVolume.Version)

4
weed/storage/volume_checking.go

@ -30,7 +30,7 @@ func CheckAndFixVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAt
healthyIndexSize = indexSize - int64(i)*NeedleMapEntrySize
continue
}
if err != ErrSizeMismatch {
if err != ErrorSizeMismatch {
break
}
}
@ -94,7 +94,7 @@ func verifyNeedleIntegrity(datFile backend.BackendStorageFile, v needle.Version,
return 0, fmt.Errorf("read %s at %d", datFile.Name(), offset)
}
if n.Size != size {
return 0, ErrSizeMismatch
return 0, ErrorSizeMismatch
}
if v == needle.Version3 {
bytes := make([]byte, TimestampSize)

12
weed/storage/volume_read_write.go

@ -15,9 +15,9 @@ import (
. "github.com/chrislusf/seaweedfs/weed/storage/types"
)
var ErrNotFound = errors.New("not found")
var ErrDeleted = errors.New("already deleted")
var ErrSizeMismatch = errors.New("size mismatch")
var ErrorNotFound = errors.New("not found")
var ErrorDeleted = errors.New("already deleted")
var ErrorSizeMismatch = errors.New("size mismatch")
func (v *Volume) checkReadWriteError(err error) {
if err == nil {
@ -289,7 +289,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro
nv, ok := v.nm.Get(n.Id)
if !ok || nv.Offset.IsZero() {
return -1, ErrNotFound
return -1, ErrorNotFound
}
readSize := nv.Size
if readSize.IsDeleted() {
@ -297,7 +297,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro
glog.V(3).Infof("reading deleted %s", n.String())
readSize = -readSize
} else {
return -1, ErrDeleted
return -1, ErrorDeleted
}
}
if readSize == 0 {
@ -327,7 +327,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro
if time.Now().Before(time.Unix(0, int64(n.AppendAtNs)).Add(time.Duration(ttlMinutes) * time.Minute)) {
return bytesRead, nil
}
return -1, ErrNotFound
return -1, ErrorNotFound
}
func (v *Volume) startWorker() {

2
weed/util/chunk_cache/chunk_cache_on_disk.go

@ -104,7 +104,7 @@ func (v *ChunkCacheVolume) GetNeedle(key types.NeedleId) ([]byte, error) {
nv, ok := v.nm.Get(key)
if !ok {
return nil, storage.ErrNotFound
return nil, storage.ErrorNotFound
}
data := make([]byte, nv.Size)
if readSize, readErr := v.DataBackend.ReadAt(data, nv.Offset.ToActualOffset()); readErr != nil {

2
weed/util/chunk_cache/on_disk_cache_layer.go

@ -66,7 +66,7 @@ func (c *OnDiskCacheLayer) getChunk(needleId types.NeedleId) (data []byte) {
for _, diskCache := range c.diskCaches {
data, err = diskCache.GetNeedle(needleId)
if err == storage.ErrNotFound {
if err == storage.ErrorNotFound {
continue
}
if err != nil {

Loading…
Cancel
Save