Browse Source

shell: faster bucket delete

avoid waiting for large object metadata
pull/2218/head
Chris Lu 3 years ago
parent
commit
092932af8f
  1. 13
      weed/shell/command_s3_bucket_delete.go

13
weed/shell/command_s3_bucket_delete.go

@ -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)
}
Loading…
Cancel
Save