object metadata not updated when file modified from file interface

Bug #1416720 reported by Bill Owen
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Committed
Bill Owen

Bug Description

1. Create a file from the file interface or from the object interface
2. initially file downloads correctly with curl or swift client
3. modify the file on the file side by appending to the end of the file, for example "echo test >> obj.txt". This leaves the swift xattrs unchanged, but they are now showing the wrong size and etag.
4. download the file - the appended data is not downloaded. This is because content-length in the http request is set to the original size, so only the original N bytes of the file are downloaded. The etag for those bytes is correct still, so no message is logged by swift client.
5. modify the file by re-writing it to be shorter than the original object, without modifying the xattrs. For example, "echo t > obj.txt".
6. download hangs because content-length header is still set to the original size, and get request hangs waiting for content-length bytes to be delivered.
7. modify the file again by appending to it so that it's now longer than the original size, for example "date >> obj.txt", repeated until file length is larger than original object length stored in metadata.
8. download using curl successfully downloads the first N bytes of the object data, but etag is not correct (but not checked on the server side). The extra bytes are not downloaded.
9. download using swift client. The first N bytes of the object data are successfully downloaded, but the swift client logs a message about etag mismatch.
10. modify the file by so that xattrs are wiped out (for example, vi & save the file).
    download returns the correct object data because new xattrs are calculated based on file contents in this case.

I think utils.validate_object should also check object size and etag

Prashanth Pai (ppai)
Changed in swiftonfile:
status: New → Confirmed
importance: Undecided → Medium
Prashanth Pai (ppai)
Changed in swiftonfile:
assignee: nobody → Bill Owen (billowen)
Changed in swiftonfile:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swiftonfile (master)

Change abandoned by Prashanth Pai (<email address hidden>) on branch: master
Review: https://review.openstack.org/151897
Reason: This change will be broken down into multiple smaller changes.

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

Reviewed: https://review.openstack.org/228825
Committed: https://git.openstack.org/cgit/stackforge/swiftonfile/commit/?id=3083d14aff2588f53994bb693fd9f54c801b99c4
Submitter: Jenkins
Branch: master

commit 3083d14aff2588f53994bb693fd9f54c801b99c4
Author: Prashanth Pai <email address hidden>
Date: Tue Sep 29 15:41:02 2015 +0530

    Fix inconsistent data being returned on GET

    This is a manual forward-port of the following change merged into
    icehouse branch: https://review.openstack.org/215119

    When content of an object is modified from filesystem interface, a GET
    on the object will return inconsistent or incomplete content because the
    content length originally stored as metadata no longer reflects the
    actual length of the file after modification.

    The complete fix will have two parts:
    (1) Return the entire content of object as is to the client
    (2) The Etag returned should reflect the actual md5sum of object content

    This change only fixes (1) mentioned above. This means, the client will
    always get the complete content of the file.

    Fix (2) is not part of this change. This means, if content length of the
    object remains same even after modification, the Etag returned would be
    incorrect. Fixing (2) involves more invasive changes in the code. So
    that is deferred for now and will be sent as a separate change later.


    Change-Id: I28d0ec33c59eb520be7d15a60adb968692226e3e
    Closes-Bug: #1416720
    Signed-off-by: Prashanth Pai <email address hidden>

Changed in swiftonfile:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers