mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 15:57:24 +08:00
master api: return http 404 when volumeId not exist
Signed-off-by: Lei Liu <lei01.liu@horizon.ai>
This commit is contained in:
@@ -275,7 +275,7 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
isRecursive := r.FormValue("recursive") == "true"
|
||||
ignoreRecursiveError := r.FormValue("ignoreRecursiveError") == "true"
|
||||
|
||||
err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError,true)
|
||||
err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, true)
|
||||
if err != nil {
|
||||
glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error())
|
||||
writeJsonError(w, r, http.StatusInternalServerError, err)
|
||||
|
@@ -48,7 +48,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request)
|
||||
collection := r.FormValue("collection") //optional, but can be faster if too many collections
|
||||
location := ms.findVolumeLocation(collection, vid)
|
||||
httpStatus := http.StatusOK
|
||||
if location.Error != "" {
|
||||
if location.Error != "" || location.Locations == nil {
|
||||
httpStatus = http.StatusNotFound
|
||||
} else {
|
||||
forRead := r.FormValue("read")
|
||||
@@ -60,7 +60,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
// findVolumeLocation finds the volume location from master topo if it is leader,
|
||||
// or from master client if not leader
|
||||
func (ms *MasterServer) findVolumeLocation(collection string, vid string) operation.LookupResult {
|
||||
func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.LookupResult {
|
||||
var locations []operation.Location
|
||||
var err error
|
||||
if ms.Topo.IsLeader() {
|
||||
|
@@ -98,7 +98,7 @@ func writeDataNodeInfo(writer io.Writer, t *master_pb.DataNodeInfo) statistics {
|
||||
}
|
||||
func writeVolumeInformationMessage(writer io.Writer, t *master_pb.VolumeInformationMessage) statistics {
|
||||
fmt.Fprintf(writer, " volume %+v \n", t)
|
||||
return newStatiscis(t)
|
||||
return newStatistics(t)
|
||||
}
|
||||
|
||||
type statistics struct {
|
||||
@@ -108,7 +108,7 @@ type statistics struct {
|
||||
DeletedBytes uint64
|
||||
}
|
||||
|
||||
func newStatiscis(t *master_pb.VolumeInformationMessage) statistics {
|
||||
func newStatistics(t *master_pb.VolumeInformationMessage) statistics {
|
||||
return statistics{
|
||||
Size: t.Size,
|
||||
FileCount: t.FileCount,
|
||||
|
Reference in New Issue
Block a user