diff --git a/ais/backend/ht.go b/ais/backend/ht.go index 858c4cf5264..3b3f18520d3 100644 --- a/ais/backend/ht.go +++ b/ais/backend/ht.go @@ -2,7 +2,7 @@ // Package backend contains implementation of various backend providers. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package backend @@ -99,7 +99,7 @@ func getOriginalURL(ctx context.Context, bck *meta.Bck, objName string) (string, origURL, ok := ctx.Value(cos.CtxOriginalURL).(string) if !ok || origURL == "" { if bck.Props == nil { - return "", fmt.Errorf("failed to HEAD (%s): original_url is empty", bck) + return "", fmt.Errorf("failed to HEAD (%s): original_url is empty", bck.String()) } origURL = bck.Props.Extra.HTTP.OrigURLBck debug.Assert(origURL != "") diff --git a/ais/bucketmeta.go b/ais/bucketmeta.go index d3f0afc01c4..74b8e396130 100644 --- a/ais/bucketmeta.go +++ b/ais/bucketmeta.go @@ -157,7 +157,7 @@ func (m *bucketMD) set(bck *meta.Bck, p *cmn.Bprops) { debug.Assert(apc.IsProvider(bck.Provider)) prevProps, present := m.Get(bck) if !present { - debug.Assertf(false, "%s: not present", bck) + debug.Assertf(false, "%s: not present", bck.String()) } debug.Assert(prevProps.BID != 0) @@ -513,7 +513,7 @@ func defaultBckProps(args bckPropsArgs) (props *cmn.Bprops) { case args.bck.IsAIS(): debug.Assert(args.hdr == nil) case args.bck.Backend() != nil: - debug.Assertf(args.hdr == nil, "%s, hdr=%+v", args.bck, args.hdr) + debug.Assertf(args.hdr == nil, "%s, hdr=%+v", args.bck.String(), args.hdr) case args.bck.IsRemote(): debug.Assert(args.hdr != nil) props.Versioning.Enabled = false diff --git a/ais/plstcx.go b/ais/plstcx.go index 2c5d33095b5..f133607e7da 100644 --- a/ais/plstcx.go +++ b/ais/plstcx.go @@ -146,7 +146,7 @@ func (c *lstcx) do() (string, error) { } nlog.Infoln("'ls --all' to execute [" + c.amsg.Action + " -> " + c.altmsg.Action + "]") - s := fmt.Sprintf("%s[%s] %s => %s", c.altmsg.Action, c.xid, c.bckFrom, c.bckTo) + s := fmt.Sprintf("%s[%s] %s => %s", c.altmsg.Action, c.xid, c.bckFrom.String(), c.bckTo.String()) // 6. more pages, if any if lst.ContinuationToken != "" { diff --git a/ais/proxy.go b/ais/proxy.go index 45a44f5c33a..e06f183a6a2 100644 --- a/ais/proxy.go +++ b/ais/proxy.go @@ -662,7 +662,7 @@ func (p *proxy) httpbckget(w http.ResponseWriter, r *http.Request, dpq *dpq) { // (IV) list objects (NOTE -- TODO: currently, always forwarding) if !qbck.IsBucket() { - p.writeErrf(w, r, "bad list-objects request: %q is not a bucket (is a bucket query?)", qbck) + p.writeErrf(w, r, "bad list-objects request: %q is not a bucket (is a bucket query?)", qbck.String()) return } if p.forwardCP(w, r, msg, lsotag+" "+qbck.String()) { @@ -1297,15 +1297,15 @@ func (p *proxy) _bckpost(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg return } if !bckFrom.IsAIS() && bckFrom.Backend() == nil { - p.writeErrf(w, r, "can only rename AIS ('ais://') bucket (%q is not)", bckFrom) + p.writeErrf(w, r, "can only rename AIS ('ais://') bucket (%q is not)", bckFrom.Cname("")) return } if bckTo.IsRemote() { - p.writeErrf(w, r, "can only rename to AIS ('ais://') bucket (%q is remote)", bckTo) + p.writeErrf(w, r, "can only rename to AIS ('ais://') bucket (%q is remote)", bckTo.Cname("")) return } if bckFrom.Equal(bckTo, false, false) { - p.writeErrf(w, r, "cannot rename bucket %q to itself (%q)", bckFrom, bckTo) + p.writeErrf(w, r, "cannot rename bucket %q to itself (%q)", bckFrom.Cname(""), bckTo.Cname("")) return } bckFrom.Provider, bckTo.Provider = apc.AIS, apc.AIS @@ -1358,7 +1358,7 @@ func (p *proxy) _bckpost(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg tcbmsg.Prefix = cos.TrimPrefix(tcbmsg.Prefix) if bckFrom.Equal(bckTo, true, true) { if !bckFrom.IsRemote() { - p.writeErrf(w, r, "cannot %s bucket %q onto itself", msg.Action, bckFrom) + p.writeErrf(w, r, "cannot %s bucket %q onto itself", msg.Action, bckFrom.Cname("")) return } nlog.Infoln("proceeding to copy remote", bckFrom.String()) @@ -1432,7 +1432,7 @@ func (p *proxy) _bckpost(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg nlog.Warningf("multi-object operation %q within the same bucket %q", msg.Action, bck) } if bckTo.IsHT() { - p.writeErrf(w, r, "cannot %s to HTTP bucket %q", msg.Action, bckTo) + p.writeErrf(w, r, "cannot %s to HTTP bucket %q", msg.Action, bckTo.Cname("")) return } if !eq { @@ -1604,14 +1604,14 @@ func (p *proxy) _bcr(w http.ResponseWriter, r *http.Request, query url.Values, m bck.Props = nprops if backend := bck.Backend(); backend != nil { if err := backend.Validate(); err != nil { - p.writeErrf(w, r, "cannot create %s: invalid backend %s, err: %v", bck, backend, err) + p.writeErrf(w, r, "cannot create %s: invalid backend %s, err: %v", bck.Cname(""), backend.Cname(""), err) return } // Initialize backend bucket. if err := backend.InitNoBackend(p.owner.bmd); err != nil { if !cmn.IsErrRemoteBckNotFound(err) { p.writeErrf(w, r, "cannot create %s: failing to initialize backend %s, err: %v", - bck, backend, err) + bck.Cname(""), backend.Cname(""), err) return } args := bctx{p: p, w: w, r: r, bck: backend, msg: msg, query: query} @@ -1912,11 +1912,11 @@ func (p *proxy) httpobjpost(w http.ResponseWriter, r *http.Request, apireq *apiR func _checkObjMv(bck *meta.Bck, msg *apc.ActMsg, apireq *apiRequest) error { if bck.IsRemote() { - err := fmt.Errorf("invalid action %q: not supported for remote buckets (%s)", msg.Action, bck) + err := fmt.Errorf("invalid action %q: not supported for remote buckets (%s)", msg.Action, bck.String()) return cmn.NewErrUnsuppErr(err) } if bck.Props.EC.Enabled { - err := fmt.Errorf("invalid action %q: not supported for erasure-coded buckets (%s)", msg.Action, bck) + err := fmt.Errorf("invalid action %q: not supported for erasure-coded buckets (%s)", msg.Action, bck.String()) return cmn.NewErrUnsuppErr(err) } objName, objNameTo := apireq.items[1], msg.Name @@ -3009,11 +3009,11 @@ func (p *proxy) dsortHandler(w http.ResponseWriter, r *http.Request) { } if _, err = p.owner.bmd.modify(ctx); err != nil { debug.AssertNoErr(err) - err = fmt.Errorf(warnfmt+": %w", p, "failed to ", bckTo, bck, err) + err = fmt.Errorf(warnfmt+": %w", p, "failed to ", bckTo.String(), bck.String(), err) p.writeErr(w, r, err) return } - nlog.Warningf(warnfmt, p, "", bckTo, bck) + nlog.Warningf(warnfmt, p, "", bckTo.String(), bck.String()) } } dsort.PstartHandler(w, r, parsc) diff --git a/ais/prxbck.go b/ais/prxbck.go index 5b02bd58a5b..e255f252e52 100644 --- a/ais/prxbck.go +++ b/ais/prxbck.go @@ -1,6 +1,6 @@ // Package ais provides core functionality for the AIStore object storage. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package ais @@ -226,7 +226,7 @@ func (bctx *bctx) initAndTry() (bck *meta.Bck, err error) { return } default: - debug.Assertf(false, "%q: unexpected %v(%d)", bctx.bck, err, ecode) + debug.Assertf(false, "%q: unexpected %v(%d)", bctx.bck.String(), err, ecode) bctx.p.writeErr(bctx.w, bctx.r, err, ecode) return } diff --git a/ais/prxdl.go b/ais/prxdl.go index 9da7dd1de5c..c43195cd9ca 100644 --- a/ais/prxdl.go +++ b/ais/prxdl.go @@ -91,7 +91,7 @@ func (p *proxy) httpdlpost(w http.ResponseWriter, r *http.Request) { p.writeErrStatusf(w, r, http.StatusInternalServerError, "failed to receive download request: %v", err) return } - _, dlBase, ok := p.validateDownload(w, r, body) + dlb, dlBase, ok := p.validateDownload(w, r, body) if !ok { return } @@ -116,8 +116,8 @@ func (p *proxy) httpdlpost(w http.ResponseWriter, r *http.Request) { // download _job_ vs download xaction, see abortReq() in ais/prxnotif smap := p.owner.smap.get() nl := dload.NewDownloadNL( - jobID, // jobID != xid - apc.ActDownload, // xaction kind is always this + jobID, // jobID != xid + string(dlb.Type), // instead of apc.ActDownload xaction kind &smap.Smap, progressInterval, ) diff --git a/ais/prxnotif.go b/ais/prxnotif.go index abb1eec3637..e80a6a7bfbe 100644 --- a/ais/prxnotif.go +++ b/ais/prxnotif.go @@ -1,6 +1,6 @@ // Package ais provides core functionality for the AIStore object storage. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package ais @@ -329,8 +329,8 @@ func (n *notifs) done(nl nl.Listener) { } func abortReq(nl nl.Listener) cmn.HreqArgs { - if nl.Kind() == apc.ActDownload { - // HACK: + if _, ok := nl.(*dload.NotifDownloadListerner); ok { + // HACK // - download _job_ vs download xaction - see dload.NewDownloadNL() // - downloader implements abort via http.MethodDelete and uses different messaging return dload.AbortReq(nl.UUID() /*job ID*/) diff --git a/ais/tgtdl.go b/ais/tgtdl.go index c03cf33f17d..b4a91a2b203 100644 --- a/ais/tgtdl.go +++ b/ais/tgtdl.go @@ -1,6 +1,6 @@ // Package ais provides core functionality for the AIStore object storage. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package ais @@ -176,6 +176,13 @@ func (t *target) downloadHandler(w http.ResponseWriter, r *http.Request) { } else { // apc.Remove response, statusCode, respErr = xdl.RemoveJob(payload.ID) } + + // keep it quiet + if statusCode == http.StatusNotFound { + debug.Assert(response == nil) + t.writeErr(w, r, respErr, statusCode, Silent) + return + } default: cmn.WriteErr405(w, r, http.MethodDelete, http.MethodGet, http.MethodPost) return diff --git a/cmd/cli/cli/arch_hdlr.go b/cmd/cli/cli/arch_hdlr.go index c90ba298073..145d5045a8d 100644 --- a/cmd/cli/cli/arch_hdlr.go +++ b/cmd/cli/cli/arch_hdlr.go @@ -1,7 +1,7 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. // This file handles CLI commands that pertain to AIS objects. /* - * Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -241,7 +241,7 @@ func archMultiObjHandler(c *cli.Context) error { if msg.ListRange.IsList() { what = strings.Join(msg.ListRange.ObjNames, ", ") } - fmt.Fprintf(c.App.Writer, "archive %s/{%s} as %q\n", a.rsrc.bck, what, a.dest()) + fmt.Fprintf(c.App.Writer, "archive %s/{%s} as %q\n", a.rsrc.bck.String(), what, a.dest()) return nil } if !flagIsSet(c, dontHeadSrcDstBucketsFlag) { diff --git a/cmd/cli/cli/bucket.go b/cmd/cli/cli/bucket.go index 4d893d011d0..c682153c8e2 100644 --- a/cmd/cli/cli/bucket.go +++ b/cmd/cli/cli/bucket.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -26,7 +26,7 @@ func createBucket(c *cli.Context, bck cmn.Bck, props *cmn.BpropsToSet, dontHeadR if err = api.CreateBucket(apiBP, bck, props, dontHeadRemote); err != nil { if herr, ok := err.(*cmn.ErrHTTP); ok { if herr.Status == http.StatusConflict { - desc := fmt.Sprintf("Bucket %q already exists", bck) + desc := fmt.Sprintf("Bucket %q already exists", bck.String()) if flagIsSet(c, ignoreErrorFlag) { fmt.Fprintln(c.App.Writer, desc) return nil @@ -36,9 +36,9 @@ func createBucket(c *cli.Context, bck cmn.Bck, props *cmn.BpropsToSet, dontHeadR if cliConfVerbose() { herr.Message = herr.StringEx() } - return fmt.Errorf("failed to create %q: %w", bck, herr) + return fmt.Errorf("failed to create %q: %w", bck.String(), herr) } - return fmt.Errorf("failed to create %q: %v", bck, err) + return fmt.Errorf("failed to create %q: %v", bck.String(), err) } // NOTE: see docs/bucket.md#default-bucket-properties fmt.Fprintf(c.App.Writer, "%q created\n", bck.Cname("")) @@ -52,7 +52,7 @@ func destroyBuckets(c *cli.Context, buckets []cmn.Bck) (cmn.Bck, error) { empty, errEmp := isBucketEmpty(bck, true /*cached*/) if errEmp == nil && !empty { if !flagIsSet(c, yesFlag) { - if ok := confirm(c, fmt.Sprintf("Proceed to destroy %s?", bck)); !ok { + if ok := confirm(c, fmt.Sprintf("Proceed to destroy %s?", bck.String())); !ok { continue } } @@ -88,7 +88,7 @@ func mvBucket(c *cli.Context, bckFrom, bckTo cmn.Bck) error { return V(err) } _, xname := xact.GetKindName(apc.ActMoveBck) - text := fmt.Sprintf("%s %s => %s", xact.Cname(xname, xid), bckFrom, bckTo) + text := fmt.Sprintf("%s %s => %s", xact.Cname(xname, xid), bckFrom.String(), bckTo.String()) if !flagIsSet(c, waitFlag) && !flagIsSet(c, waitJobXactFinishedFlag) { if flagIsSet(c, nonverboseFlag) { fmt.Fprintln(c.App.Writer, xid) @@ -106,7 +106,7 @@ func mvBucket(c *cli.Context, bckFrom, bckTo cmn.Bck) error { fmt.Fprintln(c.App.Writer, text+" ...") xargs := xact.ArgsMsg{ID: xid, Kind: apc.ActMoveBck, Timeout: timeout} if err := waitXact(&xargs); err != nil { - fmt.Fprintf(c.App.ErrWriter, fmtXactFailed, "rename", bckFrom, bckTo) + fmt.Fprintf(c.App.ErrWriter, fmtXactFailed, "rename", bckFrom.String(), bckTo.String()) return err } fmt.Fprint(c.App.Writer, fmtXactSucceeded) @@ -127,7 +127,7 @@ func evictBucket(c *cli.Context, bck cmn.Bck) error { // check presence unless remais (in re: bck/@alias/name vs bck/@uuid/name) if !bck.IsRemoteAIS() { if _, present := bmd.Get((*meta.Bck)(&bck)); !present { - return fmt.Errorf("%s does not exist - nothing to do", bck) + return fmt.Errorf("%s does not exist - nothing to do", bck.String()) } } return _evictBck(c, bck) diff --git a/cmd/cli/cli/bucket_hdlr.go b/cmd/cli/cli/bucket_hdlr.go index a743f8c66a4..ab075cd5836 100644 --- a/cmd/cli/cli/bucket_hdlr.go +++ b/cmd/cli/cli/bucket_hdlr.go @@ -1,7 +1,7 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. // This file handles CLI commands that pertain to AIS buckets. /* - * Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2021-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -329,7 +329,7 @@ func mvBucketHandler(c *cli.Context) error { return err } if bckFrom.Equal(&bckTo) { - return incorrectUsageMsg(c, errFmtSameBucket, commandRename, bckTo) + return incorrectUsageMsg(c, errFmtSameBucket, commandRename, bckTo.Cname("")) } return mvBucket(c, bckFrom, bckTo) } diff --git a/cmd/cli/cli/cpr.go b/cmd/cli/cli/cpr.go index a892e0eed68..5fffb49d30e 100644 --- a/cmd/cli/cli/cpr.go +++ b/cmd/cli/cli/cpr.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -59,7 +59,7 @@ func (cpr *cprCtx) copyBucket(c *cli.Context, bckFrom, bckTo cmn.Bck, msg *apc.C // 2. got bucket summary(ies) summaries := ctx.res for _, res := range summaries { - debug.Assertf(res.Bck.Equal(&bckFrom), "%s != %s", res.Bck, bckFrom) + debug.Assertf(res.Bck.Equal(&bckFrom), "%s != %s", res.Bck.String(), bckFrom.String()) cpr.totals.size += int64(res.TotalSize.PresentObjs + res.TotalSize.RemoteObjs) cpr.totals.objs += int64(res.ObjCount.Present + res.ObjCount.Remote) } diff --git a/cmd/cli/cli/job_hdlr.go b/cmd/cli/cli/job_hdlr.go index e73cda9839d..6ce4d622ce5 100644 --- a/cmd/cli/cli/job_hdlr.go +++ b/cmd/cli/cli/job_hdlr.go @@ -504,7 +504,7 @@ func startDownloadHandler(c *cli.Context) error { } if !p.BackendBck.Equal(&source.backend.bck) { warn := fmt.Sprintf("%s does not have Cloud bucket %s as its *backend* - proceeding to download anyway.", - basePayload.Bck, source.backend.bck) + basePayload.Bck.String(), source.backend.bck.String()) actionWarn(c, warn) dlType = dload.TypeSingle } diff --git a/cmd/cli/cli/ls.go b/cmd/cli/cli/ls.go index 0015f3b5cd6..40dbfca82b1 100644 --- a/cmd/cli/cli/ls.go +++ b/cmd/cli/cli/ls.go @@ -277,11 +277,11 @@ func listObjects(c *cli.Context, bck cmn.Bck, prefix string, listArch, printEmpt } if flagIsSet(c, verChangedFlag) { if bck.IsAIS() { - return fmt.Errorf("flag %s requires remote bucket (have: %s)", qflprn(verChangedFlag), bck) + return fmt.Errorf("flag %s requires remote bucket (have: %s)", qflprn(verChangedFlag), bck.String()) } if !bck.HasVersioningMD() { return fmt.Errorf("flag %s only applies to remote backends that maintain at least some form of versioning information (have: %s)", - qflprn(verChangedFlag), bck) + qflprn(verChangedFlag), bck.String()) } msg.SetFlag(apc.LsVerChanged) } diff --git a/cmd/cli/cli/multiobj.go b/cmd/cli/cli/multiobj.go index 9ad6a31a26a..3ebe40afcc1 100644 --- a/cmd/cli/cli/multiobj.go +++ b/cmd/cli/cli/multiobj.go @@ -132,7 +132,7 @@ func runTCO(c *cli.Context, bckFrom, bckTo cmn.Bck, listObjs, tmplObjs, etlName } xargs := xact.ArgsMsg{ID: xid, Kind: xkind, Timeout: timeout} if err = waitXact(&xargs); err != nil { - fmt.Fprintf(c.App.ErrWriter, fmtXactFailed, text, bckFrom, bckTo) + fmt.Fprintf(c.App.ErrWriter, fmtXactFailed, text, bckFrom.String(), bckTo.String()) } else { fmt.Fprint(c.App.Writer, fmtXactSucceeded) } @@ -251,7 +251,7 @@ func _rmOne(c *cli.Context, shift int) error { case oltp.objName == "": // 2. all objects if flagIsSet(c, rmrfFlag) { if !flagIsSet(c, yesFlag) { - warn := fmt.Sprintf("will remove all objects from %s. The operation cannot be undone!", bck) + warn := fmt.Sprintf("will remove all objects from %s. The operation cannot be undone!", bck.String()) if ok := confirm(c, "Proceed?", warn); !ok { return nil } diff --git a/cmd/cli/cli/object.go b/cmd/cli/cli/object.go index 8b90358b4cf..34448e7ab62 100644 --- a/cmd/cli/cli/object.go +++ b/cmd/cli/cli/object.go @@ -452,7 +452,7 @@ func rmRfAllObjects(c *cli.Context, bck cmn.Bck) error { debug.Assert(errCnt64 > 0) firstErr := <-errCh warn := fmt.Sprintf("failed to delete %d object%s from %s: (%d deleted, %d error%s)\n", l-cnt, cos.Plural(l-cnt), - bck, cnt, errCnt64, cos.Plural(int(errCnt64))) + bck.String(), cnt, errCnt64, cos.Plural(int(errCnt64))) actionWarn(c, warn) return firstErr } diff --git a/cmd/cli/cli/object_hdlr.go b/cmd/cli/cli/object_hdlr.go index 06eb6085892..37b882c5bd0 100644 --- a/cmd/cli/cli/object_hdlr.go +++ b/cmd/cli/cli/object_hdlr.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -289,7 +289,7 @@ func mvObjectHandler(c *cli.Context) (err error) { if bckDst, objDst, err := parseBckObjURI(c, newObj, false); err == nil && bckDst.Name != "" { if !bckDst.Equal(&bck) { - return incorrectUsageMsg(c, "moving an object to another bucket(%s) is not supported", bckDst) + return incorrectUsageMsg(c, "moving an object to another bucket (%s) is not supported", bckDst.Cname("")) } if oldObj == "" { return missingArgumentsError(c, "no object specified in %q", newObj) diff --git a/cmd/cli/cli/parse_uri.go b/cmd/cli/cli/parse_uri.go index 9ba70ea3d48..acfb1c08c8c 100644 --- a/cmd/cli/cli/parse_uri.go +++ b/cmd/cli/cli/parse_uri.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -130,7 +130,8 @@ func parseQueryBckURI(uri string) (cmn.QueryBcks, string, error) { } bck, prefix, err := cmn.ParseBckObjectURI(uri, cmn.ParseURIOpts{IsQuery: true}) if prefix != "" && bck.IsQuery() { - return cmn.QueryBcks(bck), prefix, fmt.Errorf("bucket query (%q) with embedded prefix (%q) is not supported", bck, prefix) + return cmn.QueryBcks(bck), prefix, + fmt.Errorf("bucket query (%q) with embedded prefix (%q) is not supported", bck.String(), prefix) } return cmn.QueryBcks(bck), prefix, err } diff --git a/cmd/cli/cli/show_hdlr.go b/cmd/cli/cli/show_hdlr.go index 760692957a8..73719a5cab8 100644 --- a/cmd/cli/cli/show_hdlr.go +++ b/cmd/cli/cli/show_hdlr.go @@ -1,7 +1,7 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. // This file contains implementation of the top-level `show` command. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -717,7 +717,7 @@ func showBMDHandler(c *cli.Context) error { } } fmt.Fprintf(tw, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", - provider, ns, bucket, props.BackendBck, copies, ec, + provider, ns, bucket, props.BackendBck.String(), copies, ec, cos.FormatNanoTime(props.Created, "")) } } diff --git a/cmd/cli/cli/tcbtco.go b/cmd/cli/cli/tcbtco.go index 7359fed65fb..a354fe6ff2f 100644 --- a/cmd/cli/cli/tcbtco.go +++ b/cmd/cli/cli/tcbtco.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -89,11 +89,11 @@ func copyTransform(c *cli.Context, etlName, objNameOrTmpl string, bckFrom, bckTo if empty { if bckFrom.IsRemote() && !allIncludingRemote { hint := "(tip: use option %s to " + text1 + " remote objects from the backend store)\n" - note := fmt.Sprintf("source %s appears to be empty "+hint, bckFrom, qflprn(copyAllObjsFlag)) + note := fmt.Sprintf("source %s appears to be empty "+hint, bckFrom.String(), qflprn(copyAllObjsFlag)) actionNote(c, note) return nil } - note := fmt.Sprintf("source %s is empty, nothing to do\n", bckFrom) + note := fmt.Sprintf("source %s is empty, nothing to do\n", bckFrom.String()) actionNote(c, note) return nil } @@ -109,7 +109,7 @@ func copyTransform(c *cli.Context, etlName, objNameOrTmpl string, bckFrom, bckTo return err } warn := fmt.Sprintf("destination %s doesn't exist and will be created with configuration copied from the source (%s))", - bckTo, bckFrom) + bckTo.String(), bckFrom.String()) actionWarn(c, warn) } @@ -121,7 +121,7 @@ func copyTransform(c *cli.Context, etlName, objNameOrTmpl string, bckFrom, bckTo if oltp.objName == "" && oltp.list == "" && oltp.tmpl == "" { // NOTE: e.g. 'ais cp gs://abc gs:/abc' to sync remote bucket => aistore if bckFrom.Equal(&bckTo) && !bckFrom.IsRemote() { - return incorrectUsageMsg(c, errFmtSameBucket, commandCopy, bckTo) + return incorrectUsageMsg(c, errFmtSameBucket, commandCopy, bckTo.Cname("")) } if dryRun { // TODO: show object names with destinations, make the output consistent with etl dry-run @@ -308,7 +308,7 @@ func etlBucket(c *cli.Context, etlName string, bckFrom, bckTo cmn.Bck) error { } _, xname := xact.GetKindName(apc.ActETLBck) - text := fmt.Sprintf("%s %s => %s", xact.Cname(xname, xid), bckFrom, bckTo) + text := fmt.Sprintf("%s %s => %s", xact.Cname(xname, xid), bckFrom.String(), bckTo.String()) if !flagIsSet(c, waitFlag) && !flagIsSet(c, waitJobXactFinishedFlag) { fmt.Fprintln(c.App.Writer, text) return nil diff --git a/cmd/cli/cli/utils.go b/cmd/cli/cli/utils.go index f07ddbc7cb6..cc121b5aebf 100644 --- a/cmd/cli/cli/utils.go +++ b/cmd/cli/cli/utils.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -496,12 +496,12 @@ func headBucket(bck cmn.Bck, dontAddBckMD bool) (p *cmn.Bprops, err error) { case herr.Message != "": err = errors.New(herr.Message) default: - err = fmt.Errorf("failed to HEAD bucket %q: %s", bck, herr.Message) + err = fmt.Errorf("failed to HEAD bucket %q: %s", bck.String(), herr.Message) } } else { msg := strings.ToLower(err.Error()) if !strings.HasPrefix(msg, "head \"http") && !strings.HasPrefix(msg, "head http") { - err = fmt.Errorf("failed to HEAD bucket %q: %v", bck, err) + err = fmt.Errorf("failed to HEAD bucket %q: %v", bck.String(), err) } } return @@ -662,7 +662,7 @@ func isBucketEmpty(bck cmn.Bck, cached bool) (bool, error) { func ensureRemoteProvider(bck cmn.Bck) error { if !apc.IsProvider(bck.Provider) { - return fmt.Errorf("invalid bucket %q: missing backend provider", bck) + return fmt.Errorf("invalid bucket %q: missing backend provider", bck.String()) } if bck.IsRemote() { return nil @@ -678,7 +678,7 @@ func ensureRemoteProvider(bck cmn.Bck) error { return nil // yes it is } } - return fmt.Errorf("invalid bucket %q: expecting remote backend", bck) + return fmt.Errorf("invalid bucket %q: expecting remote backend", bck.String()) } func parseURLtoBck(strURL string) (bck cmn.Bck) { diff --git a/cmd/cli/cli/utils_internal_test.go b/cmd/cli/cli/utils_internal_test.go index 5f768feb130..d430c7aed57 100644 --- a/cmd/cli/cli/utils_internal_test.go +++ b/cmd/cli/cli/utils_internal_test.go @@ -1,6 +1,6 @@ // Package cli provides easy-to-use commands to manage, monitor, and utilize AIS clusters. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package cli @@ -216,7 +216,7 @@ func TestParseDestValidURIs(t *testing.T) { } if bucket != test.bucket { - t.Errorf("parseSource(%s) expected bucket: %s, got: %s", test.url, test.bucket, bucket) + t.Errorf("parseSource(%s) expected bucket: %s, got: %s", test.url, test.bucket.String(), bucket.String()) } if pathSuffix != test.objName { t.Errorf("parseSource(%s) expected bucket: %s, got: %s", test.url, test.objName, pathSuffix) @@ -351,7 +351,8 @@ func TestParseBckURI(t *testing.T) { for _, test := range positiveTests { bck, err := parseBckURI(&cli.Context{}, test.uri, true /*require provider*/) tassert.Errorf(t, err == nil, "failed on %s with err: %v", test.uri, err) - tassert.Errorf(t, test.bck.Equal(&bck), "failed on %s buckets are not equal (expected: %q, got: %q)", test.uri, test.bck, bck) + tassert.Errorf(t, test.bck.Equal(&bck), "failed on %s buckets are not equal (expected: %q, got: %q)", + test.uri, test.bck.String(), bck.String()) } negativeTests := []struct { @@ -373,7 +374,7 @@ func TestParseBckURI(t *testing.T) { } for _, test := range negativeTests { bck, err := parseBckURI(&cli.Context{}, test.uri, true /*require provider*/) - tassert.Errorf(t, err != nil, "expected error on %s (bck: %q)", test.uri, bck) + tassert.Errorf(t, err != nil, "expected error on %s (bck: %q)", test.uri, bck.String()) } } @@ -427,7 +428,8 @@ func TestParseBckObjectURI(t *testing.T) { for _, test := range positiveTests { bck, objName, err := parseBckObjURI(&cli.Context{}, test.uri, test.optObjName) tassert.Errorf(t, err == nil, "failed on %s with err: %v", test.uri, err) - tassert.Errorf(t, test.bck.Equal(&bck), "failed on %s buckets are not equal (expected: %q, got: %q)", test.uri, test.bck, bck) + tassert.Errorf(t, test.bck.Equal(&bck), "failed on %s buckets are not equal (expected: %q, got: %q)", + test.uri, test.bck.String(), bck.String()) tassert.Errorf(t, test.objName == objName, "failed on %s object names are not equal (expected: %q, got: %q)", test.uri, test.objName, objName) } @@ -458,6 +460,6 @@ func TestParseBckObjectURI(t *testing.T) { } for _, test := range negativeTests { bck, objName, err := parseBckObjURI(&cli.Context{}, test.uri, test.optObjName) - tassert.Errorf(t, err != nil, "expected error on %s (bck: %q, obj_name: %q)", test.uri, bck, objName) + tassert.Errorf(t, err != nil, "expected error on %s (bck: %q, obj_name: %q)", test.uri, bck.String(), objName) } } diff --git a/cmd/cli/go.mod b/cmd/cli/go.mod index efa601d00e2..2d168ba47cc 100644 --- a/cmd/cli/go.mod +++ b/cmd/cli/go.mod @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/cli go 1.23.2 require ( - github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38 + github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519 github.com/fatih/color v1.18.0 github.com/json-iterator/go v1.1.12 github.com/onsi/ginkgo/v2 v2.21.0 diff --git a/cmd/cli/go.sum b/cmd/cli/go.sum index e1a7155a732..9ccd8e584ff 100644 --- a/cmd/cli/go.sum +++ b/cmd/cli/go.sum @@ -1,7 +1,7 @@ code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38 h1:lQioqvz7kmF+VtBTvOwjKv2AY2go4tRmUqWXaGeAuBc= -github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw= +github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519 h1:4HbBsL5+pd3cv0awBbyxdwfTps8/lSMQujqvhY5eI0s= +github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw= github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= diff --git a/cmd/ishard/go.mod b/cmd/ishard/go.mod index 51b874cd70a..7622226a058 100644 --- a/cmd/ishard/go.mod +++ b/cmd/ishard/go.mod @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/ishard go 1.23.2 require ( - github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38 + github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519 github.com/json-iterator/go v1.1.12 github.com/vbauerster/mpb/v4 v4.12.2 ) diff --git a/cmd/ishard/go.sum b/cmd/ishard/go.sum index a4769c8c2ac..981444c8abb 100644 --- a/cmd/ishard/go.sum +++ b/cmd/ishard/go.sum @@ -1,6 +1,6 @@ code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= -github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38 h1:lQioqvz7kmF+VtBTvOwjKv2AY2go4tRmUqWXaGeAuBc= -github.com/NVIDIA/aistore v1.3.26-0.20250104165201-5ba918095b38/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw= +github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519 h1:4HbBsL5+pd3cv0awBbyxdwfTps8/lSMQujqvhY5eI0s= +github.com/NVIDIA/aistore v1.3.26-0.20250105213550-2b2694a79519/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw= github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM= diff --git a/cmd/ishard/ishard/ishard_test.go b/cmd/ishard/ishard/ishard_test.go index b88a0484b69..6f2bc44cbca 100644 --- a/cmd/ishard/ishard/ishard_test.go +++ b/cmd/ishard/ishard/ishard_test.go @@ -44,7 +44,7 @@ func runIshardTest(t *testing.T, cfg *config.Config, baseParams api.BaseParams, isharder, err := ishard.NewISharder(cfg) tassert.CheckFatal(t, err) - fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck, cfg.DstBck) + fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck.String(), cfg.DstBck.String()) err = isharder.Start() tassert.CheckFatal(t, err) @@ -257,7 +257,7 @@ func TestIshardPrefix(t *testing.T) { isharder, err := ishard.NewISharder(cfg) tassert.CheckFatal(t, err) - fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck, cfg.DstBck) + fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck.String(), cfg.DstBck.String()) err = isharder.Start() tassert.CheckFatal(t, err) @@ -434,7 +434,7 @@ func TestIshardMissingExtension(t *testing.T) { isharder, err := ishard.NewISharder(cfg) tassert.CheckFatal(t, err) - fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck, cfg.DstBck) + fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck.String(), cfg.DstBck.String()) err = isharder.Start() // error is expected to occur since `dropout` is set, ishard should abort if err == nil || !strings.HasPrefix(err.Error(), "missing extension: ") { @@ -465,7 +465,7 @@ func TestIshardMissingExtension(t *testing.T) { isharder, err := ishard.NewISharder(cfg) tassert.CheckFatal(t, err) - fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck, cfg.DstBck) + fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck.String(), cfg.DstBck.String()) err = isharder.Start() tassert.CheckFatal(t, err) @@ -555,7 +555,7 @@ func TestIshardEKM(t *testing.T) { builder.WriteString("\n}") cfg.EKMFlag.Set(builder.String()) - fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck, cfg.DstBck) + fmt.Printf("starting ishard, from %s to %s\n", cfg.SrcBck.String(), cfg.DstBck.String()) isharder, err := ishard.NewISharder(cfg) tassert.CheckFatal(t, err) diff --git a/cmn/bck.go b/cmn/bck.go index 5b5258511c6..66a175606f8 100644 --- a/cmn/bck.go +++ b/cmn/bck.go @@ -218,7 +218,7 @@ func (b *Bck) Equal(other *Bck) bool { func (b *Bck) String() string { var sb strings.Builder - sb.Grow(96) + sb.Grow(64) b.Str(&sb) return sb.String() } diff --git a/cmn/err.go b/cmn/err.go index a1cdda8ebfe..5499febb1fb 100644 --- a/cmn/err.go +++ b/cmn/err.go @@ -943,7 +943,7 @@ func ValidateRemoteBck(act string, bck *Bck) (err *ErrNotRemoteBck) { } func (e *ErrNotRemoteBck) Error() string { - return fmt.Sprintf("%s: expecting remote bucket (have %s)", e.act, e.bck) + return fmt.Sprintf("%s: expecting remote bucket (have %s)", e.act, e.bck.String()) } // ErrXactTgtInMaint diff --git a/core/meta/bck.go b/core/meta/bck.go index 41aa43168f0..469dba26825 100644 --- a/core/meta/bck.go +++ b/core/meta/bck.go @@ -92,7 +92,7 @@ func (b *Bck) String() string { aisBID = uint64(1 << 63) ) var sb strings.Builder - sb.Grow(96) + sb.Grow(64) b.Bucket().Str(&sb) sb.WriteString("(0x") sb.WriteString(strconv.FormatUint((b.Props.BID &^ aisBID), 16)) diff --git a/fs/fs.go b/fs/fs.go index 527128c0353..5307aa91bd5 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -1,6 +1,6 @@ // Package fs provides mountpath and FQN abstractions and methods to resolve/map stored content /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package fs @@ -321,7 +321,7 @@ func (mi *Mountpath) createBckDirs(bck *cmn.Bck, nilbmd bool) (int, error) { nlog.Errorln(err) } } else if err := cos.CreateDir(dir); err != nil { - return num, fmt.Errorf("bucket %s: failed to create directory %s: %w", bck, dir, err) + return num, fmt.Errorf("bucket %s: failed to create directory %s: %w", bck.String(), dir, err) } num++ } @@ -1029,7 +1029,7 @@ func DestroyBucket(op string, bck *cmn.Bck, bid uint64) (err error) { now = time.Now() } if mtime.After(now) || now.Sub(mtime) < bidUnknownTTL { - return fmt.Errorf("%s %q: unknown BID with %q age below ttl (%v)", op, bck, bdir, mtime) + return fmt.Errorf("%s %q: unknown BID with %q age below ttl (%v)", op, bck.String(), bdir, mtime) } } } @@ -1043,7 +1043,7 @@ func DestroyBucket(op string, bck *cmn.Bck, bid uint64) (err error) { } } if n < count { - err = fmt.Errorf("%s %q: failed to destroy %d out of %d dirs", op, bck, count-n, count) + err = fmt.Errorf("%s %q: failed to destroy %d out of %d dirs", op, bck.String(), count-n, count) } return } diff --git a/mirror/put_copies.go b/mirror/put_copies.go index f286c0d395c..46f9d2861ba 100644 --- a/mirror/put_copies.go +++ b/mirror/put_copies.go @@ -1,6 +1,6 @@ // Package mirror provides local mirroring and replica management /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package mirror @@ -78,7 +78,7 @@ func (p *putFactory) Start() error { bck, mirror := lom.Bck(), lom.MirrorConf() if !mirror.Enabled { - return fmt.Errorf("%s: mirroring disabled, nothing to do", bck) + return fmt.Errorf("%s: mirroring disabled, nothing to do", bck.String()) } if err = fs.ValidateNCopies(core.T.String(), int(mirror.Copies)); err != nil { nlog.Errorln(err) diff --git a/xact/xs/xaction_test.go b/xact/xs/xaction_test.go index cf7ad852ba1..d91a4f50496 100644 --- a/xact/xs/xaction_test.go +++ b/xact/xs/xaction_test.go @@ -1,6 +1,6 @@ // Package xs_test contains xs unit test. /* - * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved. */ package xs_test @@ -175,7 +175,7 @@ func TestXactionAbortAllGlobal(t *testing.T) { xreg.AbortAll(errors.New("test-abort-g"), xact.ScopeG, xact.ScopeGB) tassert.Errorf(t, rnsLRU.Entry.Get().IsAborted(), "AbortAllGlobal: expected global xaction to be aborted") - tassert.Errorf(t, !xactBck.IsAborted(), "AbortAllGlobal: expected bucket xaction to be running: %s", xactBck) + tassert.Errorf(t, !xactBck.IsAborted(), "AbortAllGlobal: expected bucket xaction to be running: %s", xactBck.String()) } func TestXactionAbortBuckets(t *testing.T) {