diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-10-18 15:34:57 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-10-25 15:03:10 -0700 |
commit | 1a013e3e78c0afa7f6c6d8de3826280779bd0f2d (patch) | |
tree | 7be8910851f9cadd4e5af0a37b428c77c0798456 /.unittests | |
parent | 5110fc03f14913e128b54a27f7680a7082d1bea3 (diff) |
object-storage: reduce the number of getxattr system calls by one
Initial step towards addressing BZ 865619.
Prior to the patch, reading metadata for a given object or container involves
at minimum three getxattr system calls for objects that use only one xattr
key/value pair:
1. (via pyxattr) getxattr() to see if key exists and get its value
length (so it can allocate memory for second call below)
2. (from pyxattr) getxattr() to get actual value data
3. (via pyxattr) getxattr() to see if following key exists
For objects and containers that only have to use one xattr key/value pair,
this patch reduces the number system calls by one. This can be significant
given that almost every Swift API operation requires reads of the object or
containers metadata.
This patch is mostly a change to plugins.utils.read_metadata() to try to
unpickle the accumulated metadata as each key/value pair is read, rather than
trying to accumulate all the key/value pairs and unpickle at the end. Once we
get enough data to form the pickle, we no longer keep trying to get more keys,
even if those keys exist.
The extra keys can exist when the size of the stored metadata shrinks below a
key threshold. See https://bugzilla.redhat.com/show_bug.cgi?id=865619 for more
details.
See also https://bugzilla.redhat.com/show_bug.cgi?id=865858.
This patch also adds a unit test infrastructure, and uses it to test with full
coverage, the read_metadata, write_metadata and clean_metadata functions. As a
result, we found that an infinite loop would occur in clean_metadata() when an
unexpected IOError would occur trying to remove a key (this patch contains a
fix).
Change-Id: Ia1838c5e73af453b65360c1c525824231aa7c5d4
BUG: 865619
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4109
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Anand Avati <avati@redhat.com>
Diffstat (limited to '.unittests')
-rwxr-xr-x | .unittests | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/.unittests b/.unittests new file mode 100755 index 00000000000..5be925d5829 --- /dev/null +++ b/.unittests @@ -0,0 +1,6 @@ +#!/bin/bash + +cd swift/1.4.8/test/unit +nosetests --exe --with-coverage --cover-package plugins --cover-erase $@ +rm -f .coverage +cd - |