Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

cleaner error message

Chris Lu33d5778a4645
diff --git a/weed-fs/src/cmd/weed/volume.go b/weed-fs/src/cmd/weed/volume.go
index 55fbe1f038..2b75c2f75d 100644
--- a/weed-fs/src/cmd/weed/volume.go
+++ b/weed-fs/src/cmd/weed/volume.go
@@ -99,7 +99,9 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
log.Println("read bytes", count, "error", e)
}
if e != nil || count <= 0 {
- log.Println("read error:", e)
+ if *IsDebug {
+ log.Println("read error:", e, r.URL.Path)
+ }
w.WriteHeader(http.StatusNotFound)
return
}
@@ -142,7 +144,6 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
}) {
ret = 0
errorStatus = "Failed to write to replicas for volume " + volumeId.String()
- w.WriteHeader(http.StatusInternalServerError)
}
}
} else {
@@ -152,6 +153,10 @@ func PostHandler(w http.ResponseWriter, r *http.Request) {
if errorStatus == "" {
w.WriteHeader(http.StatusCreated)
} else {
+ store.Delete(volumeId, needle)
+ distributedOperation(volumeId, func(location operation.Location) bool {
+ return nil == operation.Delete("http://"+location.Url+r.URL.Path+"?type=standard")
+ })
w.WriteHeader(http.StatusInternalServerError)
m["error"] = errorStatus
}
diff --git a/weed-fs/src/pkg/storage/volume.go b/weed-fs/src/pkg/storage/volume.go
index c75fa5195a..40b3227878 100644
--- a/weed-fs/src/pkg/storage/volume.go
+++ b/weed-fs/src/pkg/storage/volume.go
@@ -1,11 +1,11 @@
package storage
import (
- "io"
"log"
"os"
"path"
"sync"
+ "errors"
)
const (
@@ -105,5 +105,5 @@ func (v *Volume) read(n *Needle) (int, error) {
v.dataFile.Seek(int64(nv.Offset)*8, 0)
return n.Read(v.dataFile, nv.Size)
}
- return -1, io.EOF
+ return -1, errors.New("Not Found")
}