You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@druid.apache.org by gi...@apache.org on 2018/07/09 18:22:56 UTC

[incubator-druid] branch 0.12.2 updated: Allow GCS data segment killer to delete if present (#5675) (#5964)

This is an automated email from the ASF dual-hosted git repository.

gian pushed a commit to branch 0.12.2
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.12.2 by this push:
     new bc096e8  Allow GCS data segment killer to delete if present (#5675) (#5964)
bc096e8 is described below

commit bc096e862b483a53b4f7c39bef2594ea0d601892
Author: Jihoon Son <ji...@apache.org>
AuthorDate: Mon Jul 9 11:22:53 2018 -0700

    Allow GCS data segment killer to delete if present (#5675) (#5964)
---
 .../druid/storage/google/GoogleDataSegmentKiller.java  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java
index b7fbdc1..2285fbd 100644
--- a/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java
+++ b/extensions-contrib/google-extensions/src/main/java/io/druid/storage/google/GoogleDataSegmentKiller.java
@@ -19,6 +19,7 @@
 
 package io.druid.storage.google;
 
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
 import com.google.inject.Inject;
 import io.druid.java.util.common.MapUtils;
 import io.druid.java.util.common.logger.Logger;
@@ -52,14 +53,27 @@ public class GoogleDataSegmentKiller implements DataSegmentKiller
     final String descriptorPath = indexPath.substring(0, indexPath.lastIndexOf("/")) + "/descriptor.json";
 
     try {
-      storage.delete(bucket, indexPath);
-      storage.delete(bucket, descriptorPath);
+      deleteIfPresent(bucket, indexPath);
+      deleteIfPresent(bucket, descriptorPath);
     }
     catch (IOException e) {
       throw new SegmentLoadingException(e, "Couldn't kill segment[%s]: [%s]", segment.getIdentifier(), e.getMessage());
     }
   }
 
+  private void deleteIfPresent(String bucket, String path) throws IOException
+  {
+    try {
+      storage.delete(bucket, path);
+    }
+    catch (GoogleJsonResponseException e) {
+      if (e.getStatusCode() != 404) {
+        throw e;
+      }
+      LOG.debug("Already deleted: [%s] [%s]", bucket, path);
+    }
+  }
+
   @Override
   public void killAll() throws IOException
   {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@druid.apache.org
For additional commands, e-mail: dev-help@druid.apache.org