From e7b3f390647dcffaa603557a7a17a3baddcd1e49 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 12 Sep 2019 21:08:02 +0100 Subject: [PATCH] xl: Fix verifying non streaming highway algo with a dist setup (#8230) VerifyFile in the distributed setup does not work with the non streaming highway hash. The reason is that the internode mux router did not expect `storageRESTBitrotHash` parameter. --- cmd/storage-rest-client.go | 5 ++--- cmd/storage-rest-server.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/storage-rest-client.go b/cmd/storage-rest-client.go index 8dea09da8..43da7c4f0 100644 --- a/cmd/storage-rest-client.go +++ b/cmd/storage-rest-client.go @@ -446,9 +446,8 @@ func (client *storageRESTClient) VerifyFile(volume, path string, size int64, alg values.Set(storageRESTBitrotAlgo, algo.String()) values.Set(storageRESTLength, strconv.FormatInt(size, 10)) values.Set(storageRESTShardSize, strconv.Itoa(int(shardSize))) - if len(sum) != 0 { - values.Set(storageRESTBitrotHash, hex.EncodeToString(sum)) - } + values.Set(storageRESTBitrotHash, hex.EncodeToString(sum)) + respBody, err := client.call(storageRESTMethodVerifyFile, values, nil, -1) defer http.DrainBody(respBody) if err != nil { diff --git a/cmd/storage-rest-server.go b/cmd/storage-rest-server.go index 0180fc455..085d73fbe 100644 --- a/cmd/storage-rest-server.go +++ b/cmd/storage-rest-server.go @@ -600,7 +600,7 @@ func registerStorageRESTHandlers(router *mux.Router, endpoints EndpointList) { subrouter.Methods(http.MethodPost).Path(SlashSeparator + storageRESTMethodRenameFile).HandlerFunc(httpTraceHdrs(server.RenameFileHandler)). Queries(restQueries(storageRESTSrcVolume, storageRESTSrcPath, storageRESTDstVolume, storageRESTDstPath)...) subrouter.Methods(http.MethodPost).Path(SlashSeparator + storageRESTMethodVerifyFile).HandlerFunc(httpTraceHdrs(server.VerifyFile)). - Queries(restQueries(storageRESTVolume, storageRESTFilePath, storageRESTBitrotAlgo, storageRESTLength, storageRESTShardSize)...) + Queries(restQueries(storageRESTVolume, storageRESTFilePath, storageRESTBitrotAlgo, storageRESTBitrotHash, storageRESTLength, storageRESTShardSize)...) subrouter.Methods(http.MethodPost).Path(SlashSeparator + storageRESTMethodGetInstanceID).HandlerFunc(httpTraceAll(server.GetInstanceID)) }