From ae53f636804e41c2c7a0817e8f35434a00b6eacb Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 11 Sep 2019 20:26:20 -0700 Subject: filer: recursive deletion optionally ignoring any errors fix https://github.com/chrislusf/seaweedfs/issues/1062 --- other/java/client/src/main/java/seaweedfs/client/FilerClient.java | 8 +++++--- other/java/client/src/main/proto/filer.proto | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'other/java/client/src') diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java index 1ea4cb889..a1e3cdb89 100644 --- a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java +++ b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java @@ -70,7 +70,7 @@ public class FilerClient { } - public boolean rm(String path, boolean isRecursive) { + public boolean rm(String path, boolean isRecursive, boolean ignoreRecusiveError) { Path pathObject = Paths.get(path); String parent = pathObject.getParent().toString(); @@ -80,7 +80,8 @@ public class FilerClient { parent, name, true, - isRecursive); + isRecursive, + ignoreRecusiveError); } public boolean touch(String path, int mode) { @@ -229,13 +230,14 @@ public class FilerClient { return true; } - public boolean deleteEntry(String parent, String entryName, boolean isDeleteFileChunk, boolean isRecursive) { + public boolean deleteEntry(String parent, String entryName, boolean isDeleteFileChunk, boolean isRecursive, boolean ignoreRecusiveError) { try { filerGrpcClient.getBlockingStub().deleteEntry(FilerProto.DeleteEntryRequest.newBuilder() .setDirectory(parent) .setName(entryName) .setIsDeleteData(isDeleteFileChunk) .setIsRecursive(isRecursive) + .setIgnoreRecursiveError(ignoreRecusiveError) .build()); } catch (Exception e) { LOG.warn("deleteEntry {}/{}: {}", parent, entryName, e); diff --git a/other/java/client/src/main/proto/filer.proto b/other/java/client/src/main/proto/filer.proto index d72bced12..18ccca44f 100644 --- a/other/java/client/src/main/proto/filer.proto +++ b/other/java/client/src/main/proto/filer.proto @@ -141,6 +141,7 @@ message DeleteEntryRequest { // bool is_directory = 3; bool is_delete_data = 4; bool is_recursive = 5; + bool ignore_recursive_error = 6; } message DeleteEntryResponse { -- cgit v1.2.3