8000 [API change] unify delete/evict with other multi-object APIs; support… · NVIDIA/aistore@fd3d6d8 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit fd3d6d8

Browse files
committed
[API change] unify delete/evict with other multi-object APIs; support non-recursion
* core changes: s3 and native API * tests: cleanup * CLI: inline help and docs * part two, prev. commit: 50dec2b Signed-off-by: Alex Aizman <alex.aizman@gmail.com>
1 parent e4dc7cc commit fd3d6d8

File tree

20 files changed

+54
-47
lines changed
  • bench/tools/aisloader
  • cmd
  • docs
  • tools
  • xact
  • 20 files changed

    +54
    -47
    lines changed

    ais/proxy.go

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -994,7 +994,7 @@ func (p *proxy) httpbckdelete(w http.ResponseWriter, r *http.Request, apireq *ap
    994994
    return
    995995
    }
    996996
    }
    997-
    xid, err := p.listrange(r.Method, bck.Name, msg, apireq.query)
    997+
    xid, err := p.bcastMultiobj(r.Method, bck.Name, msg, apireq.query)
    998998
    if err != nil {
    999999
    p.writeErr(w, r, err)
    10001000
    return
    @@ -1491,7 +1491,7 @@ func (p *proxy) _bckpost(w http.ResponseWriter, r *http.Request, msg *apc.ActMsg
    14911491
    p.writeErr(w, r, err)
    14921492
    return
    14931493
    }
    1494-
    if xid, err = p.listrange(r.Method, bucket, msg, query); err != nil {
    1494+
    if xid, err = p.bcastMultiobj(r.Method, bucket, msg, query); err != nil {
    14951495
    p.writeErr(w, r, err)
    14961496
    return
    14971497
    }
    @@ -2169,7 +2169,7 @@ func (p *proxy) redirectAction(w http.ResponseWriter, r *http.Request, bck *meta
    21692169
    http.Redirect(w, r, redirectURL, http.StatusTemporaryRedirect)
    21702170
    }
    21712171

    2172-
    func (p *proxy) listrange(method, bucket string, msg *apc.ActMsg, query url.Values) (xid string, err error) {
    2172+
    func (p *proxy) bcastMultiobj(method, bucket string, msg *apc.ActMsg, query url.Values) (xid string, err error) {
    21732173
    var (
    21742174
    smap = p.owner.smap.get()
    21752175
    actMsgExt = p.newAmsg(msg, nil, cos.GenUUID())

    ais/prxs3.go

    Lines changed: 9 additions & 7 deletions
    Original file line numberDiff line numberDiff line change
    @@ -271,13 +271,15 @@ func (p *proxy) delMultipleObjs(w http.ResponseWriter, r *http.Request, bucket s
    271271
    }
    272272

    273273
    var (
    274-
    msg = apc.ActMsg{Action: apc.ActDeleteObjects}
    275-
    lrMsg = &apc.ListRange{ObjNames: make([]string, 0, len(lst.Object))}
    274+
    msg = apc.ActMsg{Action: apc.ActDeleteObjects}
    275+
    objNames = make([]string, 0, len(lst.Object))
    276+
    evdMsg = &apc.EvdMsg{}
    276277
    )
    277278
    for _, obj := range lst.Object {
    278-
    lrMsg.ObjNames = append(lrMsg.ObjNames, obj.Key)
    279+
    objNames = append(objNames, obj.Key)
    279280
    }
    280-
    msg.Value = lrMsg
    281+
    evdMsg.ObjNames = objNames
    282+
    msg.Value = evdMsg
    281283

    282284
    // marshal+unmarshal to convince `p.listrange` to treat `listMsg` as `map[string]interface`
    283285
    var (
    @@ -291,7 +293,7 @@ func (p *proxy) delMultipleObjs(w http.ResponseWriter, r *http.Request, bucket s
    291293
    s3.WriteErr(w, r, err, 0)
    292294
    return
    293295
    }
    294-
    if _, err := p.listrange(http.MethodDelete, bucket, &msg2, query); err != nil {
    296+
    if _, err := p.bcastMultiobj(http.MethodDelete, bucket, &msg2, query); err != nil {
    295297
    s3.WriteErr(w, r, err, 0)
    296298
    }
    297299
    // TODO: The client wants the response containing two lists:
    @@ -301,8 +303,8 @@ func (p *proxy) delMultipleObjs(w http.ResponseWriter, r *http.Request, bucket s
    301303
    // whether there were any errors while deleting objects.
    302304
    // So, we fill only "Deleted successfully" response part.
    303305
    // See: https://docs.aws.amazon.com/AmazonS3/latest/API/API_Dele 10000 teObjects.html
    304-
    all := &s3.DeleteResult{Objs: make([]s3.DeletedObjInfo, 0, len(lrMsg.ObjNames))}
    305-
    for _, name := range lrMsg.ObjNames {
    306+
    all := &s3.DeleteResult{Objs: make([]s3.DeletedObjInfo, 0, len(evdMsg.ObjNames))}
    307+
    for _, name := range evdMsg.ObjNames {
    306308
    all.Objs = append(all.Objs, s3.DeletedObjInfo{Key: name})
    307309
    }
    308310
    sgl := p.gmm.NewSGL(0)

    ais/test/downloader_test.go

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -551,7 +551,7 @@ func TestDownloadRemote(t *testing.T) {
    551551
    }
    552552

    553553
    tlog.Logf("(1) evicting a _list_ of objects from remote bucket %s...\n", test.srcBck.String())
    554-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: expectedObjs, Template: ""}}
    554+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: expectedObjs}}
    555555
    xid, err := api.EvictMultiObj(baseParams, test.srcBck, evdMsg)
    556556
    tassert.CheckFatal(t, err)
    557557
    args := xact.ArgsMsg{ID: xid, Kind: apc.ActEvictObjects, Timeout: tools.RebalanceTimeout}

    ais/test/integration_test.go

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -1396,7 +1396,7 @@ func TestAtimePrefetch(t *testing.T) {
    13961396
    for obj := range nameCh {
    13971397
    objs = append(objs, obj)
    13981398
    }
    1399-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs, Template: ""}}
    1399+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs}}
    14001400
    xid, err := api.EvictMultiObj(baseParams, bck, evdMsg)
    14011401
    tassert.CheckFatal(t, err)
    14021402
    args := xact.ArgsMsg{ID: xid, Timeout: tools.RebalanceTimeout}

    ais/test/object_test.go

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -390,7 +390,7 @@ func TestSameBucketName(t *testing.T) {
    390390
    tassert.CheckFatal(t, err)
    391391

    392392
    tlog.Logf("EvictList %v\n", files)
    393-
    evdListMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: files, Template: ""}}
    393+
    evdListMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: files}}
    394394
    evictListID, err := api.EvictMultiObj(baseParams, bckRemote, evdListMsg)
    395395
    tassert.CheckFatal(t, err)
    396396
    args := xact.ArgsMsg{ID: evictListID, Kind: apc.ActEvictObjects, Timeout: tools.RebalanceTimeout}

    ais/test/objprops_test.go

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -130,7 +130,7 @@ func propsEvict(t *testing.T, proxyURL string, bck cmn.Bck, objMap map[string]st
    130130
    }
    131131

    132132
    baseParams := tools.BaseAPIParams(proxyURL)
    133-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: toEvictList, Template: ""}}
    133+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: toEvictList}}
    134134
    xid, err := api.EvictMultiObj(baseParams, bck, evdMsg)
    135135
    if err != nil {
    136136
    t.Errorf("Failed to evict objects: %v\n", err)

    ais/test/regression_test.go

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -746,7 +746,7 @@ func TestPrefetchList(t *testing.T) {
    746746

    747747
    // 2. Evict those objects from the cache and prefetch them
    748748
    tlog.Logf("Evicting and prefetching %d objects\n", len(m.objNames))
    749-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: m.objNames, Template: ""}}
    749+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: m.objNames}}
    750750
    xid, err := api.EvictMultiObj(baseParams, bck, evdMsg)
    751751
    if err != nil {
    752752
    t.Error(err)
    @@ -823,7 +823,7 @@ func TestDeleteList(t *testing.T) {
    823823
    tlog.Logf("PUT done.\n")
    824824

    825825
    // 2. Delete the objects
    826-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: files, Template: ""}}
    826+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: files}}
    827827
    xid, err := api.DeleteMultiObj(baseParams, b, evdMsg)
    828828
    tassert.CheckError(t, err)
    829829

    ais/tgtbck.go

    Lines changed: 5 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -400,19 +400,19 @@ func (t *target) httpbckdelete(w http.ResponseWriter, r *http.Request, apireq *a
    400400
    t.writeErr(w, r, errs[0]) // only 1 err is possible for 1 bck
    401401
    }
    402402
    case apc.ActDeleteObjects, apc.ActEvictObjects:
    403-
    lrMsg := &apc.ListRange{}
    404-
    if err := cos.MorphMarshal(msg.Value, lrMsg); err != nil {
    403+
    evdMsg := &apc.EvdMsg{}
    404+
    if err := cos.MorphMarshal(msg.Value, evdMsg); err != nil {
    405405
    t.writeErrf(w, r, cmn.FmtErrMorphUnmarshal, t.si, msg.Action, msg.Value, err)
    406406
    return
    407407
    }
    408-
    // extra safety check
    409-
    for _, name := range lrMsg.ObjNames {
    408+
    // NOTE: validate object names - each name individually
    409+
    for _, name := range evdMsg.ObjNames {
    410410
    if err := cmn.ValidateOname(name); err != nil {
    411411
    t.writeErr(w, r, err)
    412412
    return
    413413
    }
    414414
    }
    415-
    rns := xreg.RenewEvictDelete(msg.UUID, msg.Action /*xaction kind*/, apireq.bck, lrMsg)
    415+
    rns := xreg.RenewEvictDelete(msg.UUID, msg.Action /*xaction kind*/, apireq.bck, evdMsg)
    416416
    if rns.Err != nil {
    417417
    t.writeErr(w, r, rns.Err)
    418418
    return

    bench/tools/aisloader/run.go

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1130,7 +1130,7 @@ func cleanupObjs(objs []string, wg *sync.WaitGroup) {
    11301130
    b := min(t, runParams.batchSize)
    11311131
    n := t / b
    11321132
    for i := range n {
    1133-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs[i*b : (i+1)*b], Template: ""}}
    1133+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs[i*b : (i+1)*b]}}
    11341134
    xid, err := api.DeleteMultiObj(runParams.bp, runParams.bck, evdMsg)
    11351135
    if err != nil {
    11361136
    fmt.Println("delete err ", err)
    @@ -1142,7 +1142,7 @@ func cleanupObjs(objs []string, wg *sync.WaitGroup) {
    11421142
    }
    11431143

    11441144
    if t%b != 0 {
    1145-
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs[n*b:], Template: ""}}
    1145+
    evdMsg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: objs[n*b:]}}
    11461146
    xid, err := api.DeleteMultiObj(runParams.bp, runParams.bck, evdMsg)
    11471147
    if err != nil {
    11481148
    fmt.Println("delete err ", err)

    cmd/cli/cli/bucket_hdlr.go

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -112,9 +112,10 @@ const evictUsage = "Evict one remote bucket, multiple remote buckets, or\n" +
    112112
    indent1 + "\t- evict gs:\t- evict all GCP buckets from the cluster;\n" +
    113113
    indent1 + "\t- evict gs://abc --prefix images/\t- evict all gs://abc objects from the virtual subdirectory \"images\";\n" +
    114114
    indent1 + "\t- evict gs://abc/images/\t- same as above;\n" +
    115+
    indent1 + "\t- evict gs://abc/images/ --nr\t- same as above, but do not recurse into virtual subdirs;\n" +
    115116
    indent1 + "\t- evict gs://abc --template images/\t- same as above;\n" +
    116117
    indent1 + "\t- evict gs://abc --template \"shard-{0000..9999}.tar.lz4\"\t- evict the matching range (prefix + brace expansion);\n" +
    117-
    indent1 + "\t- evict \"gs://abc/shard-{0000..9999}.tar.lz4\"\t- same as above (note the double quotes around the BUCKET/TEMPLATE argument)"
    118+
    indent1 + "\t- evict \"gs://abc/shard-{0000..9999}.tar.lz4\"\t- same as above (notice BUCKET/TEMPLATE argument in quotes)"
    118119

    119120
    // flags
    120121
    var (

    cmd/cli/cli/object_hdlr.go

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -63,9 +63,10 @@ const objRmUsage = "Remove object or selected objects from the specified bucket,
    6363
    indent1 + "\t- 'rm s3://abc' --all\t- remove all objects including those that are not _present_ in the cluster;\n" +
    6464
    indent1 + "\t- 'rm gs://abc --prefix images/'\t- remove all objects from the virtual subdirectory \"images\";\n" +
    6565
    indent1 + "\t- 'rm gs://abc/images/'\t- same as above;\n" +
    66+
    indent1 + "\t- 'rm gs://abc/images/ --nr'\t- same as above, but do not recurse into virtual subdirs;\n" +
    6667
    indent1 + "\t- 'rm gs://abc --template images/'\t- same as above;\n" +
    6768
    indent1 + "\t- 'rm gs://abc --template \"shard-{0000..9999}.tar.lz4\"'\t- remove the matching range (prefix + brace expansion);\n" +
    68-
    indent1 + "\t- 'rm \"gs://abc/shard-{0000..9999}.tar.lz4\"'\t- same as above (notice double quotes)"
    69+
    indent1 + "\t- 'rm \"gs://abc/shard-{0000..9999}.tar.lz4\"'\t- same as above (notice BUCKET/TEMPLATE argument in quotes)"
    6970

    7071
    const concatUsage = "Append a file, a directory, or multiple files and/or directories\n" +
    7172
    indent1 + "as a new " + objectArgument + " if doesn't exists, and to an existing " + objectArgument + " otherwise, e.g.:\n" +

    cmd/cli/go.mod

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/cli
    33
    go 1.24
    44

    55
    require (
    6-
    github.com/NVIDIA/aistore v1.3.28-0.20250430211414-a9b1fc9e51c2
    6+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5
    77
    github.com/fatih/color v1.18.0
    88
    github.com/json-iterator/go v1.1.12
    99
    github.com/onsi/ginkgo/v2 v2.23.4

    cmd/cli/go.sum

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,6 @@
    11
    github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
    2-
    github.com/NVIDIA/aistore v1.3.28-0.20250430211414-a9b1fc9e51c2 h1:CNjD+3w0QahiRWgTC3MAFH+tIew8YhHo5HY0JPRkIIw=
    3-
    github.com/NVIDIA/aistore v1.3.28-0.20250430211414-a9b1fc9e51c2/go.mod h1:fG/SUrxDWPoTTZALVMdPMAdY56sar3aiRZVUI+hn++4=
    2+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5 h1:DaNTzYECfCsEoh4OkEYEE2+bzgnyuVxG3/QuvWeo6j4=
    3+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5/go.mod h1:fG/SUrxDWPoTTZALVMdPMAdY56sar3aiRZVUI+hn++4=
    44
    github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
    55
    github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
    66
    github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=

    cmd/ishard/go.mod

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/ishard
    33
    go 1.24
    44

    55
    require (
    6-
    github.com/NVIDIA/aistore v1.3.28-0.20250429203413-6ec610f5ee8d
    6+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5
    77
    github.com/json-iterator/go v1.1.12
    88
    github.com/vbauerster/mpb/v4 v4.12.2
    99
    )

    cmd/ishard/go.sum

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,5 +1,5 @@
    1-
    github.com/NVIDIA/aistore v1.3.28-0.20250429203413-6ec610f5ee8d h1:o/Gr53643KW5mclszgO8C9KWgeu7khfMuvblWT3ZCd4=
    2-
    github.com/NVIDIA/aistore v1.3.28-0.20250429203413-6ec610f5ee8d/go.mod h1:fG/SUrxDWPoTTZALVMdPMAdY56sar3aiRZVUI+hn++4=
    1+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5 h1:DaNTzYECfCsEoh4OkEYEE2+bzgnyuVxG3/QuvWeo6j4=
    2+
    github.com/NVIDIA/aistore v1.3.28-0.20250430231108-50dec2b64ef5/go.mod h1:fG/SUrxDWPoTTZALVMdPMAdY56sar3aiRZVUI+hn++4=
    33
    github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
    44
    github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
    55
    github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=

    docs/bucket.md

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -515,7 +515,6 @@ This is `ais bucket evict` command but most of the time we'll be using its `ais
    515515

    516516
    ```console
    517517
    $ ais evict --help
    518-
    519518
    NAME:
    520519
    ais evict - (alias for "bucket evict") Evict one remote bucket, multiple remote buckets, or
    521520
    selected objects in a given remote bucket or buckets,
    @@ -525,9 +524,10 @@ NAME:
    525524
    - evict gs: - evict all GCP buckets from the cluster;
    526525
    - evict gs://abc --prefix images/ - evict all gs://abc objects from the virtual subdirectory "images";
    527526
    - evict gs://abc/images/ - same as above;
    527+
    - evict gs://abc/images/ --nr - same as above, but do not recurse into virtual subdirs;
    528528
    - evict gs://abc --template images/ - same as above;
    529529
    - evict gs://abc --template "shard-{0000..9999}.tar.lz4" - evict the matching range (prefix + brace expansion);
    530-
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (note the double quotes around the BUCKET/TEMPLATE argument)
    530+
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (notice BUCKET/TEMPLATE argument in quotes)
    531531

    532532
    USAGE:
    533533
    ais evict BUCKET[/OBJECT_NAME_or_TEMPLATE] [BUCKET[/OBJECT_NAME_or_TEMPLATE] ...] [command options]

    docs/cli/object.md

    Lines changed: 6 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1575,7 +1575,6 @@ Some of the supported functionality can be quickly demonstrated with the followi
    15751575

    15761576
    ```console
    15771577
    $ ais evict --help
    1578-
    15791578
    NAME:
    15801579
    ais evict - (alias for "bucket evict") Evict one remote bucket, multiple remote buckets, or
    15811580
    selected objects in a given remote bucket or buckets,
    @@ -1585,9 +1584,10 @@ NAME:
    15851584
    - evict gs: - evict all GCP buckets from the cluster;
    15861585
    - evict gs://abc --prefix images/ - evict all gs://abc objects from the virtual subdirectory "images";
    15871586
    - evict gs://abc/images/ - same as above;
    1587+
    - evict gs://abc/images/ --nr - same as above, but do not recurse into virtual subdirs;
    15881588
    - evict gs://abc --template images/ - same as above;
    15891589
    - evict gs://abc --template "shard-{0000..9999}.tar.lz4" - evict the matching range (prefix + brace expansion);
    1590-
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (note the double quotes around the BUCKET/TEMPLATE argument)
    1590+
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (notice BUCKET/TEMPLATE argument in quotes)
    15911591

    15921592
    USAGE:
    15931593
    ais evict BUCKET[/OBJECT_NAME_or_TEMPLATE] [BUCKET[/OBJECT_NAME_or_TEMPLATE] ...] [command options]
    @@ -2070,9 +2070,10 @@ NAME:
    20702070
    - 'rm s3://abc' --all - remove all objects including those that are not _present_ in the cluster;
    20712071
    - 'rm gs://abc --prefix images/' - remove all objects from the virtual subdirectory "images";
    20722072
    - 'rm gs://abc/images/' - same as above;
    2073+
    - 'rm gs://abc/images/ --nr' - same as above, but do not recurse into virtual subdirs;
    20732074
    - 'rm gs://abc --template images/' - same as above;
    20742075
    - 'rm gs://abc --template "shard-{0000..9999}.tar.lz4"' - remove the matching range (prefix + brace expansion);
    2075-
    - 'rm "gs://abc/shard-{0000..9999}.tar.lz4"' - same as above (notice double quotes)
    2076+
    - 'rm "gs://abc/shard-{0000..9999}.tar.lz4"' - same as above (notice BUCKET/TEMPLATE argument in quotes)
    20762077

    20772078
    USAGE:
    20782079
    ais object rm BUCKET[/OBJECT_NAME_or_TEMPLATE] [BUCKET[/OBJECT_NAME_or_TEMPLATE] ...] [command options]
    @@ -2165,7 +2166,6 @@ Here's inline help, and specifically notice the _multi-object_ options: `--templ
    21652166

    21662167
    ```concole
    21672168
    $ ais evict --help
    2168-
    21692169
    NAME:
    21702170
    ais evict - (alias for "bucket evict") Evict one remote bucket, multiple remote buckets, or
    21712171
    selected objects in a given remote bucket or buckets,
    @@ -2175,9 +2175,10 @@ NAME:
    21752175
    - evict gs: - evict all GCP buckets from the cluster;
    21762176
    - evict gs://abc --prefix images/ - evict all gs://abc objects from the virtual subdirectory "images";
    21772177
    - evict gs://abc/images/ - same as above;
    2178+
    - evict gs://abc/images/ --nr - same as above, but do not recurse into virtual subdirs;
    21782179
    - evict gs://abc --template images/ - same as above;
    21792180
    - evict gs://abc --template "shard-{0000..9999}.tar.lz4" - evict the matching range (prefix + brace expansion);
    2180-
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (note the double quotes around the BUCKET/TEMPLATE argument)
    2181+
    - evict "gs://abc/shard-{0000..9999}.tar.lz4" - same as above (notice BUCKET/TEMPLATE argument in quotes)
    21812182
    21822183
    USAGE:
    21832184
    ais evict BUCKET[/OBJECT_NAME_or_TEMPLATE] [BUCKET[/OBJECT_NAME_or_TEMPLATE] ...] [command options]

    tools/client.go

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -237,7 +237,7 @@ func CleanupRemoteBucket(t *testing.T, proxyURL string, bck cmn.Bck, prefix stri
    237237
    }
    238238

    239239
    bp := BaseAPIParams(proxyURL)
    240-
    msg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: toDelete, Template: ""}}
    240+
    msg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: toDelete}}
    241241
    xid, err := api.DeleteMultiObj(bp, bck, msg)
    242242
    tassert.CheckFatal(t, err)
    243243
    args := xact.ArgsMsg{ID: xid, Kind: apc.ActDeleteObjects, Timeout: BucketCleanupTimeout}
    @@ -474,7 +474,7 @@ func BaseAPIParams(urls ...string) api.BaseParams {
    474474

    475475
    func EvictObjects(t *testing.T, proxyURL string, bck cmn.Bck, lst []string) {
    476476
    bp := BaseAPIParams(proxyURL)
    477-
    msg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: lst, Template: ""}}
    477+
    msg := &apc.EvdMsg{ListRange: apc.ListRange{ObjNames: lst}}
    478478
    xid, err := api.EvictMultiObj(bp, bck, msg)
    479479
    if err != nil {
    480480
    t.Errorf("Evict bucket %s failed: %v", bck.String(), err)

    xact/xreg/multiobj.go

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -13,7 +13,7 @@ func RenewPutArchive(bckFrom, bckTo *meta.Bck) RenewRes {
    1313
    return RenewBucketXact(apc.ActArchive, bckFrom, Args{Custom: bckTo}, bckFrom, bckTo)
    1414
    }
    1515

    16-
    func RenewEvictDelete(uuid, kind string, bck *meta.Bck, msg *apc.ListRange) RenewRes {
    16+
    func RenewEvictDelete(uuid, kind string, bck *meta.Bck, msg *apc.EvdMsg) RenewRes {
    1717
    return RenewBucketXact(kind, bck, Args{UUID: uuid, Custom: msg})
    1818
    }
    1919

    xact/xs/evict.go

    Lines changed: 8 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -23,7 +23,7 @@ type (
    2323
    evdFactory struct {
    2424
    xreg.RenewBase
    2525
    xctn *evictDelete
    26-
    msg *apc.ListRange
    26+
    msg *apc.EvdMsg
    2727
    kind string
    2828
    }
    2929
    evictDelete struct {
    @@ -49,7 +49,7 @@ func (p *evdFactory) New(args xreg.Args, bck *meta.Bck) xreg.Renewable {
    4949
    if p.kind == apc.ActEvictRemoteBck {
    5050
    return &evdFactory{RenewBase: xreg.RenewBase{Args: args, Bck: bck}, kind: p.kind}
    5151
    }
    52-
    msg := args.Custom.(*apc.ListRange)
    52+
    msg := args.Custom.(*apc.EvdMsg)
    5353
    debug.Assert(!msg.IsList() || !msg.HasTemplate())
    5454
    return &evdFactory{RenewBase: xreg.RenewBase{Args: args, Bck: bck}, kind: p.kind, msg: msg}
    5555
    }
    @@ -66,17 +66,19 @@ func (*evdFactory) WhenPrevIsRunning(xreg.Renewable) (xreg.WPR, error) {
    6666
    return xreg.WprKeepAndStartNew, nil
    6767
    }
    6868

    69-
    func newEvictDelete(xargs *xreg.Args, kind string, bck *meta.Bck, msg *apc.ListRange) (*evictDelete, error) {
    69+
    func newEvictDelete(xargs *xreg.Args, kind string, bck *meta.Bck, msg *apc.EvdMsg) (*evictDelete, error) {
    7070
    r := &evictDelete{config: cmn.GCO.Get()}
    7171
    if kind == apc.ActEvictRemoteBck {
    7272
    r.InitBase(xargs.UUID, kind, "" /*ctlmsg*/, bck)
    7373
    r.Finish()
    7474
    return r, nil
    7575
    }
    7676

    77-
    // default num-workers hardcoded
    78-
    // (currently, always num mountpaths)
    79-
    if err := r.lrit.init(r, msg, bck, 0 /*lsflags*/, nwpDflt, 0 /*burst*/); err != nil {
    77+
    var lsflags uint64
    78+
    if msg.NonRecurs {
    79+
    lsflags = apc.LsNoRecursion
    80+
    }
    81+
    if err := r.lrit.init(r, &msg.ListRange, bck, lsflags, msg.NumWorkers, 0 /*burst*/); err != nil {
    8082
    return nil, err
    8183
    }
    8284

    0 commit comments

    Comments
     (0)
    0