Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slow perf of PipeBlob uploads and Added OAuth support for listing operations #2821

Merged
merged 17 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# AzCopy v10

AzCopy v10 is a command-line utility that you can use to copy data to and from containers and file shares in Azure Storage accounts.
AzCopy V10 presents easy-to-use commands that are optimized for high performance and throughput.

Expand Down
22 changes: 22 additions & 0 deletions cmd/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"net/url"
"os"
"runtime"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -1347,6 +1348,27 @@ func (cca *CookedCopyCmdArgs) processRedirectionDownload(blobResource common.Res
func (cca *CookedCopyCmdArgs) processRedirectionUpload(blobResource common.ResourceString, blockSize int64) error {
ctx := context.WithValue(context.TODO(), ste.ServiceAPIVersionOverride, ste.DefaultServiceApiVersion)

// Use the concurrency environment value
concurrencyEnvVar := glcm.GetEnvironmentVariable(common.EEnvironmentVariable.ConcurrencyValue())

pipingUploadParallelism := pipingUploadParallelism
if concurrencyEnvVar != "" {
// handle when the concurrency value is AUTO
if concurrencyEnvVar == "AUTO" {
return errors.New("concurrency auto-tuning is not possible when using redirection transfers (AZCOPY_CONCURRENCY_VALUE = AUTO)")
}

// convert the concurrency value to int
concurrencyValue, err := strconv.ParseInt(concurrencyEnvVar, 10, 32)

//handle the error if the conversion fails
if err != nil {
return fmt.Errorf("AZCOPY_CONCURRENCY_VALUE is not set to a valid value, an integer is expected (current value: %s): %w", concurrencyEnvVar, err)
}

pipingUploadParallelism = int(concurrencyValue) // Cast to Integer
}

// if no block size is set, then use default value
if blockSize == 0 {
blockSize = pipingDefaultBlockSize
Expand Down
2 changes: 0 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ func (cooked cookedListCmdArgs) handleListContainerCommand() (err error) {
// isSource is rather misnomer for canBePublic. We can list public containers, and hence isSource=true
if credentialInfo, _, err = GetCredentialInfoForLocation(ctx, cooked.location, source, true, common.CpkOptions{}); err != nil {
return fmt.Errorf("failed to obtain credential info: %s", err.Error())
} else if cooked.location == cooked.location.File() && source.SAS == "" {
return errors.New("azure files requires a SAS token for authentication")
} else if credentialInfo.CredentialType.IsAzureOAuth() {
uotm := GetUserOAuthTokenManagerInstance()
if tokenInfo, err := uotm.GetTokenInfo(ctx); err != nil {
Expand Down
18 changes: 11 additions & 7 deletions e2etest/zt_newe2e_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ func init() {
type ListSuite struct{}

func (s *ListSuite) Scenario_ListBasic(svm *ScenarioVariationManager) {
srcService := GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Blob()}))
srcService := GetRootResource(svm, ResolveVariation(svm, []common.Location{common.ELocation.Blob(),
common.ELocation.File()}))

svm.InsertVariationSeparator(":")
body := NewRandomObjectContentContainer(svm, SizeFromString("1K"))
Expand All @@ -38,12 +39,15 @@ func (s *ListSuite) Scenario_ListBasic(svm *ScenarioVariationManager) {
AzCopyCommand{
Verb: AzCopyVerbList,
Targets: []ResourceManager{
srcObj.Parent().(RemoteResourceManager).WithSpecificAuthType(EExplicitCredentialType.SASToken(), svm, CreateAzCopyTargetOptions{
SASTokenOptions: GenericServiceSignatureValues{
ContainerName: srcObj.ContainerName(),
Permissions: (&blobsas.ContainerPermissions{Read: true, List: true}).String(),
},
}),
srcObj.Parent().(RemoteResourceManager).WithSpecificAuthType(ResolveVariation(svm,
[]ExplicitCredentialTypes{EExplicitCredentialType.OAuth(),
EExplicitCredentialType.SASToken()}), svm,
CreateAzCopyTargetOptions{
SASTokenOptions: GenericServiceSignatureValues{
ContainerName: srcObj.ContainerName(),
Permissions: (&blobsas.ContainerPermissions{Read: true, List: true}).String(),
},
}),
},
Flags: ListFlags{},
})
Expand Down
Loading