mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 22:46:16 +03:00
profiler: Download API returns error when all nodes fail (#6525)
When download profiling data API fails to gather profiling data from all nodes for any reason (including profiler not enabled), return 400 http code with the appropriate json message.
This commit is contained in:
@@ -355,8 +355,7 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
||||
return
|
||||
}
|
||||
|
||||
// Return 200 OK
|
||||
w.WriteHeader(http.StatusOK)
|
||||
profilingDataFound := false
|
||||
|
||||
// Initialize a zip writer which will provide a zipped content
|
||||
// of profiling data of all nodes
|
||||
@@ -371,6 +370,8 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
||||
continue
|
||||
}
|
||||
|
||||
profilingDataFound = true
|
||||
|
||||
// Send profiling data to zip as file
|
||||
header, err := zip.FileInfoHeader(dummyFileInfo{
|
||||
name: fmt.Sprintf("profiling-%d", i),
|
||||
@@ -391,6 +392,11 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if !profilingDataFound {
|
||||
writeErrorResponseJSON(w, ErrAdminProfilerNotEnabled, r.URL)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// extractHealInitParams - Validates params for heal init API.
|
||||
|
||||
Reference in New Issue
Block a user