From 3aa9b5f4fe7a951acda8f0654162d3111a188614 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 25 Nov 2025 20:35:55 -0800 Subject: [PATCH] Clarify multipart URL comments: filer address not used for uploads Update comments to reflect that multipart upload URLs are not actually used for upload traffic - uploads go directly to volume servers. Key clarifications: - genPartUploadUrl: Filer address is parsed out, only path is used - CompleteMultipartUpload Location: Informational field per AWS S3 spec - Actual uploads bypass filer proxy and go directly to volume servers The filer address in these URLs is NOT a HA concern because: 1. Part uploads: URL is parsed for path, upload goes to volume servers 2. Location URL: Informational only, clients use S3 endpoint This addresses the observation that S3 uploads don't go through filers, only metadata operations do. --- weed/s3api/filer_multipart.go | 6 +++--- weed/s3api/s3api_object_handlers_multipart.go | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go index 44326a875..3b4d9ca4b 100644 --- a/weed/s3api/filer_multipart.go +++ b/weed/s3api/filer_multipart.go @@ -183,9 +183,9 @@ func (s3a *S3ApiServer) completeMultipartUpload(r *http.Request, input *s3.Compl entryName, dirName := s3a.getEntryNameAndDir(input) if entry, _ := s3a.getEntry(dirName, entryName); entry != nil && entry.Extended != nil { if uploadId, ok := entry.Extended[s3_constants.SeaweedFSUploadId]; ok && *input.UploadId == string(uploadId) { - // Note: Location URL points to current active filer tracked by FilerClient - // Clients should use S3 API endpoint, not this direct URL - // If direct access is attempted and filer is down, request will fail + // Note: Location URL is informational per AWS S3 API spec + // Clients should use the S3 API endpoint, not this direct URL + // Points to current active filer (not a concern since it's not used for actual access) return &CompleteMultipartUploadResult{ Location: aws.String(fmt.Sprintf("http://%s%s/%s", s3a.getFilerAddress().ToHttpAddress(), urlEscapeObject(dirName), urlPathEscape(entryName))), Bucket: input.Bucket, diff --git a/weed/s3api/s3api_object_handlers_multipart.go b/weed/s3api/s3api_object_handlers_multipart.go index 9a288ba7f..c17ab3da6 100644 --- a/weed/s3api/s3api_object_handlers_multipart.go +++ b/weed/s3api/s3api_object_handlers_multipart.go @@ -438,10 +438,9 @@ func (s3a *S3ApiServer) genUploadsFolder(bucket string) string { } func (s3a *S3ApiServer) genPartUploadUrl(bucket, uploadID string, partID int) string { - // Note: URL points to current active filer tracked by FilerClient - // If this filer becomes unavailable, clients uploading parts will fail - // TODO: Consider using a virtual hostname that load-balances to healthy filers, - // or have S3 server proxy the upload to a healthy filer + // Note: This URL is used internally to generate the file path for putToFiler + // The filer address is parsed out - actual upload goes directly to volume servers + // The filer address here is not actually used for upload traffic return fmt.Sprintf("http://%s%s/%s/%04d_%s.part", s3a.getFilerAddress().ToHttpAddress(), s3a.genUploadsFolder(bucket), uploadID, partID, uuid.NewString()) }