diff options
author | Peter Portante <peter.portante@redhat.com> | 2012-10-31 20:28:42 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-16 04:50:34 -0800 |
commit | b696fc0e595d14404d3659bf15069addf3cf95f6 (patch) | |
tree | eb86dc8544ed012eeaaf015a9da4de17172d8cf3 /swift/1.4.8/swift.diff | |
parent | ffc7618270522bb4550d29a11a81ab5aeca42d99 (diff) |
object-storage: reduce diffs, bury metadata update
Further reduce the diffs we have to carry by moving the Gluster specific
metadata stored when we create an object to the DiskFile class's put() method.
Change-Id: I8cef5412627d3ddfdadbf78ef947e067db5bf620
BUG: 870589
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/4177
Reviewed-by: Pete Zaitcev <zaitcev@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Mohammed Junaid <junaid@redhat.com>
Diffstat (limited to 'swift/1.4.8/swift.diff')
-rw-r--r-- | swift/1.4.8/swift.diff | 45 |
1 files changed, 5 insertions, 40 deletions
diff --git a/swift/1.4.8/swift.diff b/swift/1.4.8/swift.diff index c29199461e2..3f088e21ebd 100644 --- a/swift/1.4.8/swift.diff +++ b/swift/1.4.8/swift.diff @@ -112,7 +112,7 @@ index 8a18cfd..f5346ce 100644 db_dir = storage_directory(DATADIR, part, hsh) db_path = os.path.join(self.root, drive, db_dir, hsh + '.db') diff --git a/swift/obj/server.py b/swift/obj/server.py -index 9cca16b..7a671c2 100644 +index 9cca16b..1861f33 100644 --- a/swift/obj/server.py +++ b/swift/obj/server.py @@ -1,4 +1,5 @@ @@ -195,42 +195,7 @@ index 9cca16b..7a671c2 100644 obj, self.logger, disk_chunk_size=self.disk_chunk_size) orig_timestamp = file.metadata.get('X-Timestamp') upload_expiration = time.time() + self.max_upload_time -@@ -580,12 +603,28 @@ class ObjectController(object): - if 'etag' in request.headers and \ - request.headers['etag'].lower() != etag: - return HTTPUnprocessableEntity(request=request) -- metadata = { -- 'X-Timestamp': request.headers['x-timestamp'], -- 'Content-Type': request.headers['content-type'], -- 'ETag': etag, -- 'Content-Length': str(os.fstat(fd).st_size), -- } -+ content_type = request.headers['content-type'] -+ if not Gluster_enabled(): -+ metadata = { -+ 'X-Timestamp': request.headers['x-timestamp'], -+ 'Content-Type': content_type, -+ 'ETag': etag, -+ 'Content-Length': str(os.fstat(fd).st_size), -+ } -+ else: -+ if not content_type: -+ content_type = FILE_TYPE -+ x_object_type = FILE -+ else: -+ x_object_type = MARKER_DIR if content_type.lower() == DIR_TYPE else FILE -+ metadata = { -+ 'X-Timestamp': request.headers['x-timestamp'], -+ 'Content-Type': content_type, -+ 'ETag': etag, -+ 'Content-Length': str(os.fstat(fd).st_size), -+ X_TYPE: OBJECT, -+ X_OBJECT_TYPE: x_object_type, -+ } - metadata.update(val for val in request.headers.iteritems() - if val[0].lower().startswith('x-object-meta-') and - len(val[0]) > 14) -@@ -612,7 +651,7 @@ class ObjectController(object): +@@ -612,7 +635,7 @@ class ObjectController(object): 'x-timestamp': file.metadata['X-Timestamp'], 'x-etag': file.metadata['ETag'], 'x-trans-id': request.headers.get('x-trans-id', '-')}, @@ -239,7 +204,7 @@ index 9cca16b..7a671c2 100644 resp = HTTPCreated(request=request, etag=etag) return resp -@@ -626,9 +665,9 @@ class ObjectController(object): +@@ -626,9 +649,9 @@ class ObjectController(object): content_type='text/plain') if self.mount_check and not check_mount(self.devices, device): return Response(status='507 %s is not mounted' % device) @@ -252,7 +217,7 @@ index 9cca16b..7a671c2 100644 if file.is_deleted() or ('X-Delete-At' in file.metadata and int(file.metadata['X-Delete-At']) <= time.time()): if request.headers.get('if-match') == '*': -@@ -702,7 +741,7 @@ class ObjectController(object): +@@ -702,7 +725,7 @@ class ObjectController(object): return resp if self.mount_check and not check_mount(self.devices, device): return Response(status='507 %s is not mounted' % device) @@ -261,7 +226,7 @@ index 9cca16b..7a671c2 100644 obj, self.logger, disk_chunk_size=self.disk_chunk_size) if file.is_deleted() or ('X-Delete-At' in file.metadata and int(file.metadata['X-Delete-At']) <= time.time()): -@@ -744,7 +783,7 @@ class ObjectController(object): +@@ -744,7 +767,7 @@ class ObjectController(object): if self.mount_check and not check_mount(self.devices, device): return Response(status='507 %s is not mounted' % device) response_class = HTTPNoContent |