Skip to content

Commit a47c2f4

Browse files
[Storage][DataMovement] Fixes for single transfer size (Azure#46875)
1 parent d056e18 commit a47c2f4

17 files changed

+41
-56
lines changed

sdk/storage/Azure.Storage.DataMovement.Blobs/src/AppendBlobStorageResource.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,12 @@ internal class AppendBlobStorageResource : StorageResourceItemInternal
2525

2626
public override string ProviderId => "blob";
2727

28-
/// <summary>
29-
/// Defines the recommended Transfer Type for the storage resource.
30-
/// </summary>
3128
protected override DataTransferOrder TransferType => DataTransferOrder.Sequential;
3229

33-
/// <summary>
34-
/// Defines the maximum chunk size for the storage resource.
35-
/// </summary>
30+
protected override long MaxSupportedSingleTransferSize => Constants.Blob.Append.MaxAppendBlockBytes;
31+
3632
protected override long MaxSupportedChunkSize => Constants.Blob.Append.MaxAppendBlockBytes;
3733

38-
/// <summary>
39-
/// Length of the storage resource. This information is obtained during a GetStorageResources API call.
40-
///
41-
/// Will return default if the length was not set by a GetStorageResources API call.
42-
/// </summary>
4334
protected override long? Length => ResourceProperties?.ResourceLength;
4435

4536
internal AppendBlobStorageResource()

sdk/storage/Azure.Storage.DataMovement.Blobs/src/BlockBlobStorageResource.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,12 @@ internal class BlockBlobStorageResource : StorageResourceItemInternal
3434

3535
public override string ProviderId => "blob";
3636

37-
/// <summary>
38-
/// Defines the recommended Transfer Type of the storage resource.
39-
/// </summary>
4037
protected override DataTransferOrder TransferType => DataTransferOrder.Unordered;
4138

42-
/// <summary>
43-
/// Store Max Initial Size that a Put Blob can get to.
44-
/// </summary>
45-
internal static long _maxInitialSize => Constants.Blob.Block.Pre_2019_12_12_MaxUploadBytes;
39+
protected override long MaxSupportedSingleTransferSize => Constants.Blob.Block.MaxUploadBytes;
4640

47-
/// <summary>
48-
/// Defines the maximum chunk size for the storage resource.
49-
/// </summary>
5041
protected override long MaxSupportedChunkSize => Constants.Blob.Block.MaxStageBytes;
5142

52-
/// <summary>
53-
/// Length of the storage resource. This information is can obtained during a GetStorageResources API call.
54-
///
55-
/// Will return default if the length was not set by a GetStorageResources API call.
56-
/// </summary>
5743
protected override long? Length => ResourceProperties?.ResourceLength;
5844

5945
/// <summary>
@@ -168,7 +154,7 @@ await BlobClient.UploadAsync(
168154
DataMovementBlobsExtensions.GetBlobUploadOptions(
169155
_options,
170156
overwrite,
171-
_maxInitialSize,
157+
MaxSupportedSingleTransferSize, // We don't want any internal partioning
172158
options?.SourceProperties),
173159
cancellationToken: cancellationToken).ConfigureAwait(false);
174160
return;

sdk/storage/Azure.Storage.DataMovement.Blobs/src/PageBlobStorageResource.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,12 @@ internal class PageBlobStorageResource : StorageResourceItemInternal
2626

2727
public override string ProviderId => "blob";
2828

29-
/// <summary>
30-
/// Defines the recommended Transfer Type for the storage resource.
31-
/// </summary>
3229
protected override DataTransferOrder TransferType => DataTransferOrder.Unordered;
3330

34-
/// <summary>
35-
/// Defines the maximum chunk size for the storage resource.
36-
/// </summary>
31+
protected override long MaxSupportedSingleTransferSize => Constants.Blob.Page.MaxPageBlockBytes;
32+
3733
protected override long MaxSupportedChunkSize => Constants.Blob.Page.MaxPageBlockBytes;
3834

39-
/// <summary>
40-
/// Length of the storage resource. This information is obtained during a GetStorageResources API call.
41-
///
42-
/// Will return default if the length was not set by a GetStorageResources API call.
43-
/// </summary>
4435
protected override long? Length => ResourceProperties?.ResourceLength;
4536

4637
public PageBlobStorageResource()

sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFileStorageResource.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ internal class ShareFileStorageResource : StorageResourceItemInternal
2828

2929
protected override DataTransferOrder TransferType => DataTransferOrder.Unordered;
3030

31+
protected override long MaxSupportedSingleTransferSize => DataMovementShareConstants.MaxRange;
32+
3133
protected override long MaxSupportedChunkSize => DataMovementShareConstants.MaxRange;
3234

3335
protected override long? Length => ResourceProperties?.ResourceLength;

sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.net6.0.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ protected StorageResourceItem() { }
177177
protected internal override bool IsContainer { get { throw null; } }
178178
protected internal abstract long? Length { get; }
179179
protected internal abstract long MaxSupportedChunkSize { get; }
180+
protected internal abstract long MaxSupportedSingleTransferSize { get; }
180181
protected internal abstract string ResourceId { get; }
181182
protected internal Azure.Storage.DataMovement.StorageResourceItemProperties ResourceProperties { get { throw null; } set { } }
182183
protected internal abstract Azure.Storage.DataMovement.DataTransferOrder TransferType { get; }

sdk/storage/Azure.Storage.DataMovement/api/Azure.Storage.DataMovement.netstandard2.0.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ protected StorageResourceItem() { }
177177
protected internal override bool IsContainer { get { throw null; } }
178178
protected internal abstract long? Length { get; }
179179
protected internal abstract long MaxSupportedChunkSize { get; }
180+
protected internal abstract long MaxSupportedSingleTransferSize { get; }
180181
protected internal abstract string ResourceId { get; }
181182
protected internal Azure.Storage.DataMovement.StorageResourceItemProperties ResourceProperties { get { throw null; } set { } }
182183
protected internal abstract Azure.Storage.DataMovement.DataTransferOrder TransferType { get; }

sdk/storage/Azure.Storage.DataMovement/src/DataTransferOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class DataTransferOptions : IEquatable<DataTransferOptions>
1717
/// The default value is 4 MiB.
1818
/// <para/>
1919
/// When resuming a transfer, the default value will be the value specified
20-
/// when the transfer was first started.
20+
/// when the transfer was first started but can still be overriden.
2121
/// <para/>
2222
/// This value may be clamped to the maximum allowed for the particular transfer/resource type.
2323
/// </summary>
@@ -31,7 +31,7 @@ public class DataTransferOptions : IEquatable<DataTransferOptions>
3131
/// The default value is 32 MiB.
3232
/// <para/>
3333
/// When resuming a transfer, the default value will be the value specified
34-
/// when the transfer was first started.
34+
/// when the transfer was first started but can still be overriden.
3535
/// <para/>
3636
/// This value may be clamped to the maximum allowed for the particular transfer/resource type.
3737
/// </summary>

sdk/storage/Azure.Storage.DataMovement/src/JobPartInternal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ internal JobPartInternal(
185185
SingleTransferCompletedEventHandler = singleTransferEventHandler;
186186
ClientDiagnostics = clientDiagnostics;
187187

188-
// Set transfer sizes to user specified values or default
188+
// Set transfer sizes to user specified values or default,
189189
// clamped to max supported chunk size for the destination.
190190
_initialTransferSize = Math.Min(
191191
initialTransferSize ?? DataMovementConstants.DefaultInitialTransferSize,
192-
_destinationResource.MaxSupportedChunkSize);
192+
_destinationResource.MaxSupportedSingleTransferSize);
193193
_transferChunkSize = Math.Min(
194194
transferChunkSize ?? DataMovementConstants.DefaultChunkSize,
195195
_destinationResource.MaxSupportedChunkSize);

sdk/storage/Azure.Storage.DataMovement/src/LocalFileStorageResource.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,12 @@ internal class LocalFileStorageResource : StorageResourceItem
2323

2424
public override string ProviderId => "local";
2525

26-
/// <summary>
27-
/// Defines the recommended Transfer Type of the resource
28-
/// </summary>
2926
protected internal override DataTransferOrder TransferType => DataTransferOrder.Sequential;
3027

31-
/// <summary>
32-
/// Defines the maximum chunk size for the storage resource.
33-
/// </summary>
34-
/// TODO: consider changing this.
28+
protected internal override long MaxSupportedSingleTransferSize => Constants.Blob.Block.MaxStageBytes;
29+
3530
protected internal override long MaxSupportedChunkSize => Constants.Blob.Block.MaxStageBytes;
3631

37-
/// <summary>
38-
/// Length of the storage resource. This information is can obtained during a GetStorageResources API call.
39-
///
40-
/// Will return default if the length was not set by a GetStorageResources API call.
41-
/// </summary>
4232
protected internal override long? Length => default;
4333

4434
/// <summary>

sdk/storage/Azure.Storage.DataMovement/src/StorageResourceItem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ protected StorageResourceItem() { }
2727
/// </summary>
2828
protected internal abstract DataTransferOrder TransferType { get; }
2929

30+
/// <summary>
31+
/// Defines the maximum supported size for the storage resource to be created
32+
/// in a single API call.
33+
/// </summary>
34+
protected internal abstract long MaxSupportedSingleTransferSize { get; }
35+
3036
/// <summary>
3137
/// Defines the maximum supported chunk size for the storage resource.
3238
/// </summary>

0 commit comments

Comments
 (0)