SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
shell: send read jwt when downloading chunks in fs.mergeVolumes and fs.distributeChunks (#10717)
Chris Lu5b145fe646b1
diff --git a/weed/shell/command_fs_distribute_chunks.go b/weed/shell/command_fs_distribute_chunks.goindex a9b41db8c4..2ff2eedd42 100644--- a/weed/shell/command_fs_distribute_chunks.go+++ b/weed/shell/command_fs_distribute_chunks.go@@ -692,6 +692,7 @@ func executeChunkMoves(var resp *http.Responsevar reader io.ReadCloservar readErr error+ readJwt := filer.JwtForVolumeServer(oldFidStr)for _, serverURL := range downloadURLs {var dlReq *http.RequestdlReq, readErr = http.NewRequestWithContext(dlCtx, http.MethodGet, fmt.Sprintf("http://%s/%s", serverURL, oldFidStr), nil)@@ -699,6 +700,9 @@ func executeChunkMoves(continue}dlReq.Header.Add("Accept-Encoding", "gzip")+ if readJwt != "" {+ dlReq.Header.Set("Authorization", security.BearerPrefix+readJwt)+ }resp, readErr = util_http.GetGlobalHttpClient().Do(dlReq)if readErr == nil && resp.StatusCode >= 400 {util_http.CloseResponse(resp)diff --git a/weed/shell/command_fs_merge_volumes.go b/weed/shell/command_fs_merge_volumes.goindex ef82a6ee68..6a888cff56 100644--- a/weed/shell/command_fs_merge_volumes.go+++ b/weed/shell/command_fs_merge_volumes.go@@ -823,7 +823,7 @@ func moveChunk(chunk *filer_pb.FileChunk, toVolumeId needle.VolumeId, masterClie}uploadURL := fmt.Sprintf("http://%s/%s", uploadURLs[0], toFid.String())- resp, reader, err := readUrl(downloadURL)+ resp, reader, err := readUrl(downloadURL, filer.JwtForVolumeServer(fromFid.String()))if err != nil {return err}@@ -877,13 +877,16 @@ func moveChunk(chunk *filer_pb.FileChunk, toVolumeId needle.VolumeId, masterCliereturn nil}-func readUrl(fileUrl string) (*http.Response, io.ReadCloser, error) {+func readUrl(fileUrl string, jwt string) (*http.Response, io.ReadCloser, error) {req, err := http.NewRequest(http.MethodGet, fileUrl, nil)if err != nil {return nil, nil, err}req.Header.Add("Accept-Encoding", "gzip")+ if jwt != "" {+ req.Header.Set("Authorization", security.BearerPrefix+jwt)+ }r, err := util_http.GetGlobalHttpClient().Do(req)if err != nil {