From 5110fc03f14913e128b54a27f7680a7082d1bea3 Mon Sep 17 00:00:00 2001 From: Peter Portante Date: Thu, 18 Oct 2012 15:26:43 -0400 Subject: object-storage: Bump size of metadata stored per xattr key For Gluster, since we require XFS, and XFS has a max metadata value size of 64 KB, use the increased stored size to reduce the number of system calls, and how often we exit and enter the Python interpreter (via calls to pyxattr module). Today, with the hardcoded 254 byte limit per xattr key/value pair, adding a couple hundred bytes of user specified metadata can translate to up to three xattr key/value pairs (remember that the internal python metadata dictionary is pickled first and then stored in chunks in the keys). Change-Id: I6648106e8fac31f973ce207a6fecbcdab11fa271 BUG: 865493 Signed-off-by: Peter Portante Reviewed-on: http://review.gluster.org/4108 Reviewed-by: Mohammed Junaid Tested-by: Anand Avati --- swift/1.4.8/plugins/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py index 7a67c1cb..61112c8c 100644 --- a/swift/1.4.8/plugins/utils.py +++ b/swift/1.4.8/plugins/utils.py @@ -36,6 +36,7 @@ DIR_TYPE = 'application/directory' ACCOUNT = 'Account' MOUNT_PATH = '/mnt/gluster-object' METADATA_KEY = 'user.swift.metadata' +MAX_XATTR_SIZE = 65536 CONTAINER = 'container' DIR = 'dir' MARKER_DIR = 'marker_dir' @@ -221,11 +222,11 @@ def write_metadata(path, metadata): key = 0 while metastr: try: - xattr.set(path, '%s%s' % (METADATA_KEY, key or ''), metastr[:254]) + xattr.set(path, '%s%s' % (METADATA_KEY, key or ''), metastr[:MAX_XATTR_SIZE]) except IOError as err: logging.exception("xattr.set failed on %s key %s err: %s", path, key, str(err)) raise - metastr = metastr[254:] + metastr = metastr[MAX_XATTR_SIZE:] key += 1 def clean_metadata(path): -- cgit