From ae0e36f3ebf91aa66a45062c5a44ebd88d643b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Mon, 2 Jun 2014 15:42:55 -0700 Subject: [PATCH] warn glacier objects cannot be moved --- pom.xml | 9 ++++++++- .../io/druid/storage/s3/S3DataSegmentMover.java | 4 ++++ .../io/druid/storage/s3/S3StorageDruidModule.java | 5 ----- .../io/druid/storage/s3/S3DataSegmentMoverTest.java | 13 +++++++++++++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 2116d7f617f..1c9c5664e47 100644 --- a/pom.xml +++ b/pom.xml @@ -393,7 +393,14 @@ net.java.dev.jets3t jets3t - 0.9.0 + 0.9.1 + + + + com.centerkey.utils + barebonesbrowserlaunch + + org.apache.httpcomponents diff --git a/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentMover.java b/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentMover.java index d259ab185d2..ea585a0be44 100644 --- a/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentMover.java +++ b/s3-extensions/src/main/java/io/druid/storage/s3/S3DataSegmentMover.java @@ -120,6 +120,10 @@ public class S3DataSegmentMover implements DataSegmentMover if (s3Client.isObjectInBucket(s3Bucket, s3Path)) { if (s3Bucket.equals(targetS3Bucket) && s3Path.equals(targetS3Path)) { log.info("No need to move file[s3://%s/%s] onto itself", s3Bucket, s3Path); + } else if (s3Client.getObjectDetails(s3Bucket, s3Path) + .getStorageClass() + .equals(S3Object.STORAGE_CLASS_GLACIER)) { + log.warn("Cannot move file[s3://%s/%s] of storage class glacier."); } else { log.info( "Moving file[s3://%s/%s] to [s3://%s/%s]", diff --git a/s3-extensions/src/main/java/io/druid/storage/s3/S3StorageDruidModule.java b/s3-extensions/src/main/java/io/druid/storage/s3/S3StorageDruidModule.java index d30f49f976a..21faf74db91 100644 --- a/s3-extensions/src/main/java/io/druid/storage/s3/S3StorageDruidModule.java +++ b/s3-extensions/src/main/java/io/druid/storage/s3/S3StorageDruidModule.java @@ -73,11 +73,6 @@ public class S3StorageDruidModule implements DruidModule @LazySingleton public RestS3Service getRestS3Service(AWSCredentials credentials) { - try { return new RestS3Service(credentials); - } - catch (S3ServiceException e) { - throw new ProvisionException("Unable to create a RestS3Service", e); - } } } diff --git a/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java b/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java index c13d22de5f1..9497d9a05fc 100644 --- a/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java +++ b/s3-extensions/src/test/java/io/druid/storage/s3/S3DataSegmentMoverTest.java @@ -30,6 +30,7 @@ import io.druid.timeline.partition.NoneShardSpec; import org.jets3t.service.S3ServiceException; import org.jets3t.service.ServiceException; import org.jets3t.service.impl.rest.httpclient.RestS3Service; +import org.jets3t.service.model.S3Bucket; import org.jets3t.service.model.S3Object; import org.jets3t.service.model.StorageObject; import org.joda.time.Interval; @@ -131,6 +132,18 @@ public class S3DataSegmentMoverTest return (objects != null && objects.contains(objectKey)); } + @Override + public StorageObject getObjectDetails(String bucketName, String objectKey) throws ServiceException + { + if (isObjectInBucket(bucketName, objectKey)) { + final S3Object object = new S3Object(objectKey); + object.setStorageClass(S3Object.STORAGE_CLASS_STANDARD); + return object; + } else { + return null; + } + } + @Override public Map moveObject( String sourceBucketName,