path: root/.unittests
diff options
authorPeter Portante <>2012-10-18 15:34:57 -0400
committerPeter Portante <>2013-04-29 16:35:55 -0400
commitc61aea1464475923690cb6180cb0c484748de775 (patch)
tree461094dc01f6c5d94ab778f04d1e1182fb608fcc /.unittests
parenta3a03e0ed84433c4801a320a7a81c0baeaf7bc08 (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 for more details. See also 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 <> Reviewed-on: Reviewed-by: Kaleb KEITHLEY <> Reviewed-by: Jeff Darcy <> Tested-by: Anand Avati <>
Diffstat (limited to '.unittests')
1 files changed, 6 insertions, 0 deletions
diff --git a/.unittests b/.unittests
new file mode 100755
index 0000000..5be925d
--- /dev/null
+++ b/.unittests
@@ -0,0 +1,6 @@
+cd swift/1.4.8/test/unit
+nosetests --exe --with-coverage --cover-package plugins --cover-erase $@
+rm -f .coverage
+cd -