shell: faster bucket delete

avoid waiting for large object metadata
This commit is contained in:
Chris Lu 2021-07-23 11:25:43 -07:00
parent bdb632fa62
commit 092932af8f

View file

@ -1,8 +1,10 @@
package shell
import (
"context"
"flag"
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"io"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
@ -49,6 +51,17 @@ func (c *commandS3BucketDelete) Do(args []string, commandEnv *CommandEnv, writer
return fmt.Errorf("read buckets: %v", err)
}
// delete the collection directly first
err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {
_, err = client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{
Name: *bucketName,
})
return err
})
if err != nil {
return
}
return filer_pb.Remove(commandEnv, filerBucketsPath, *bucketName, false, true, true, false, nil)
}