CreationDate in the s3api list-buckets output is constant

Bug #1856938 reported by Bhaskar Singhal
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Confirmed
Medium
Unassigned

Bug Description

I created few buckets on a swift-rocky cluster using aws s3api create-bucket

aws s3api --endpoint-url=https://xxxxxxxxxxxxxxxx:443 create-bucket --bucket bucket1
{
    "Location": "/bucket1"
}
aws s3api --endpoint-url=https://xxxxxxxxxxxxxxxx:443 create-bucket --bucket bucket2
{
    "Location": "/bucket2"
}
aws s3api --endpoint-url=https://xxxxxxxxxxxxxxxx:443 create-bucket --bucket bucket3
{
    "Location": "/bucket3"
}
aws s3api --endpoint-url=https://xxxxxxxxxxxxxxxx:443 create-bucket --bucket bucket4
{
    "Location": "/bucket4"
}

The output for list-buckets shows same/constant (very old) CreationDate.
aws s3api --endpoint-url=https://xxxxxxxxxxxxxx:443 list-buckets
{
    "Owner": {
        "DisplayName": "xxxxxxxxxxx",
        "ID": "xxxxxxxxxxxxx"
    },
    "Buckets": [
        {
            "CreationDate": "2009-02-03T16:45:09.000Z",
            "Name": "bucket1"
        },
        {
            "CreationDate": "2009-02-03T16:45:09.000Z",
            "Name": "bucket2"
        },
        {
            "CreationDate": "2009-02-03T16:45:09.000Z",
            "Name": "bucket3"
        },
        {
            "CreationDate": "2009-02-03T16:45:09.000Z",
            "Name": "bucket4"
        }
    ]
}

The CreationDate is hardcoded in the s3api service controller:
            SubElement(bucket, 'CreationDate').text = \
                '2009-02-03T16:45:09.000Z'

Any suggestion about how we can get the correct CreationDate?

The container table in the db only has put_timestamp which we overwrite after POST too.
sqlite> .schema container
CREATE TABLE container (
                ROWID INTEGER PRIMARY KEY AUTOINCREMENT,
                name TEXT,
                put_timestamp TEXT,
                delete_timestamp TEXT,
                object_count INTEGER,
                bytes_used INTEGER,
                deleted INTEGER DEFAULT 0,
                storage_policy_index INTEGER DEFAULT 0
            );
After creation:
35|bucket1|1576732835.31249|0|0|0|0|0
After post on bucket1:
39|bucket1|1576733551.17602|0|0|0|0|0

Tags: s3api
Revision history for this message
Tim Burke (1-tim-z) wrote :

Yeah -- I remember looking into it once, I have *no idea* where that date came from.

If we wanted to do it right, we'd probably have to pack multiple timestamps into the put_timestamp column, similar to what we do with the three timestamps objects have in the container DB:

sqlite> select created_at from object;
1576866812.89510+1481c3+1a6a31

Might want to look at https://github.com/openstack/swift/blob/master/swift/common/utils.py#L1375-L1460

Changed in swift:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.