empty account listing inconsistent 204/200 reply with format=json
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
Critical
|
Samuel Merritt |
Bug Description
If you asked for json, swift used to always return 200 with a valid json message body on GET /AUTH_acct - now it returns 204 if the account is empty. I think the previous behavior of returning 200 with an empty json list "[]" was better/more correct. Regardless it's an API change and should probably be treated as a regression. For example it breaks swift3.
Unfortunately it's not a trivial fix, since there's no way to get the 200 out of the account servers' who were previously doing the light lifting of generating the valid json response unless you *actually* create the account. So I'ma guess we'll just have to add some accept-
This is unrelated, but I'll mention it because it sort of surprised me. Every time I GET an empty uncreated account - swift has to ask every backend device (and handoffs) before it will return the spoofed 204. Swift always did this on the first request to an empty account, except then it would auto-create it, so on the second request it would return 204 after one back-end request. So until something actually uses the account swift is sort of chatty, but a 404 is cheap, just surprising...
description: | updated |
Changed in swift: | |
assignee: | nobody → Samuel Merritt (torgomatic) |
Changed in swift: | |
milestone: | none → 1.9.0 |
Changed in swift: | |
status: | Fix Committed → Fix Released |
BEFORE (fd3acd2e594425 1b3a473d2936f33 f11101d56e4^ 1):
clayg@swift:~$ curl -H 'x-auth-token: AUTH_tk' http:// localhost/ v1/AUTH_ test?format= json -v test?format= json HTTP/1.1 pc-linux- gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 f71a4869a13df05 0e6e886e2 Bytes-Used: 0 Container- Count: 0 Object- Count: 0
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1... connected
> GET /v1/AUTH_
> User-Agent: curl/7.22.0 (x86_64-
> Host: localhost
> Accept: */*
> x-auth-token: AUTH_tk1652a904
>
< HTTP/1.1 200 OK
< Content-Length: 2
< Accept-Ranges: bytes
< X-Timestamp: 1369274744.48164
< X-Account-
< X-Account-
< Content-Type: application/json; charset=utf-8
< X-Account-
< Date: Thu, 23 May 2013 02:05:50 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0
[]
AFTER (master):
clayg@swift:~$ curl -H 'x-auth-token: AUTH_tk' http:// localhost/ v1/AUTH_ test?format= json -v test?format= json HTTP/1.1 pc-linux- gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 f71a4869a13df05 0e6e886e2 Bytes-Used: 0 Container- Count: 0 Object- Count: 0
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1... connected
> GET /v1/AUTH_
> User-Agent: curl/7.22.0 (x86_64-
> Host: localhost
> Accept: */*
> x-auth-token: AUTH_tk1652a904
>
< HTTP/1.1 204 No Content
< Content-Length: 0
< Accept-Ranges: bytes
< X-Timestamp: 1369274645.16959
< X-Account-
< X-Account-
< Content-Type: text/plain; charset=utf-8
< X-Account-
< Date: Thu, 23 May 2013 02:04:05 GMT
<
* Connection #0 to host localhost left intact
* Closing connection #0