return x-backend-storage-policy-index header from object server

Bug #1634382 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
In Progress
Wishlist
Christian Hugo

Bug Description

object server responses don't include the x-backend-storage-policy-index header:

ubuntu@saio:~$ curl -H 'x-backend-storage-policy-index: 0' http://localhost:6020/sdb2/767/AUTH_test/test/awesome -d test -XPUT -H 'content-length: 4' -H 'x-timestamp: 1476774837.92038' -v
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 6020 (#0)
> PUT /sdb2/767/AUTH_test/test/awesome HTTP/1.1
> Host: localhost:6020
> User-Agent: curl/7.47.0
> Accept: */*
> x-backend-storage-policy-index: 0
> content-length: 4
> x-timestamp: 1476774837.92038
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 4 out of 4 bytes
< HTTP/1.1 201 Created
< Etag: "098f6bcd4621d373cade4e832627b4f6"
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Date: Tue, 18 Oct 2016 07:16:53 GMT
<
* Connection #0 to host localhost left intact

ubuntu@saio:~$ curl -H 'x-backend-storage-policy-index: 0' http://localhost:6020/sdb2/767/AUTH_test/test/awesome -I
HTTP/1.1 200 OK
Content-Length: 5
X-Backend-Timestamp: 1476774837.92036
Content-Type: application/octet-stream
Last-Modified: Tue, 18 Oct 2016 07:13:58 GMT
Etag: "d8e8fca2dc0f896fd7cb4cb0031ba249"
X-Timestamp: 1476774837.92036
X-Backend-Data-Timestamp: 1476774837.92036
X-Backend-Durable-Timestamp: 1476774837.92036
X-Object-Meta-Mtime: 1474654846.291908
Date: Tue, 18 Oct 2016 07:14:33 GMT

... i think they could tho, and it would be helpful when debugging!

It's currently added to the response logging by looking in the request headers:

https://github.com/openstack/swift/blob/a79d8508df493d5744b262e1d1830782e32dbd04/swift/common/utils.py#L505

Changed in swift:
assignee: nobody → Christian Hugo (christianhugo)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.openstack.org/394210

Changed in swift:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/394212

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

Change abandoned by Christian Hugo (<email address hidden>) on branch: master
Review: https://review.openstack.org/394210
Reason: Please ignore this change. I made two changes for the same commit.

This one
https://review.openstack.org/#/c/394212/
is right.

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

Clay,

As a client, don't you have to specify the policy? I.e., the

 -H 'x-backend-storage-policy-index: 0'

from your curl example above. And if you don't specify one, it just defaults to 0, right?

I'm not necessarily *opposed*, it just seems a little silly to mirror back a value that's expected to be sent by the client. Maybe sending back the *name* would be more interesting?

Revision history for this message
clayg (clay-gerrard) wrote :

well, the client doesn't *have* to send it - and sometimes I forget - so when looking at the response it does seem (to me) like it would be helpful to have it in there (maybe just to remind me I need to set it when I wanna talk to the storage node about a non-legacy policy)

if you use the name instead of the index - i think I'd mostly just have to disambiguate back to index

I think the object server also has the habit of being somewhat liberal in what it will accept:

ubuntu@saio:~$ curl localhost:6010/sdb1/645/AUTH_test/test/test -H 'x-backend-storgae-policy-index: 1' -v
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 6010 (#0)
> GET /sdb1/645/AUTH_test/test/test HTTP/1.1
> Host: localhost:6010
> User-Agent: curl/7.47.0
> Accept: */*
> x-backend-storgae-policy-index: 1
>
< HTTP/1.1 200 OK
< Content-Length: 8
< X-Backend-Timestamp: 1483570008.12156
< Content-Type: application/octet-stream
< Last-Modified: Wed, 04 Jan 2017 22:46:49 GMT
< Etag: "70c1db56f301c9e337b0099bd4174b28"
< X-Timestamp: 1483570008.12156
< X-Backend-Data-Timestamp: 1483570008.12156
< X-Backend-Durable-Timestamp: 1483570008.12156
< X-Object-Meta-Mtime: 1477644597.056231
< Date: Wed, 04 Jan 2017 22:49:41 GMT
<
awesome
* Connection #0 to host localhost left intact
ubuntu@saio:~$ tail -n2 /var/log/syslog | head -n1
Jan 4 22:49:41 saio object-6010: 127.0.0.1 - - [04/Jan/2017:22:49:41 +0000] "GET /sdb1/645/AUTH_test/test/test" 200 8 "-" "-" "curl/7.47.0" 0.0014 "-" 7282 -

^ note that response is from 0 - but the log just says - and the client thinks they asked for 1

... so again being explicit about what policy is being responded from (and bonus if we log that) seems helpful for debugging.

clayg (clay-gerrard)
Changed in swift:
status: In Progress → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to swift (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/749400

Revision history for this message
clayg (clay-gerrard) wrote :

There was some problems in attempting to add this at the proxy layer, it might not be such a great idea.

Changed in swift:
status: Confirmed → Opinion
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/749400

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

Change abandoned by "Tim Burke <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/swift/+/693893
Reason: See https://review.opendev.org/c/openstack/swift/+/898783 for a more recent take on the problem

Changed in swift:
status: Opinion → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by "Tim Burke <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/swift/+/394212
Reason: See https://review.opendev.org/c/openstack/swift/+/693893 for a rolling-upgrade problem, and https://review.opendev.org/c/openstack/swift/+/898783 for a more recent take on the problem

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.