From 31d16f6cc2693d433939cb0a67325a4117d89ac5 Mon Sep 17 00:00:00 2001 From: Zhou Ting Date: Sat, 30 Dec 2023 15:56:50 +0800 Subject: [PATCH] allow sha256 payload to be configurable for object perf test (#18712) Signed-off-by: Zhou Ting --- cmd/admin-handlers.go | 2 ++ cmd/peer-rest-client.go | 1 + cmd/peer-rest-common.go | 1 + cmd/peer-rest-server.go | 2 ++ cmd/perf-tests.go | 2 +- cmd/speedtest.go | 2 ++ 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index c49bd60b7..c57388873 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1297,6 +1297,7 @@ func (a adminAPIHandlers) ObjectSpeedTestHandler(w http.ResponseWriter, r *http. customBucket := strings.TrimSpace(r.Form.Get(peerRESTBucket)) autotune := r.Form.Get("autotune") == "true" noClear := r.Form.Get("noclear") == "true" + enableSha256 := r.Form.Get("enableSha256") == "true" size, err := strconv.Atoi(sizeStr) if err != nil { @@ -1366,6 +1367,7 @@ func (a adminAPIHandlers) ObjectSpeedTestHandler(w http.ResponseWriter, r *http. autotune: autotune, storageClass: storageClass, bucketName: customBucket, + enableSha256: enableSha256, }) var prevResult madmin.SpeedTestResult for { diff --git a/cmd/peer-rest-client.go b/cmd/peer-rest-client.go index 1b3339142..897aa90f5 100644 --- a/cmd/peer-rest-client.go +++ b/cmd/peer-rest-client.go @@ -921,6 +921,7 @@ func (client *peerRESTClient) SpeedTest(ctx context.Context, opts speedTestOpts) values.Set(peerRESTDuration, opts.duration.String()) values.Set(peerRESTStorageClass, opts.storageClass) values.Set(peerRESTBucket, opts.bucketName) + values.Set(peerRESTEnableSha256, strconv.FormatBool(opts.enableSha256)) respBody, err := client.callWithContext(context.Background(), peerRESTMethodSpeedTest, values, nil, -1) if err != nil { diff --git a/cmd/peer-rest-common.go b/cmd/peer-rest-common.go index cd5b45426..a80b89e7c 100644 --- a/cmd/peer-rest-common.go +++ b/cmd/peer-rest-common.go @@ -100,6 +100,7 @@ const ( peerRESTConcurrent = "concurrent" peerRESTDuration = "duration" peerRESTStorageClass = "storage-class" + peerRESTEnableSha256 = "enableSha256" peerRESTMetricsTypes = "types" peerRESTDisk = "disk" peerRESTHost = "host" diff --git a/cmd/peer-rest-server.go b/cmd/peer-rest-server.go index a77053cfc..1cf5dc4cf 100644 --- a/cmd/peer-rest-server.go +++ b/cmd/peer-rest-server.go @@ -1304,6 +1304,7 @@ func (s *peerRESTServer) SpeedTestHandler(w http.ResponseWriter, r *http.Request concurrentStr := r.Form.Get(peerRESTConcurrent) storageClass := r.Form.Get(peerRESTStorageClass) bucketName := r.Form.Get(peerRESTBucket) + enableSha256 := r.Form.Get(peerRESTEnableSha256) == "true" size, err := strconv.Atoi(sizeStr) if err != nil { @@ -1328,6 +1329,7 @@ func (s *peerRESTServer) SpeedTestHandler(w http.ResponseWriter, r *http.Request duration: duration, storageClass: storageClass, bucketName: bucketName, + enableSha256: enableSha256, }) if err != nil { result.Error = err.Error() diff --git a/cmd/perf-tests.go b/cmd/perf-tests.go index 8452de523..26b335687 100644 --- a/cmd/perf-tests.go +++ b/cmd/perf-tests.go @@ -95,7 +95,7 @@ func selfSpeedTest(ctx context.Context, opts speedTestOpts) (SpeedTestResult, er userMetadata[globalObjectPerfUserMetadata] = "true" // Bypass S3 API freeze popts := minio.PutObjectOptions{ UserMetadata: userMetadata, - DisableContentSha256: true, + DisableContentSha256: !opts.enableSha256, DisableMultipart: true, } diff --git a/cmd/speedtest.go b/cmd/speedtest.go index 71f83c07f..0bbd7af1f 100644 --- a/cmd/speedtest.go +++ b/cmd/speedtest.go @@ -39,6 +39,7 @@ type speedTestOpts struct { autotune bool storageClass string bucketName string + enableSha256 bool } // Get the max throughput and iops numbers. @@ -163,6 +164,7 @@ func objectSpeedTest(ctx context.Context, opts speedTestOpts) chan madmin.SpeedT duration: opts.duration, storageClass: opts.storageClass, bucketName: opts.bucketName, + enableSha256: opts.enableSha256, } results := globalNotificationSys.SpeedTest(ctx, sopts)