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>
This commit is contained in:
Peter Portante 2012-10-18 15:26:43 -04:00
parent a6a6f368b5
commit a3a03e0ed8

View File

@ -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):