A status in a container db is not updated when re-putting to a deleted container

Bug #1415491 reported by Takashi Kajinami
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
In Progress
Undecided
HCLTech-SSW

Bug Description

Status in container db is set as 'deleted' when we delete the container, but never get updated when we re-put the container.

1) PUT a container
kajinamit@swift-dev:~/swift$ curl -v -X PUT -H "X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d" http://127.0.0.1:8080/v1/AUTH_test/test
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PUT /v1/AUTH_test/test HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d
>
< HTTP/1.1 201 Created
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
< X-Trans-Id: tx480fcda9884a4ff3a6632-0054c63bcd
< Date: Mon, 26 Jan 2015 13:06:21 GMT
<
* Connection #0 to host 127.0.0.1 left intact

Now, a container db is created.
kajinamit@swift-dev:~/swift$ sqlite3 /srv/1/node/sdb1/containers/450/afd/7089ab48d955ab0851fc51cc17a34afd/7089ab48d955ab0851fc51cc17a34afd.db "select * from container_stat"
AUTH_test|test|1422277581.83264|1422277581.82686|0|1422277581.82686|0|0|0|00000000000000000000000000000000|5064fa14-cd90-4f2e-b508-10636b583354||1422277581.82686||-1|-1|-1|0|0|0

2) DELETE the container
kajinamit@swift-dev:~/swift$ curl -v -X DELETE -H "X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d" http://127.0.0.1:8080/v1/AUTH_test/test
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> DELETE /v1/AUTH_test/test HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d
>
< HTTP/1.1 204 No Content
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
< X-Trans-Id: tx86a011aeef724baebdec3-0054c63bfd
< Date: Mon, 26 Jan 2015 13:07:09 GMT
<
* Connection #0 to host 127.0.0.1 left intact

Now, a status in the container db is marked as 'DELETED.'
kajinamit@swift-dev:~/swift$ sqlite3 /srv/1/node/sdb1/containers/450/afd/7089ab48d955ab0851fc51cc17a34afd/7089ab48d955ab0851fc51cc17a34afd.db "select * from container_stat"
AUTH_test|test|1422277581.83264|1422277581.82686|1422277629.77809|1422277581.82686|0|0|0|00000000000000000000000000000000|5064fa14-cd90-4f2e-b508-10636b583354|DELETED|1422277629.77809||-1|-1|-1|0|0|0

3) Re-PUT the container
kajinamit@swift-dev:~/swift$ curl -v -X PUT -H "X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d" http://127.0.0.1:8080/v1/AUTH_test/test
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PUT /v1/AUTH_test/test HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> X-Storage-Token:AUTH_tke2cecc444bee4ef69ae244472639b17d
>
< HTTP/1.1 201 Created
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
< X-Trans-Id: txd71c48619def417fa80ef-0054c63c03
< Date: Mon, 26 Jan 2015 13:07:15 GMT
<
* Connection #0 to host 127.0.0.1 left intact

Now, the timestamps in the container db get updated, but its status is still 'DELETED.'
kajinamit@swift-dev:~/swift$ sqlite3 /srv/1/node/sdb1/containers/450/afd/7089ab48d955ab0851fc51cc17a34afd/7089ab48d955ab0851fc51cc17a34afd.db "select * from container_stat"
AUTH_test|test|1422277581.83264|1422277635.83017|1422277629.77809|1422277581.82686|0|0|0|00000000000000000000000000000000|5064fa14-cd90-4f2e-b508-10636b583354|DELETED|1422277635.83017||-1|-1|-1|0|0|0

This doesn't matter when we think about swift's behavior, because swift judges deleted containers only by timestamps, but It is confusing that we have an invalid and inappropriate value in db files.

Revision history for this message
Takashi Kajinami (kajinamit) wrote :

I also found that a status in account/container db is not replicated by db-replicator, and this may cause some problems like the following bug.
<<https://bugs.launchpad.net/swift/+bug/1304755>>
I know this is not in so high priority but I think we have to rethink how to handle deleted status of accounts/containers.

Changed in swift:
assignee: nobody → HCLTech-SSW (hcltech-ssw)
status: New → In Progress
Revision history for this message
HCLTech-SSW (hcltech-ssw) wrote :

As we assume here that container undelete feature you needed here?

Revision history for this message
HCLTech-SSW (hcltech-ssw) wrote :

Any update?

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.