diff options
author | Prashanth Pai <ppai@redhat.com> | 2016-03-18 18:09:46 +0530 |
---|---|---|
committer | Thiago da Silva <thiago@redhat.com> | 2016-04-15 05:27:54 -0700 |
commit | 2bd696e392e420a2521dcca0b8613122d8169025 (patch) | |
tree | 9cd42e35957c0df07696e160f357019fde78c2d4 /gluster/swift/common | |
parent | 43da7927560811c55838a6a1c2d0ee1a52aada40 (diff) |
Enhance object expiration
This change re-introduces object expiration feature with some internal
differences from earlier implementation such as:
* Creation of zero-byte tracker object is performed directly on the
mount point. Earlier HTTP request was sent to object server
for the same. This incurred overhead of metadata creation for
these zero-byte files which isn't necessarry as all required
information is encoded in the path itself.
* Crawling of zero-byte tracker objects is done by the object
expirer daemon itself and not container server.
* Deletion of tracker object is performed by the object expiration daemon
directly on mount point.
Deletion of actual data object is not carried out by object expiration
daemon directly. The object expirer sends a DELETE request to object
server which deletes the actual object. This behaviour is not changed.
There is no change in behaviour in comparison with older implementation.
This is asserted by re-enabling existing functional tests without
any changes.
Change-Id: I01dc77cc4db3be3147d54e3aa2a19ed182498900
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Reviewed-on: http://review.gluster.org/13913
Reviewed-by: Thiago da Silva <thiago@redhat.com>
Tested-by: Thiago da Silva <thiago@redhat.com>
Diffstat (limited to 'gluster/swift/common')
-rw-r--r-- | gluster/swift/common/DiskDir.py | 2 | ||||
-rw-r--r-- | gluster/swift/common/utils.py | 27 |
2 files changed, 15 insertions, 14 deletions
diff --git a/gluster/swift/common/DiskDir.py b/gluster/swift/common/DiskDir.py index 36504a6..d314a1f 100644 --- a/gluster/swift/common/DiskDir.py +++ b/gluster/swift/common/DiskDir.py @@ -559,7 +559,7 @@ class DiskDir(DiskCommon): self.metadata[X_PUT_TIMESTAMP] = (timestamp, 0) write_metadata(self.datadir, self.metadata) - def delete_object(self, name, timestamp): + def delete_object(self, name, timestamp, obj_policy_index): # NOOP - should never be called since object file removal occurs # within a directory implicitly. return diff --git a/gluster/swift/common/utils.py b/gluster/swift/common/utils.py index 8958717..1bbc56c 100644 --- a/gluster/swift/common/utils.py +++ b/gluster/swift/common/utils.py @@ -556,7 +556,7 @@ def dir_is_object(metadata): return metadata.get(X_OBJECT_TYPE, "") == DIR_OBJECT -def rmobjdir(dir_path): +def rmobjdir(dir_path, marker_dir_check=True): """ Removes the directory as long as there are no objects stored in it. This works for containers also. @@ -580,18 +580,19 @@ def rmobjdir(dir_path): for directory in dirs: fullpath = os.path.join(path, directory) - try: - metadata = read_metadata(fullpath) - except GlusterFileSystemIOError as err: - if err.errno in (errno.ENOENT, errno.ESTALE): - # Ignore removal from another entity. - continue - raise - else: - if dir_is_object(metadata): - # Wait, this is an object created by the caller - # We cannot delete - return False + if marker_dir_check: + try: + metadata = read_metadata(fullpath) + except GlusterFileSystemIOError as err: + if err.errno in (errno.ENOENT, errno.ESTALE): + # Ignore removal from another entity. + continue + raise + else: + if dir_is_object(metadata): + # Wait, this is an object created by the caller + # We cannot delete + return False # Directory is not an object created by the caller # so we can go ahead and delete it. |