Merge pull request #595 from metamx/s3-glacier-warn

warn glacier objects cannot be moved
This commit is contained in:
fjy 2014-06-10 12:24:26 -06:00
commit 0dbe432646
4 changed files with 25 additions and 6 deletions

View File

@ -393,7 +393,14 @@
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.9.0</version>
<version>0.9.1</version>
<exclusions>
<exclusion>
<!-- exclude artifact not available in maven central -->
<groupId>com.centerkey.utils</groupId>
<artifactId>barebonesbrowserlaunch</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>

View File

@ -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]",

View File

@ -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);
}
}
}

View File

@ -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<String, Object> moveObject(
String sourceBucketName,