Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package minio-client for openSUSE:Factory checked in at 2024-01-22 20:32:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/minio-client (Old) and /work/SRC/openSUSE:Factory/.minio-client.new.16006 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "minio-client" Mon Jan 22 20:32:36 2024 rev:66 rq:1140179 version:20240118T070339Z Changes: -------- --- /work/SRC/openSUSE:Factory/minio-client/minio-client.changes 2024-01-17 22:19:33.376379783 +0100 +++ /work/SRC/openSUSE:Factory/.minio-client.new.16006/minio-client.changes 2024-01-22 20:33:03.690669832 +0100 @@ -1,0 +2,7 @@ +Sat Jan 20 17:09:30 UTC 2024 - opensuse_buildserv...@ojkastl.de + +- Update to version 20240118T070339Z: + * feat: add action for mc undo recursive (#4822) + * Add ability to replay JSON file in scanner info (#4824) + +------------------------------------------------------------------- Old: ---- mc-20240116T160634Z.obscpio New: ---- mc-20240118T070339Z.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ minio-client.spec ++++++ --- /var/tmp/diff_new_pack.0aK9VB/_old 2024-01-22 20:33:04.506699634 +0100 +++ /var/tmp/diff_new_pack.0aK9VB/_new 2024-01-22 20:33:04.506699634 +0100 @@ -22,7 +22,7 @@ %define binary_name minio-client Name: minio-client -Version: 20240116T160634Z +Version: 20240118T070339Z Release: 0 Summary: Client for MinIO License: AGPL-3.0-only ++++++ _service ++++++ --- /var/tmp/diff_new_pack.0aK9VB/_old 2024-01-22 20:33:04.534700657 +0100 +++ /var/tmp/diff_new_pack.0aK9VB/_new 2024-01-22 20:33:04.538700803 +0100 @@ -5,7 +5,7 @@ <param name="exclude">.git</param> <param name="changesgenerate">enable</param> <param name="versionformat">@PARENT_TAG@</param> - <param name="revision">RELEASE.2024-01-16T16-06-34Z</param> + <param name="revision">RELEASE.2024-01-18T07-03-39Z</param> <param name="match-tag">RELEASE.*</param> <param name="versionrewrite-pattern">RELEASE\.(.*)-(.*)-(.*)-(.*)-(.*)</param> <param name="versionrewrite-replacement">\1\2\3\4\5</param> @@ -19,7 +19,7 @@ <param name="compression">gz</param> </service> <service name="go_modules" mode="manual"> - <param name="archive">mc-20240116T160634Z.obscpio</param> + <param name="archive">mc-20240118T070339Z.obscpio</param> </service> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.0aK9VB/_old 2024-01-22 20:33:04.558701533 +0100 +++ /var/tmp/diff_new_pack.0aK9VB/_new 2024-01-22 20:33:04.562701680 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/minio/mc</param> - <param name="changesrevision">7484802005d75b2f078be373afbbd44106f8cc4b</param></service></servicedata> + <param name="changesrevision">bb25267eaadc0e025243b443a94ff33bde6302ad</param></service></servicedata> (No newline at EOF) ++++++ mc-20240116T160634Z.obscpio -> mc-20240118T070339Z.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mc-20240116T160634Z/cmd/admin-scanner-status.go new/mc-20240118T070339Z/cmd/admin-scanner-status.go --- old/mc-20240116T160634Z/cmd/admin-scanner-status.go 2024-01-16 17:06:34.000000000 +0100 +++ new/mc-20240118T070339Z/cmd/admin-scanner-status.go 2024-01-18 08:03:39.000000000 +0100 @@ -18,10 +18,13 @@ package cmd import ( + "bufio" "bytes" "context" "errors" "fmt" + "io" + "os" "sort" "strings" "time" @@ -58,6 +61,11 @@ Usage: "maximum number of active paths to show. -1 for unlimited", Value: -1, }, + cli.StringFlag{ + Name: "in", + Hidden: true, + Usage: "read previously saved json from file and replay", + }, } var adminScannerInfo = cli.Command{ @@ -87,6 +95,9 @@ // checkAdminTopAPISyntax - validate all the passed arguments func checkAdminScannerInfoSyntax(ctx *cli.Context) { + if ctx.String("in") != "" { + return + } if len(ctx.Args()) == 0 || len(ctx.Args()) > 1 { showCommandHelpAndExit(ctx, 1) // last argument is exit code } @@ -97,13 +108,49 @@ aliasedURL := ctx.Args().Get(0) + ui := tea.NewProgram(initScannerMetricsUI(ctx.Int("max-paths"))) + ctxt, cancel := context.WithCancel(globalContext) + defer cancel() + + // Replay from file + if inFile := ctx.String("in"); inFile != "" { + go func() { + if _, e := ui.Run(); e != nil { + cancel() + fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to fetch scanner metrics") + } + }() + f, e := os.Open(inFile) + fatalIf(probe.NewError(e).Trace(aliasedURL), "Unable to open input") + sc := bufio.NewReader(f) + var lastTime time.Time + for { + b, e := sc.ReadBytes('\n') + if e == io.EOF { + break + } + var metrics madmin.RealtimeMetrics + e = json.Unmarshal(b, &metrics) + if e != nil || metrics.Aggregated.Scanner == nil { + continue + } + delay := metrics.Aggregated.Scanner.CollectedAt.Sub(lastTime) + if !lastTime.IsZero() && delay > 0 { + if delay > 3*time.Second { + delay = 3 * time.Second + } + time.Sleep(delay) + } + ui.Send(metrics) + lastTime = metrics.Aggregated.Scanner.CollectedAt + } + os.Exit(0) + } + // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) fatalIf(err.Trace(aliasedURL), "Unable to initialize admin client.") - ctxt, cancel := context.WithCancel(globalContext) - defer cancel() - opts := madmin.MetricsOptions{ Type: madmin.MetricsScanner, N: ctx.Int("n"), @@ -111,7 +158,6 @@ Hosts: strings.Split(ctx.String("nodes"), ","), ByHost: false, } - ui := tea.NewProgram(initScannerMetricsUI(ctx.Int("max-paths"))) if globalJSON { e := client.Metrics(ctxt, opts, func(metrics madmin.RealtimeMetrics) { printMsg(metricsMessage{RealtimeMetrics: metrics}) @@ -285,10 +331,10 @@ } if sc.CurrentCycle > 0 { addRowF(title("Current cycle:")+" %s; Started: %v", ui(sc.CurrentCycle), console.Colorize("metrics-date", sc.CurrentStarted)) - addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) + addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) } else { addRowF(title("Current cycle:") + " (between cycles)") - addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) + addRowF(title("Active drives:")+" %s", ui(uint64(len(sc.ActivePaths)))) } getRate := func(x madmin.TimedAction) string { if x.AccTime > 0 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mc-20240116T160634Z/cmd/undo-main.go new/mc-20240118T070339Z/cmd/undo-main.go --- old/mc-20240116T160634Z/cmd/undo-main.go 2024-01-16 17:06:34.000000000 +0100 +++ new/mc-20240118T070339Z/cmd/undo-main.go 2024-01-18 08:03:39.000000000 +0100 @@ -31,6 +31,11 @@ "github.com/minio/pkg/v2/console" ) +const ( + actionPut = "PUT" + actionDelete = "DELETE" +) + var undoFlags = []cli.Flag{ cli.IntFlag{ Name: "last", @@ -49,6 +54,10 @@ Name: "dry-run", Usage: "fake an undo operation", }, + cli.StringFlag{ + Name: "action", + Usage: "undo only if the latest version is of the following type [PUT/DELETE]", + }, } var undoCmd = cli.Command{ @@ -109,7 +118,7 @@ } // parseUndoSyntax performs command-line input validation for cat command. -func parseUndoSyntax(ctx *cli.Context) (targetAliasedURL string, last int, recursive, dryRun bool) { +func parseUndoSyntax(ctx *cli.Context) (targetAliasedURL string, last int, recursive, dryRun bool, action string) { targetAliasedURL = ctx.Args().Get(0) if targetAliasedURL == "" { fatalIf(errInvalidArgument().Trace(), "The argument should not be empty") @@ -127,6 +136,13 @@ } dryRun = ctx.Bool("dry-run") + action = strings.ToUpper(ctx.String("action")) + if action != actionPut && action != actionDelete && action != "" { + fatalIf(errInvalidArgument().Trace(), "unsupported action specified, supported actions are PUT, DELETE or empty (default)") + } + if (action == actionPut || action == actionDelete) && last != 1 { + fatalIf(errInvalidArgument().Trace(), "--action if specified requires that you must specify --last=1") + } return } @@ -184,7 +200,7 @@ return } -func undoURL(ctx context.Context, aliasedURL string, last int, recursive, dryRun bool) (exitErr error) { +func undoURL(ctx context.Context, aliasedURL string, last int, recursive, dryRun bool, action string) (exitErr error) { clnt, err := newClient(aliasedURL) fatalIf(err.Trace(aliasedURL), "Unable to initialize target `"+aliasedURL+"`.") @@ -195,7 +211,7 @@ perObjectVersions []*ClientContent atLeastOneUndoApplied bool ) - + remove := true for content := range clnt.List(ctx, ListOptions{ Recursive: recursive, WithOlderVersions: true, @@ -215,20 +231,28 @@ break } } - if lastObjectPath != content.URL.Path { // Print any object in the current list before reinitializing it - exitErr = undoLastNOperations(ctx, clnt, perObjectVersions, last, dryRun) + if remove { + exitErr = undoLastNOperations(ctx, clnt, perObjectVersions, last, dryRun) + } + remove = true lastObjectPath = content.URL.Path perObjectVersions = []*ClientContent{} } - + if !remove { + continue + } + if (content.IsLatest && action == actionDelete && !content.IsDeleteMarker) || (content.IsLatest && action == actionPut && content.IsDeleteMarker) { + remove = false + continue + } perObjectVersions = append(perObjectVersions, content) atLeastOneUndoApplied = true } // Undo the remaining versions found if any - if len(perObjectVersions) > 0 { + if len(perObjectVersions) > 0 && remove { exitErr = undoLastNOperations(ctx, clnt, perObjectVersions, last, dryRun) } @@ -274,11 +298,11 @@ console.SetColor("Success", color.New(color.FgGreen, color.Bold)) // check 'undo' cli arguments. - targetAliasedURL, last, recursive, dryRun := parseUndoSyntax(cliCtx) + targetAliasedURL, last, recursive, dryRun, action := parseUndoSyntax(cliCtx) if !checkIfBucketIsVersioned(ctx, targetAliasedURL) { fatalIf(errDummy().Trace(), "Undo command works only with S3 versioned-enabled buckets.") } - return undoURL(ctx, targetAliasedURL, last, recursive, dryRun) + return undoURL(ctx, targetAliasedURL, last, recursive, dryRun, action) } ++++++ mc.obsinfo ++++++ --- /var/tmp/diff_new_pack.0aK9VB/_old 2024-01-22 20:33:04.862712637 +0100 +++ /var/tmp/diff_new_pack.0aK9VB/_new 2024-01-22 20:33:04.862712637 +0100 @@ -1,5 +1,5 @@ name: mc -version: 20240116T160634Z -mtime: 1705421194 -commit: 7484802005d75b2f078be373afbbd44106f8cc4b +version: 20240118T070339Z +mtime: 1705561419 +commit: bb25267eaadc0e025243b443a94ff33bde6302ad ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/minio-client/vendor.tar.gz /work/SRC/openSUSE:Factory/.minio-client.new.16006/vendor.tar.gz differ: char 5, line 1