Hash the content for fs MPU ETag if no xattr.

If there is no extended attribute support in the file system, the blobs
will not have their associated ETags available. In that case, the file
system blob store should rehash the content while producing the combined
blob and return the expected S3-style ETag.
This commit is contained in:
Timur Alperovich 2020-03-04 12:14:21 -08:00 committed by Andrew Gaul
parent 69ca45720d
commit 8d0e9dc962
1 changed files with 3 additions and 1 deletions

View File

@ -840,7 +840,9 @@ public final class LocalBlobStore implements BlobStore {
Blob blobPart = getBlob(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-" + part.partNumber()); Blob blobPart = getBlob(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-" + part.partNumber());
contentLength += blobPart.getMetadata().getContentMetadata().getContentLength(); contentLength += blobPart.getMetadata().getContentMetadata().getContentLength();
blobs.add(blobPart); blobs.add(blobPart);
md5Hasher.putBytes(BaseEncoding.base16().lowerCase().decode(blobPart.getMetadata().getETag())); if (blobPart.getMetadata().getETag() != null) {
md5Hasher.putBytes(BaseEncoding.base16().lowerCase().decode(blobPart.getMetadata().getETag()));
}
} }
String mpuETag = new StringBuilder("\"") String mpuETag = new StringBuilder("\"")
.append(md5Hasher.hash()) .append(md5Hasher.hash())