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 hanging blob creation #351

Merged
merged 2 commits into from
Mar 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public override void WriteAsync(IntPtr sourceAddress, int segmentId, ulong desti

// If no blob exists for the segment, we must first create the segment asynchronouly. (Create call takes ~70 ms by measurement)
// After creation is done, we can call write.
_ = entry.CreateAsync(size, pageBlob);
_ = entry.CreateAsync(size, pageBlob, id);
}
// Otherwise, some other thread beat us to it. Okay to use their blobs.
blobEntry = this.blobs[segmentId];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public BlobEntry(AzureStorageDevice azureStorageDevice)
/// </summary>
/// <param name="size">maximum size of the blob</param>
/// <param name="pageBlob">The page blob to create</param>
public async Task CreateAsync(long size, BlobUtilsV12.PageBlobClients pageBlob)
public async Task CreateAsync(long size, BlobUtilsV12.PageBlobClients pageBlob, long id)
{
if (this.waitingCount != 0)
{
Expand All @@ -67,12 +67,17 @@ await this.azureStorageDevice.BlobManager.PerformWithRetriesAsync(
true,
"PageBlobClient.CreateAsync",
"CreateDevice",
"",
$"id={id}",
pageBlob.Default.Name,
3000,
true,
async (numAttempts) =>
{
if (this.ETag != default)
{
return 1; // blob was already created by previous attempt
}

var client = (numAttempts > 1) ? pageBlob.Default : pageBlob.Aggressive;

var response = await client.CreateAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public async Task PerformWithRetriesAsync(
}
continue;
}
catch (Azure.RequestFailedException ex) when (BlobUtilsV12.PreconditionFailed(ex) && readETagAsync != null)
catch (Azure.RequestFailedException ex) when (BlobUtilsV12.PreconditionFailed(ex) && readETagAsync != null && numAttempts < BlobManager.MaxRetries)
{
this.StorageTracer?.FasterStorageProgress($"storage operation {name} ({intent}) failed precondition on attempt {numAttempts}; target={target} latencyMs={stopwatch.Elapsed.TotalMilliseconds:F1} {details}");
mustReadETagFirst = true;
Expand Down
Loading