summaryrefslogtreecommitdiffstats
path: root/swift
diff options
context:
space:
mode:
authorPeter Portante <peter.portante@redhat.com>2012-10-18 15:26:43 -0400
committerAnand Avati <avati@redhat.com>2012-10-25 15:02:40 -0700
commit5110fc03f14913e128b54a27f7680a7082d1bea3 (patch)
tree2b43c403187da23b1d0a894771e63ac1235daa74 /swift
parentc7f7f134a7e2ee14d07d16d96c7849c6fd310693 (diff)
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 <peter.portante@redhat.com> Reviewed-on: http://review.gluster.org/4108 Reviewed-by: Mohammed Junaid <junaid@redhat.com> Tested-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'swift')
-rw-r--r--swift/1.4.8/plugins/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index 7a67c1cb695..61112c8c38f 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):