Disable versioning failed

Bug #1107592 reported by Song Jie
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Medium
Kun Huang

Bug Description

Found in 1.7.5

---[ note from gholt ]---
I do believe there's a bug in that you can't send an "x-remove-versions-location: junk" header like you can with other headers as an alternative removal method.
---[ end note ]---

Enable object versioning as http://docs.openstack.org/developer/swift/overview_object_versioning.html described, everything function as it well. However the page doesn't mention how to disable versioning.

Examine container/server.py, it should be empty "X-Versions-Location" that can disable versioning, but it doesn't work. Add some debug log in container/server.py PUT method, when issue command
curl -XPUT -H 'X-Auth-Token: AUTH_tk1863c0dc78cd46689d954b14fb3b8b67' -H "X-Versions-Location:" http://127.0.0.1:8080/v1/AUTH_test/cont1, the dump is:

Jan 28 22:57:36 keystone container-server PETER: X-Timestamp : 1359385056.12792
Jan 28 22:57:36 keystone container-server PETER: X-Account-Host : 127.0.0.1:6042
Jan 28 22:57:36 keystone container-server PETER: X-Account-Device : sdb4
Jan 28 22:57:36 keystone container-server PETER: X-Account-Partition : 160771
Jan 28 22:57:36 keystone container-server PETER: Connection : close
Jan 28 22:57:36 keystone container-server PETER: X-Trans-Id : txff7dc43b64d84c958a7b1598b823c733
Jan 28 22:57:36 keystone container-server PETER: X-Versions-Location : versions
Jan 28 22:57:36 keystone container-server PETER: Host : 127.0.0.1:6011
Jan 28 22:57:36 keystone container-server PETER: Accept-Encoding : identity
Jan 28 22:57:36 keystone container-server PETER: Content-Type : None

Seems header "X-Versions-Location" is filtered in proxy controller, or am I using the wrong way to disable versioning, can someone tell me correct method.

Revision history for this message
Chuck Thier (cthier) wrote :

Object versioning is enabled cluster wide by having the following in the container server config file (as mentioned in the documentation):

allow_versions = True

If this is not set, then object versioning isn't available as a feature in the cluster.

Once a container is created with versioning enabled, it *can not* be disabled. The only way to do that would be to remove the objects in the container, and then delete and re-create the container.

Changed in swift:
status: New → Incomplete
status: Incomplete → Invalid
Revision history for this message
Sahdev Zala (spzala) wrote : AUTO: Sahdev P Zala is out of the office (returning 02/11/2013)

I am out of the office until 02/11/2013.

For any emergency, please contact my manager Johanna Koester.

Note: This is an automated response to your message "[Bug 1107592] Re:
Disable versioning failed" sent on 01/29/2013 9:49:25.

This is the only notification you will receive while this person is away.

Revision history for this message
Song Jie (nightelf1984) wrote :

It looks not reasonable, from user's perspective, he would expect disable versioning can be done in arbitrary time then overwrite cause no new versions. He may also expect enable versioning is the same story and from that point on, overwrite generates new versions... Of course allow_versions = True is the precondition cluster wide

Revision history for this message
gholt (gholt) wrote :

Actually, I turned off versioning for a container pretty easily using swiftly: https://github.com/gholt/swiftly

    $ swiftly put container -hx-versions-location:versions
    $ swiftly put versions
    $ echo '1234' | swiftly put container/object
    $ echo '1234' | swiftly put container/object
    $ swiftly get versions
    006object/1359521032.95926
    $ echo '1234' | swiftly put container/object
    $ swiftly get versions
    006object/1359521032.95926
    006object/1359521034.74558
    $ swiftly put container -hx-versions-location:
    $ echo '1234' | swiftly put container/object
    $ swiftly get versions
    006object/1359521032.95926
    006object/1359521034.74558

I think the problem you're having is that many curl versions do not support sending a header with no value. Instead, curl will just not send the header at all!

See https://answers.launchpad.net/swift/+question/209086

Revision history for this message
gholt (gholt) wrote :

I do believe there's a bug in that you can't send an "x-remove-versions-location: junk" header like you can with other headers as an alternative removal method.

description: updated
Changed in swift:
status: Invalid → Confirmed
Revision history for this message
Kun Huang (academicgareth) wrote :

That's feasible to implement a "x-remove-versions-location: junk"

Changed in swift:
importance: Undecided → Medium
Revision history for this message
Kun Huang (academicgareth) wrote :

I give my reply too earlier here.
We don't need implement something like x-remove-versions-location: junk.
To disable object versioning, post "X-Versions-Location:none" is ok.
In CLI, use swift post source_container -m "X-Versions-Location:"
In API, use curl -XPOST -H "X-Versions-Location;" some_url
All we should do it to mention it in documents.

Changed in swift:
assignee: nobody → Kun Huang (academicgareth)
status: Confirmed → In Progress
Revision history for this message
Samuel Merritt (torgomatic) wrote :

I disagree. Swift should support X-Remove-Versions-Location for consistency.

For example, one can set object metadata with "X-Object-Meta-Bert: ernie", and then remove it with either an empty "X-Object-Meta-Bert" header *or* by sending "X-Remove-Object-Meta-Bert: any-value".

The same applies to container ACLs (X-Container-Read, X-Container-Write) and just about everything else set via headers. To have this one oddball X-Versions-Location header that doesn't work that way is (IMHO) a bug.

Revision history for this message
Kun Huang (academicgareth) wrote :

Both kinds of support keep consistent.
Good reason for doing that, I change my review into in progress now.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/24096
Committed: http://github.com/openstack/swift/commit/5c3f75ba6adb160bb61431b77d399b123a2a7546
Submitter: Jenkins
Branch: master

commit 5c3f75ba6adb160bb61431b77d399b123a2a7546
Author: Kun Huang <email address hidden>
Date: Sun Mar 17 07:30:00 2013 +0800

    Add x-remove-versions-location for feature: disable versioning

    We can set x-versions-location empty to remove this header in API, but
    to keep consistent, we should allow x-remove-versions-location too. The
    usage is post "x-remove-versions-locaion: x", just like ACL remove
    headers.

    Fixed: bug #1107592

    Change-Id: I1271eec6401d4a0e8c1a7c2d63aeb8dfef00bf6d

Changed in swift:
status: In Progress → Fix Committed
Changed in swift:
milestone: none → 1.9.0
Thierry Carrez (ttx)
Changed in swift:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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