minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

fix: avoid HeadObject call for mc get #4947

Closed jiuker closed 5 months ago

jiuker commented 5 months ago

fix: avoid stat call for mc get

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the Apache 2 license. By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

fix: avoid stat call for mc get for https://github.com/minio/mc/pull/4866 deleted this feature. Adding it back.

Motivation and Context

How to test this PR?

mc get source target mc admin trace -v minio | grep s3. You will see

127.0.0.1:9000 [REQUEST s3.GetObject] [2024-05-30T17:04:32.126] [Client IP: 127.0.0.1]
127.0.0.1:9000 Authorization: AWS4-HMAC-SHA256 Credential=minioadmin/20240530/wset/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=fc6e94b2677e4c11e177ff52a36ccb1e78640a47967a7dd16e1ba3567d4657b8

before this pr:

127.0.0.1:9000 [REQUEST s3.HeadObject] [2024-05-30T17:10:41.704] [Client IP: 127.0.0.1]
127.0.0.1:9000 Authorization: AWS4-HMAC-SHA256 Credential=minioadmin/20240530/wset/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=344706b6fadb7a7f5a1603cb521865fa1a28f399a4176c4e313a4f77ea6c5ec3
127.0.0.1:9000 [REQUEST s3.GetObject] [2024-05-30T17:10:41.706] [Client IP: 127.0.0.1]
127.0.0.1:9000 Authorization: AWS4-HMAC-SHA256 Credential=minioadmin/20240530/wset/s3/aws4_request, SignedHeaders=host;if-match;x-amz-content-sha256;x-amz-date, Signature=b0b6680e916d38e20fad674ab6e125f54f9fc7e877302675930f4888cc48b4a9

Types of changes

Checklist: