Skip to content

Commit

Permalink
Rerecording Single Transfer Sync and Async copy tests; Minor fixes to…
Browse files Browse the repository at this point in the history
… single copy and speed. (Azure#33056)

* WIP

* Undo change sto nunit.runsettings

* Return after single shot copy; uploaded single copy recordings

* More recordings

* PagetoPageBlob tests and AppendBlobToAppendBlob tests recordings
  • Loading branch information
amnguye authored Dec 14, 2022
1 parent 957a870 commit 83fc15b
Showing 117 changed files with 29,791 additions and 1,058 deletions.
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public AppendBlobStorageResource(Azure.Storage.Blobs.Specialized.AppendBlobClien
public override System.Uri Uri { get { throw null; } }
public override System.Threading.Tasks.Task CompleteTransferAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.StorageResourceProperties> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.ReadStreamStorageResourceResult> ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -74,7 +74,7 @@ public BlockBlobStorageResource(Azure.Storage.Blobs.Specialized.BlockBlobClient
public override System.Uri Uri { get { throw null; } }
public override System.Threading.Tasks.Task CompleteTransferAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.StorageResourceProperties> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.ReadStreamStorageResourceResult> ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -109,7 +109,7 @@ public PageBlobStorageResource(Azure.Storage.Blobs.Specialized.PageBlobClient bl
public override System.Uri Uri { get { throw null; } }
public override System.Threading.Tasks.Task CompleteTransferAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.StorageResourceProperties> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.ReadStreamStorageResourceResult> ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Original file line number Diff line number Diff line change
@@ -147,11 +147,6 @@ public override async Task WriteFromStreamAsync(
StorageResourceWriteToOffsetOptions options = default,
CancellationToken cancellationToken = default)
{
AppendBlobRequestConditions conditions = new AppendBlobRequestConditions
{
// TODO: copy over the other conditions from the uploadOptions
IfNoneMatch = overwrite ? null : new ETag(Constants.Wildcard),
};
if (position == 0)
{
await _blobClient.CreateAsync(
@@ -175,6 +170,9 @@ await _blobClient.AppendBlockAsync(
/// <param name="overwrite">
/// If set to true, will overwrite the blob if it currently exists.
/// </param>
/// <param name="completeLength">
/// The expected complete length of the blob.
/// </param>
/// <param name="options">Options for the storage resource. See <see cref="StorageResourceCopyFromUriOptions"/>.</param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
@@ -184,6 +182,7 @@ await _blobClient.AppendBlockAsync(
public override async Task CopyFromUriAsync(
StorageResource sourceResource,
bool overwrite,
long completeLength,
StorageResourceCopyFromUriOptions options = default,
CancellationToken cancellationToken = default)
{
@@ -196,8 +195,11 @@ await _blobClient.StartCopyFromUriAsync(
}
else //(ServiceCopyMethod == TransferCopyMethod.SyncCopy)
{
// We use SyncUploadFromUri over SyncCopyUploadFromUri in this case because it accepts any blob type as the source.
// TODO: subject to change as we scale to suppport resource types outside of blobs.
// Create Append blob beforehand
await _blobClient.CreateAsync(
options: _options.ToCreateOptions(overwrite),
cancellationToken: cancellationToken).ConfigureAwait(false);

await _blobClient.SyncCopyFromUriAsync(
sourceResource.Uri,
_options.ToBlobCopyFromUriOptions(overwrite, options?.SourceAuthentication),
Original file line number Diff line number Diff line change
@@ -198,6 +198,9 @@ await _blobClient.StageBlockAsync(
/// <param name="overwrite">
/// If set to true, will overwrite the blob if exists.
/// </param>
/// <param name="completeLength">
/// The expected complete length of the blob.
/// </param>
/// <param name="options">Options for the storage resource. See <see cref="StorageResourceCopyFromUriOptions"/>.</param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
@@ -207,6 +210,7 @@ await _blobClient.StageBlockAsync(
public override async Task CopyFromUriAsync(
StorageResource sourceResource,
bool overwrite,
long completeLength,
StorageResourceCopyFromUriOptions options = default,
CancellationToken cancellationToken = default)
{
Original file line number Diff line number Diff line change
@@ -149,11 +149,6 @@ public override async Task WriteFromStreamAsync(
CancellationToken cancellationToken = default)
{
// Create the blob first before uploading the pages
PageBlobRequestConditions conditions = new PageBlobRequestConditions
{
// TODO: copy over the other conditions from the uploadOptions
IfNoneMatch = overwrite ? null : new ETag(Constants.Wildcard),
};
if (position == 0)
{
await _blobClient.CreateAsync(
@@ -179,6 +174,9 @@ await _blobClient.UploadPagesAsync(
/// <param name="overwrite">
/// If set to true, will overwrite the blob if it currently exists.
/// </param>
/// <param name="completeLength">
/// The expected complete length of the blob.
/// </param>
/// <param name="options">Options for the storage resource. See <see cref="StorageResourceCopyFromUriOptions"/>.</param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
@@ -188,6 +186,7 @@ await _blobClient.UploadPagesAsync(
public override async Task CopyFromUriAsync(
StorageResource sourceResource,
bool overwrite,
long completeLength,
StorageResourceCopyFromUriOptions options = default,
CancellationToken cancellationToken = default)
{
@@ -200,6 +199,11 @@ await _blobClient.StartCopyFromUriAsync(
}
else //(ServiceCopyMethod == TransferCopyMethod.SyncCopy)
{
await _blobClient.CreateAsync(
size: completeLength,
options: _options.ToCreateOptions(overwrite),
cancellationToken: cancellationToken).ConfigureAwait(false);

// TODO: subject to change as we scale to suppport resource types outside of blobs.
await _blobClient.SyncCopyFromUriAsync(
sourceResource.Uri,
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ public LocalFileStorageResource(string path) { }
public override System.Uri Uri { get { throw null; } }
public override System.Threading.Tasks.Task CompleteTransferAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.StorageResourceProperties> GetPropertiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.ReadStreamStorageResourceResult> ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -58,7 +58,7 @@ protected StorageResource() { }
public abstract Azure.Storage.DataMovement.TransferType TransferType { get; }
public abstract System.Threading.Tasks.Task CompleteTransferAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task CopyBlockFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, Azure.HttpRange range, bool overwrite, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task CopyFromUriAsync(Azure.Storage.DataMovement.StorageResource sourceResource, bool overwrite, long completeLength, Azure.Storage.DataMovement.Models.StorageResourceCopyFromUriOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.StorageResourceProperties> GetPropertiesAsync(System.Threading.CancellationToken token = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task<Azure.Storage.DataMovement.Models.ReadStreamStorageResourceResult> ReadStreamAsync(long position = (long)0, long? length = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public abstract System.Threading.Tasks.Task WriteFromStreamAsync(System.IO.Stream stream, long streamLength, bool overwrite, long position = (long)0, long completeLength = (long)0, Azure.Storage.DataMovement.Models.StorageResourceWriteToOffsetOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
Original file line number Diff line number Diff line change
@@ -281,11 +281,7 @@ await TransferFailedEventHandler.Invoke(new TransferFailedEventArgs(
_cancellationTokenSource.Token)).ConfigureAwait(false);
}
// Trigger job cancellation if the failed handler is enabled
if (_errorHandling == ErrorHandlingOptions.StopOnAllFailures ||
_createMode == StorageResourceCreateMode.Fail)
{
await TriggerCancellation(StorageTransferStatus.CompletedWithFailedTransfers).ConfigureAwait(false);
}
await TriggerCancellation(StorageTransferStatus.CompletedWithFailedTransfers).ConfigureAwait(false);
}

internal long CalculateBlockSize(long length)
Loading

0 comments on commit 83fc15b

Please sign in to comment.