count objects in account_stat

Asked by Kun Huang

I found that when adding or deleting an object, the table container_stat will be updated by the TRIGGER (https://github.com/openstack/swift/blob/master/swift/container/backend.py#L71). But I didn't find how account_stat is updated. In the similar place (https://github.com/openstack/swift/blob/master/swift/account/backend.py#L83), there are also some TRIGGER responding with adding or deleting a container, not the case of updating a container. So when an object is upload, the container_stat will be updated automatically, but account_stat will not. How and when is account_stat updated in Swift?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Samuel Merritt
Solved:
Last query:
Last reply:
Revision history for this message
Best Samuel Merritt (torgomatic) said :
#1

The container updater does this asynchronously.

If it were synchronous, the account database would rapidly become a bottleneck for concurrent object uploads. That's why it's async.

Revision history for this message
Kun Huang (academicgareth) said :
#2

Thanks, but I have a further question:

If I didn't run container-updater, the object count in "swift stat" should keep 0 (is it right?). But actually object count of account is updated from the second uploaded object. For example:

Uploading the 1st object, 'swift stat' says "object: 0, Bytes:0"
Uploading the 2nd object, 'swift stat' says "object: 1, Bytes: (size of 1st object)"
Uploading the 3rd object, 'swift stat' says "object: 2, Bytes: (size of 1st object and 2nd one)"

Is this normal?

Revision history for this message
Kun Huang (academicgareth) said :
#3

Thanks Samuel Merritt, that solved my question.