Versioned Writes drops SLO bytes on overwrite

Bug #1840322 reported by clayg
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Nguyen Quoc Viet

Bug Description

When you upload a SLO, the large object bytes appears in the container listing instead of the manifest content-length. When a SLO manifest is overwritten in a container with object versioning enabled I expect the SLO bytes to be in the archive listing and propagate to the versioned container on restore.

Start with an SLO in a versioned container:

vagrant@saio:~$ swift stat test
               Account: AUTH_test
             Container: test
               Objects: 1
                 Bytes: 2694
              Read ACL:
             Write ACL:
               Sync To:
              Sync Key:
         Accept-Ranges: bytes
      X-Storage-Policy: default
         Last-Modified: Thu, 15 Aug 2019 17:13:04 GMT
           X-Timestamp: 1565889176.36183
            X-Trans-Id: txbb7e893472d84dfaa3862-005d5592a9
X-Openstack-Request-Id: txbb7e893472d84dfaa3862-005d5592a9
          Content-Type: application/json; charset=utf-8
   X-Versions-Location: test+versions
vagrant@saio:~$ swift list test --json
[
  {
    "bytes": 10485760,
    "content_type": "application/octet-stream",
    "hash": "651f14b53ec23025fbcc426f860bf4a7",
    "last_modified": "2019-08-15T17:12:57.362600",
    "name": "big.test",
    "slo_etag": "\"71e938d37c1d06dc634dd24660255a88\""
  }
]

When you overwrite the archived copy looses the swift_bytes information:

vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk43fa244bb79e4b94bd20a2360d65445a' http://saio:8080/v1/AUTH_test/test/big.test -XPUT --data ''
vagrant@saio:~$ swift list test+versions --json
[
  {
    "bytes": 2694,
    "content_type": "application/octet-stream",
    "hash": "651f14b53ec23025fbcc426f860bf4a7",
    "last_modified": "2019-08-15T17:13:59.185120",
    "name": "008big.test/1565889177.36260",
    "slo_etag": "\"71e938d37c1d06dc634dd24660255a88\""
  }
]

Even though the object still has the correct Content-Length the large object bytes won't come back on restore:

vagrant@saio:~$ swift stat test+versions 008big.test/1565889177.36260
               Account: AUTH_test
             Container: test+versions
                Object: 008big.test/1565889177.36260
          Content Type: application/octet-stream
        Content Length: 10485760
         Last Modified: Thu, 15 Aug 2019 17:14:00 GMT
                  ETag: "71e938d37c1d06dc634dd24660255a88"
            Meta Mtime: 1563465570.324261
         Accept-Ranges: bytes
           X-Timestamp: 1565889239.18512
            X-Trans-Id: tx2e9cd20535ab4c74923b5-005d559307
 X-Static-Large-Object: True
X-Openstack-Request-Id: tx2e9cd20535ab4c74923b5-005d559307
vagrant@saio:~$ swift delete test big.test
big.test
vagrant@saio:~$ swift list test --json
[
  {
    "bytes": 2694,
    "content_type": "application/octet-stream",
    "hash": "651f14b53ec23025fbcc426f860bf4a7",
    "last_modified": "2019-08-15T17:15:03.913170",
    "name": "big.test",
    "slo_etag": "\"71e938d37c1d06dc634dd24660255a88\""
  }
]

Changed in swift:
assignee: nobody → Nguyen Quoc Viet (axblueblader)
status: New → In Progress
Changed in swift:
status: In Progress → Confirmed
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.opendev.org/681639

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/681656

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Nguyen Quoc Viet (<email address hidden>) on branch: master
Review: https://review.opendev.org/681639
Reason: failed tests

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

Reviewed: https://review.opendev.org/681656
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=b4288b4aa6e6be2222f5f0e9ca8360c07040d5c0
Submitter: Zuul
Branch: master

commit b4288b4aa6e6be2222f5f0e9ca8360c07040d5c0
Author: Nguyen Quoc Viet <email address hidden>
Date: Thu Sep 12 11:31:42 2019 +0700

    versioned_writes: checks for SLO object before copy

    Previously, versioned_writes middleware copy an already existing
    object using PUT. However, SLO requires the additional query
    to properly update the object size when listing.

    Propose fix: In _put_versioned_obj - which is called when on
    creating version obj and also on restoring obj,
    if 'X-Object-Sysmeta-Slo-Size' header is present it will
    add needed headers for container to update obj size

    Added a new functional test case with size assertion for slo

    Change-Id: I47e0663e67daea8f1cf4eaf3c47e7c8429fd81bc
    Closes-Bug: #1840322

Changed in swift:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.23.0

This issue was fixed in the openstack/swift 2.23.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (feature/losf)

Fix proposed to branch: feature/losf
Review: https://review.opendev.org/686864

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (feature/losf)
Download full text (26.4 KiB)

Reviewed: https://review.opendev.org/686864
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=bfa8e9feb51f2b10adfec3a741661a76fcf73216
Submitter: Zuul
Branch: feature/losf

commit cb76e00e90aea834c8f3dd8a6ca5131acd43663b
Author: OpenStack Proposal Bot <email address hidden>
Date: Fri Oct 4 07:05:07 2019 +0000

    Imported Translations from Zanata

    For more information about this automatic import see:
    https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

    Change-Id: I40ce1d36f1c207a0d3e99a3a84a162b21b3c57cf

commit 527a57ffcdefc03a5080b07d63f0ded319e08dfe
Author: OpenStack Release Bot <email address hidden>
Date: Thu Oct 3 16:35:36 2019 +0000

    Update master for stable/train

    Add file to the reno documentation build to show release notes for
    stable/train.

    Use pbr instruction to increment the minor version number
    automatically so that master versions are higher than the versions on
    stable/train.

    Change-Id: Ia93e0b690f47c6231423a25dfd6a108a60378a21
    Sem-Ver: feature

commit 8a4becb12fbe3d4988ddee73536673d6f55682dd
Author: Tim Burke <email address hidden>
Date: Fri Sep 27 15:18:59 2019 -0700

    Authors/changelog for 2.23.0

    Also, make some CHANGELOG formatting more consistent.

    Change-Id: I380ee50e075a8676590e755f24a3fd7a7a331029

commit bf9346d88de2aeb06da3b2cde62ffa6200936367
Author: Tim Burke <email address hidden>
Date: Thu Aug 15 14:33:06 2019 -0700

    Fix some request-smuggling vectors on py3

    A Python 3 bug causes us to abort header parsing in some cases. We
    mostly worked around that in the related change, but that was *after*
    eventlet used the parsed headers to determine things like message
    framing. As a result, a client sending a malformed request (for example,
    sending both Content-Length *and* Transfer-Encoding: chunked headers)
    might have that request parsed properly and authorized by a proxy-server
    running Python 2, but the proxy-to-backend request could get misparsed
    if the backend is running Python 3. As a result, the single client
    request could be interpretted as multiple requests by an object server,
    only the first of which was properly authorized at the proxy.

    Now, after we find and parse additional headers that weren't parsed by
    Python, fix up eventlet's wsgi.input to reflect the message framing we
    expect given the complete set of headers. As an added precaution, if the
    client included Transfer-Encoding: chunked *and* a Content-Length,
    ensure that the Content-Length is not forwarded to the backend.

    Change-Id: I70c125df70b2a703de44662adc66f740cc79c7a9
    Related-Change: I0f03c211f35a9a49e047a5718a9907b515ca88d7
    Closes-Bug: 1840507

commit 0217b12b6d7d6f3727a54db65614ff1ef52d6286
Author: Matthew Oliver <email address hidden>
Date: Wed Sep 4 14:30:33 2019 +1000

    PDF Documentation Build tox target

    This patch adds a `pdf-docs` tox target that will build
    PDF versions of our docs. As per the Train community goal:

      https://governance.openstack.org/tc/goals/selected/train/pdf-doc-...

tags: added: in-feature-losf
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/689568

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

Reviewed: https://review.opendev.org/689568
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=a556c2b5f739db863c1bcb8cea2dc6c31144ff13
Submitter: Zuul
Branch: stable/stein

commit a556c2b5f739db863c1bcb8cea2dc6c31144ff13
Author: Nguyen Quoc Viet <email address hidden>
Date: Thu Sep 12 11:31:42 2019 +0700

    versioned_writes: checks for SLO object before copy

    Previously, versioned_writes middleware copy an already existing
    object using PUT. However, SLO requires the additional query
    to properly update the object size when listing.

    Propose fix: In _put_versioned_obj - which is called when on
    creating version obj and also on restoring obj,
    if 'X-Object-Sysmeta-Slo-Size' header is present it will
    add needed headers for container to update obj size

    Added a new functional test case with size assertion for slo

    Change-Id: I47e0663e67daea8f1cf4eaf3c47e7c8429fd81bc
    Closes-Bug: #1840322
    (cherry picked from commit b4288b4aa6e6be2222f5f0e9ca8360c07040d5c0)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/690739

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

Reviewed: https://review.opendev.org/690739
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=f68bbae9ced96bdde2a3f2d19d343e6f71073f52
Submitter: Zuul
Branch: stable/rocky

commit f68bbae9ced96bdde2a3f2d19d343e6f71073f52
Author: Nguyen Quoc Viet <email address hidden>
Date: Thu Sep 12 11:31:42 2019 +0700

    versioned_writes: checks for SLO object before copy

    Previously, versioned_writes middleware copy an already existing
    object using PUT. However, SLO requires the additional query
    to properly update the object size when listing.

    Propose fix: In _put_versioned_obj - which is called when on
    creating version obj and also on restoring obj,
    if 'X-Object-Sysmeta-Slo-Size' header is present it will
    add needed headers for container to update obj size

    Added a new functional test case with size assertion for slo

    Change-Id: I47e0663e67daea8f1cf4eaf3c47e7c8429fd81bc
    Closes-Bug: #1840322
    (cherry picked from commit b4288b4aa6e6be2222f5f0e9ca8360c07040d5c0)
    (cherry picked from commit a556c2b5f739db863c1bcb8cea2dc6c31144ff13)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.19.2

This issue was fixed in the openstack/swift 2.19.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.21.1

This issue was fixed in the openstack/swift 2.21.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Tim Burke (<email address hidden>) on branch: master
Review: https://review.opendev.org/633857
Reason: Abandoned in favor of https://review.opendev.org/#/c/682382/

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.