Moved some HPSS-specific things from the ObjectServer into the DiskFile, where it belongs.

Also, fixed an issue with object uploads failing due to ETag calculation not keeping up.
This commit is contained in:
Phil Bridges 2016-03-18 12:02:41 -05:00
parent 2b7b787d56
commit ef2d07ea48
2 changed files with 13 additions and 13 deletions

View File

@ -397,18 +397,19 @@ class DiskFileWriter(object):
self.close() self.close()
# TODO: see if this is really the right way of getting the ETag # TODO: see if this is really the right way of getting the ETag
# TODO: add timeout in case we should end up never having an ETag
if not has_etag: if not has_etag:
sleep(.5)
try: try:
xattrs = xattr.xattr(df._data_file) etag = None
if 'system.hpss.hash' in xattrs: # We sit here and wait until hpssfs-cksum finishes calculating
etag = xattrs['system.hpss.hash'] # the checksum.
elif 'user.hash.checksum' in xattrs: while etag is None:
etag = xattrs['user.hash.checksum'] time.sleep(.25)
else: xattrs = xattr.xattr(df._data_file)
raise DiskFileError( if 'system.hpss.hash' in xattrs:
'ETag was not in HPSS xattrs for file %s' etag = xattrs['system.hpss.hash']
% df._data_file) elif 'user.hash.checksum' in xattrs:
etag = xattrs['user.hash.checksum']
metadata['ETag'] = etag metadata['ETag'] = etag
write_metadata(df._data_file, metadata) write_metadata(df._data_file, metadata)
except IOError as err: except IOError as err:

View File

@ -398,7 +398,6 @@ class ObjectController(server.ObjectController):
@public @public
@timing_stats() @timing_stats()
def GET(self, request): def GET(self, request):
logging.error(request)
"""Handle HTTP GET requests for the Swift on File object server""" """Handle HTTP GET requests for the Swift on File object server"""
device, partition, account, container, obj, policy = \ device, partition, account, container, obj, policy = \
get_name_and_placement(request, 5, 5, True) get_name_and_placement(request, 5, 5, True)
@ -460,8 +459,8 @@ class ObjectController(server.ObjectController):
headers = {} headers = {}
if hasattr(e, 'timestamp'): if hasattr(e, 'timestamp'):
headers['X-Backend-Timestamp'] = e.timestamp.internal headers['X-Backend-Timestamp'] = e.timestamp.internal
return HTTPNotFound(request=request, headers=headers, return HTTPNotFound(request=request, headers=headers,
conditional_response=True) conditional_response=True)
@public @public
@timing_stats() @timing_stats()