From 147852cb37f8d021450d8cf701bc6ba204e3135c Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 2 Jan 2025 04:55:34 -0800 Subject: [PATCH] Add go runtime profile type (#5098) Available on AIStor. Requires https://github.com/minio/madmin-go/pull/322 Lower minimum duration to 1 second. Useful (pretty much required) for traces. --- cmd/admin-service-restart.go | 1 + cmd/admin-service-unfreeze.go | 4 ++-- cmd/client-fs_windows.go | 2 +- cmd/support-profile.go | 8 +++++--- go.mod | 2 +- go.sum | 4 ++-- pkg/disk/stat_windows.go | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cmd/admin-service-restart.go b/cmd/admin-service-restart.go index cf82bd1b43..b857f03824 100644 --- a/cmd/admin-service-restart.go +++ b/cmd/admin-service-restart.go @@ -269,6 +269,7 @@ func mainAdminServiceRestart(ctx *cli.Context) error { }) if e != nil { // Attempt an older API server might be old + //nolint:staticcheck e = client.ServiceRestart(ctxt) } fatalIf(probe.NewError(e), "Unable to restart the server.") diff --git a/cmd/admin-service-unfreeze.go b/cmd/admin-service-unfreeze.go index cf45a359db..3bb5550ee8 100644 --- a/cmd/admin-service-unfreeze.go +++ b/cmd/admin-service-unfreeze.go @@ -74,7 +74,7 @@ func checkAdminServiceUnfreezeSyntax(ctx *cli.Context) { } func mainAdminServiceUnfreeze(ctx *cli.Context) error { - // Validate serivce unfreeze syntax. + // Validate service unfreeze syntax. checkAdminServiceUnfreezeSyntax(ctx) // Set color. @@ -89,7 +89,7 @@ func mainAdminServiceUnfreeze(ctx *cli.Context) error { fatalIf(err, "Unable to initialize admin connection.") // Unfreeze the specified MinIO server - fatalIf(probe.NewError(client.ServiceUnfreeze(globalContext)), "Unable to unfreeze the server.") + fatalIf(probe.NewError(client.ServiceUnfreezeV2(globalContext)), "Unable to unfreeze the server.") // Success.. printMsg(serviceUnfreezeCommand{Status: "success", ServerURL: aliasedURL}) diff --git a/cmd/client-fs_windows.go b/cmd/client-fs_windows.go index 121f36a13f..73a35be43a 100644 --- a/cmd/client-fs_windows.go +++ b/cmd/client-fs_windows.go @@ -56,6 +56,6 @@ func IsDeleteEvent(event notify.Event) bool { // getAllXattrs returns the extended attributes for a file if supported // by the OS -func getAllXattrs(path string) (map[string]string, error) { +func getAllXattrs(_ string) (map[string]string, error) { return nil, nil } diff --git a/cmd/support-profile.go b/cmd/support-profile.go index 612bed0b68..3cd39db9fd 100644 --- a/cmd/support-profile.go +++ b/cmd/support-profile.go @@ -119,7 +119,9 @@ func checkAdminProfileSyntax(ctx *cli.Context) { string(madmin.ProfilerTrace), string(madmin.ProfilerThreads), string(madmin.ProfilerGoroutines), - string(madmin.ProfilerCPUIO)) + string(madmin.ProfilerCPUIO), + string(madmin.ProfilerRuntime), + ) // Check if the provided profiler type is known and supported profilers := strings.Split(strings.ToLower(ctx.String("type")), ",") for _, profiler := range profilers { @@ -134,8 +136,8 @@ func checkAdminProfileSyntax(ctx *cli.Context) { showCommandHelpAndExit(ctx, 1) // last argument is exit code } - if ctx.Int("duration") < 10 { - fatal(errDummy().Trace(), "for any useful profiling one must run it for atleast 10 seconds") + if ctx.Int("duration") < 1 { + fatal(errDummy().Trace(), "for any useful profiling one must run it for at least 1 second") } } diff --git a/go.mod b/go.mod index 521caf21c8..4d0e0de4df 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/minio/cli v1.24.2 github.com/minio/colorjson v1.0.8 github.com/minio/filepath v1.0.0 - github.com/minio/madmin-go/v3 v3.0.78 + github.com/minio/madmin-go/v3 v3.0.82-0.20241219154017-7a6a137d7ed6 github.com/minio/minio-go/v7 v7.0.82 github.com/minio/pkg/v3 v3.0.23 github.com/minio/selfupdate v0.6.0 diff --git a/go.sum b/go.sum index 1fc4ceaba2..6aebd4fb1e 100644 --- a/go.sum +++ b/go.sum @@ -141,8 +141,8 @@ github.com/minio/colorjson v1.0.8 h1:AS6gEQ1dTRYHmC4xuoodPDRILHP/9Wz5wYUGDQfPLpg github.com/minio/colorjson v1.0.8/go.mod h1:wrs39G/4kqNlGjwqHvPlAnXuc2tlPszo6JKdSBCLN8w= github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY= github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw= -github.com/minio/madmin-go/v3 v3.0.78 h1:JHUZU8akWSu8UF+mIBpsOSLtOG9b4ZTZVz3TShLbYn4= -github.com/minio/madmin-go/v3 v3.0.78/go.mod h1:IZOL4lEMiJ4QN2iWQjkOIIthcVuNYU7ENF7RkyxlzKY= +github.com/minio/madmin-go/v3 v3.0.82-0.20241219154017-7a6a137d7ed6 h1:ftB3HcXyqxWWN+WoqSSy5K+4muzvq+aMtdtu9zMLyCg= +github.com/minio/madmin-go/v3 v3.0.82-0.20241219154017-7a6a137d7ed6/go.mod h1:QAZPX3xx4gdZbZ8t85SieFSwXMOQhFx7bVjldhyc6Bk= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.82 h1:tWfICLhmp2aFPXL8Tli0XDTHj2VB/fNf0PC1f/i1gRo= diff --git a/pkg/disk/stat_windows.go b/pkg/disk/stat_windows.go index 311f7553ec..aa0cfdca4e 100644 --- a/pkg/disk/stat_windows.go +++ b/pkg/disk/stat_windows.go @@ -22,6 +22,6 @@ package disk // GetFileSystemAttrs return the file system attribute as string; containing mode, // uid, gid, uname, Gname, atime, mtime, ctime and md5 -func GetFileSystemAttrs(file string) (string, error) { +func GetFileSystemAttrs(_ string) (string, error) { return "", nil }