From a6d421508a39802cc1a91bed56f01180214d5e79 Mon Sep 17 00:00:00 2001 From: bingoohuang Date: Sat, 20 Feb 2021 16:57:07 +0800 Subject: [PATCH] revert ErrXyz to ErrorXyz temporarily. --- weed/server/volume_server_handlers_read.go | 2 +- weed/storage/store_ec.go | 4 ++-- weed/storage/volume_checking.go | 4 ++-- weed/storage/volume_read_write.go | 12 ++++++------ weed/util/chunk_cache/chunk_cache_on_disk.go | 2 +- weed/util/chunk_cache/on_disk_cache_layer.go | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index 9604e7fe8..2db46ac9b 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/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 } diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go index 55b9a6fc6..a9b6a8ff3 100644 --- a/weed/storage/store_ec.go +++ b/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) diff --git a/weed/storage/volume_checking.go b/weed/storage/volume_checking.go index f6e75a07c..b76933083 100644 --- a/weed/storage/volume_checking.go +++ b/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) diff --git a/weed/storage/volume_read_write.go b/weed/storage/volume_read_write.go index 7076e198b..cbad4529b 100644 --- a/weed/storage/volume_read_write.go +++ b/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() { diff --git a/weed/util/chunk_cache/chunk_cache_on_disk.go b/weed/util/chunk_cache/chunk_cache_on_disk.go index c9f7356d6..d724e925e 100644 --- a/weed/util/chunk_cache/chunk_cache_on_disk.go +++ b/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 { diff --git a/weed/util/chunk_cache/on_disk_cache_layer.go b/weed/util/chunk_cache/on_disk_cache_layer.go index 2e8f998f7..eebd89798 100644 --- a/weed/util/chunk_cache/on_disk_cache_layer.go +++ b/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 {