Jets3tNativeFileSystemStore wrongly calls S3Service.createBucket during 
initialisation
--------------------------------------------------------------------------------------

                 Key: HADOOP-6734
                 URL: https://issues.apache.org/jira/browse/HADOOP-6734
             Project: Hadoop Common
          Issue Type: Bug
          Components: fs/s3
    Affects Versions: 0.18.3
         Environment: S3 Europe
            Reporter: Joni Niemi


Reason: If a bucket is created with CreateBucketConfiguration specified, 
s3service.createBucket will fail. 
Symptoms: If a bucket has CreateBucketConfiguration, 
Jets3tNativeFileSystemStore will fail with BucketAlreadyOwnedByYou Error.

A detailed descrioption from a blog 
(http://john.keyes.ie/boto-create_bucket-bucketalreadyownedbyyou-error/)

{quote}This evening I encountered a problem with it though. When the bucket did 
not exist, the method behaved as expected. When the bucket did exist though I 
received the following error response:

{code}<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>BucketAlreadyOwnedByYou</Code>
    <Message>
        Your previous request to create the named 
        bucket succeeded and you already own it.
    </Message>
    ...
</Error>{code}

This problem only manifests itself with buckets that are hosted in the EU. If 
the bucket is created in the US then the create_bucket method behaves as 
described.

    For buckets created with a <CreateBucketConfiguration>, you will receive an 
error if you attempt to recreate the same bucket.

To create a bucket in the EU, the bucket is created with a 
CreateBucketConfiguration specified. I now use the following code to avoid the 
problem and it works for both US and EU buckets.

{code}
def get_bucket():
    try:
        bucket = conn.get_bucket('xxx', validate=True)
    except S3ResponseError, e:
        if e.code == "NoSuchBucket":
            bucket = conn.create_bucket('xxx', location='EU')
        else:
            raise e
    return bucket
{code}
{quote}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to