Skip to content

Commit f694182

Browse files
Changes from reviews
1 parent b8adc12 commit f694182

File tree

1 file changed

+18
-49
lines changed

1 file changed

+18
-49
lines changed

articles/storage/blobs/storage-create-geo-redundant-storage.md

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To complete this tutorial:
5151

5252
# [Python v12 SDK](#tab/python)
5353

54-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
54+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
5555

5656
# [Python v2.1](#tab/python2)
5757

@@ -60,7 +60,7 @@ We are currently working to create code snippets reflecting version 12.x of the
6060

6161
# [Node.js v12 SDK](#tab/nodejs)
6262

63-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
63+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
6464

6565
# [Node.js v11 SDK](#tab/nodejs11)
6666

@@ -119,7 +119,7 @@ git clone https://github.com/Azure-Samples/storage-dotnet-circuit-breaker-patter
119119

120120
# [Python v12 SDK](#tab/python)
121121

122-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
122+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
123123

124124
# [Python v2.1](#tab/python2)
125125

@@ -131,7 +131,7 @@ git clone https://github.com/Azure-Samples/storage-python-circuit-breaker-patter
131131

132132
# [Node.js v12 SDK](#tab/nodejs)
133133

134-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
134+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
135135

136136
# [Node.js v11 SDK](#tab/nodejs11)
137137

@@ -171,7 +171,7 @@ setx storageconnectionstring "<yourconnectionstring>"
171171

172172
# [Python v12 SDK](#tab/python)
173173

174-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
174+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
175175

176176
# [Python v2.1](#tab/python2)
177177

@@ -195,7 +195,7 @@ setx accountkey "<youraccountkey>"
195195

196196
# [Node.js v12 SDK](#tab/nodejs)
197197

198-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
198+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
199199

200200
# [Node.js v11 SDK](#tab/nodejs11)
201201

@@ -216,31 +216,29 @@ Install the required dependencies by opening a command prompt, navigating to the
216216

217217
# [.NET v12 SDK](#tab/dotnet)
218218

219-
In Visual Studio, press **F5** or select **Start** to begin debugging the application. Visual Studio automatically restores missing NuGet packages if configured. See [Installing and reinstalling packages with package restore](/nuget/consume-packages/package-restore#package-restore-overview) to learn more.
219+
In Visual Studio, press **F5** or select **Start** to begin debugging the application. Visual Studio automatically restores missing NuGet packages if package restore is configured. See [Installing and reinstalling packages with package restore](/nuget/consume-packages/package-restore#package-restore-overview) to learn more.
220220

221221
When the console window launches, the app will get the status of the secondary region and write that information to the console. Then the app will create a container in the storage account and upload a blob to the container. Once the blob is uploaded, the app will continuously check to see if the blob has replicated to the secondary region. This check continues until the blob is replicated, or we reach the maximum number of iterations as defined by the loop conditions.
222222

223223
Next, the application enters a loop with a prompt to download the blob, initially reading from primary storage. Press any key to download the blob. If there's a retryable error reading from the primary region, a retry of the read request is performed against the secondary region endpoint. The console output will show when the region switches to secondary.
224224

225225
![Console output secondary request](media/storage-create-geo-redundant-storage/request-secondary-region.png)
226226

227-
The application will also track retry requests through an event listener. If the number of retries exceeds the threshold set in the code, the app will switch to send read requests to secondary storage. This behavior will continue until a secondary read threshold is met, at which point the requests will go back to the primary region.
228-
229-
To exit the loop and clean up resources, make sure requests are being sent to primary storage and press the `Esc` key at the blob download prompt.
227+
To exit the loop and clean up resources, press the `Esc` key at the blob download prompt.
230228

231229
# [.NET v11 SDK](#tab/dotnet11)
232230

233-
In Visual Studio, press **F5** or select **Start** to begin debugging the application. Visual Studio automatically restores missing NuGet packages if configured, visit [Installing and reinstalling packages with package restore](/nuget/consume-packages/package-restore#package-restore-overview) to learn more.
231+
In Visual Studio, press **F5** or select **Start** to begin debugging the application. Visual Studio automatically restores missing NuGet packages if package restore is configured, visit [Installing and reinstalling packages with package restore](/nuget/consume-packages/package-restore#package-restore-overview) to learn more.
234232

235233
A console window launches and the application begins running. The application uploads the **HelloWorld.png** image from the solution to the storage account. The application checks to ensure the image has replicated to the secondary RA-GZRS endpoint. It then begins downloading the image up to 999 times. Each read is represented by a **P** or an **S**. Where **P** represents the primary endpoint and **S** represents the secondary endpoint.
236234

237235
![Console app running](media/storage-create-geo-redundant-storage/figure3.png)
238236

239-
In the sample code, the `RunCircuitBreakerAsync` task in the `Program.cs` file is used to download an image from the storage account using the [DownloadToFileAsync](/dotnet/api/microsoft.azure.storage.blob.cloudblob.downloadtofileasync) method. Prior to the download, an [OperationContext](/dotnet/api/microsoft.azure.cosmos.table.operationcontext) is defined. The operation context defines event handlers, that fire when a download completes successfully or if a download fails and is retrying.
237+
In the sample code, the `RunCircuitBreakerAsync` task in the `Program.cs` file is used to download an image from the storage account using the [DownloadToFileAsync](/dotnet/api/microsoft.azure.storage.blob.cloudblob.downloadtofileasync) method. Prior to the download, an [OperationContext](/dotnet/api/microsoft.azure.cosmos.table.operationcontext) is defined. The operation context defines event handlers that fire when a download completes successfully, or if a download fails and is retrying.
240238

241239
# [Python v12 SDK](#tab/python)
242240

243-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
241+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
244242

245243
# [Python v2.1](#tab/python2)
246244

@@ -256,7 +254,7 @@ Before the download, the Service object [retry_callback](/python/api/azure-stora
256254

257255
# [Node.js v12 SDK](#tab/nodejs)
258256

259-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
257+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
260258

261259
# [Node.js v11 SDK](#tab/nodejs11)
262260

@@ -291,7 +289,7 @@ Deleted container newcontainer1550799840726
291289

292290
# [.NET v12 SDK](#tab/dotnet)
293291

294-
The sample creates a `BlobServiceClient` object configured with retry options and a secondary region endpoint. This allows the application to automatically switch to the secondary region if the request fails on the primary region endpoint.
292+
The sample creates a `BlobServiceClient` object configured with retry options and a secondary region endpoint. This configuration allows the application to automatically switch to the secondary region if the request fails on the primary region endpoint.
295293

296294
```csharp
297295
string accountName = "<YOURSTORAGEACCOUNTNAME>";
@@ -316,44 +314,15 @@ BlobClientOptions blobClientOptions = new BlobClientOptions()
316314
MaxDelay = TimeSpan.FromSeconds(10)
317315
},
318316

319-
// If the GeoRedundantSecondaryUri property is set, the secondary Uri will be used for
320-
// GET or HEAD requests during retries.
321-
// If the status of the response from the secondary Uri is a 404, then subsequent retries
322-
// for the request will not use the secondary Uri again, as this indicates that the resource
323-
// may not have propagated there yet.
324-
// Otherwise, subsequent retries will alternate back and forth between primary and secondary Uri.
317+
// Secondary region endpoint
325318
GeoRedundantSecondaryUri = secondaryAccountUri
326319
};
327320

328321
// Create a BlobServiceClient object using the configuration options above
329322
BlobServiceClient blobServiceClient = new BlobServiceClient(primaryAccountUri, new DefaultAzureCredential(), blobClientOptions);
330323
```
331-
Additionally, the app tracks retry requests through an event listener, which listens to events produced by the Azure SDK client libraries. This is a basic sample of how you could set up an `AzureEventSourceListener` to keep track of request retries.
332-
333-
```csharp
334-
using AzureEventSourceListener listener = new AzureEventSourceListener((args, message) =>
335-
{
336-
if (args.EventSource.Name.StartsWith("Azure-Core") && args.EventName == "RequestRetrying")
337-
{
338-
retryCount++;
339-
}
340-
}, EventLevel.LogAlways);
341-
```
342-
If the number of retries exceeds the threshold set in the code, the app will switch to send read requests to secondary storage. This is done by calling `DownloadAsync()` from a `BlobServiceClient` object which is configured to point at the secondary region endpoint.
343-
```csharp
344-
// Create a client object for the blob service which points to the secondary region endpoint
345-
BlobServiceClient blobServiceClientSecondary = new BlobServiceClient(secondaryAccountUri, new DefaultAzureCredential(), optionsSecondary);
346324

347-
BlobClient blobSecondary = blobServiceClientSecondary.GetBlobContainerClient(containerName).GetBlobClient(blobName);
348-
349-
// Code omitted for brevity
350-
351-
if (retryCount > retryThreshold)
352-
{
353-
response = await blobSecondary.DownloadAsync();
354-
}
355-
```
356-
It will continue to perform secondary reads until a threshold is reached, at which point the requests will go back to the primary region.
325+
When the `GeoRedundantSecondaryUri` property is set in `BlobClientOptions`, retries for GET or HEAD requests will switch to use the secondary endpoint. Subsequent retries will alternate between the primary and secondary endpoint. However, if the status of the response from the secondary Uri is 404, then subsequent retries for the request will no longer use the secondary Uri, as this error code indicates the resource hasn't replicated to the secondary region.
357326

358327
# [.NET v11 SDK](#tab/dotnet11)
359328

@@ -408,7 +377,7 @@ private static void OperationContextRequestCompleted(object sender, RequestEvent
408377

409378
# [Python v12 SDK](#tab/python)
410379

411-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
380+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
412381

413382
# [Python v2.1](#tab/python2)
414383

@@ -455,11 +424,11 @@ def response_callback(response):
455424

456425
# [Node.js v12 SDK](#tab/nodejs)
457426

458-
We are currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
427+
We're currently working to create code snippets reflecting version 12.x of the Azure Storage client libraries. For more information, see [Announcing the Azure Storage v12 Client Libraries](https://techcommunity.microsoft.com/t5/azure-storage/announcing-the-azure-storage-v12-client-libraries/ba-p/1482394).
459428

460429
# [Node.js v11 SDK](#tab/nodejs11)
461430

462-
With the Node.js V10 SDK, callback handlers are unnecessary. Instead, the sample creates a pipeline configured with retry options and a secondary endpoint. This allows the application to automatically switch to the secondary pipeline if it fails to reach your data through the primary pipeline.
431+
With the Node.js V10 SDK, callback handlers are unnecessary. Instead, the sample creates a pipeline configured with retry options and a secondary endpoint. This configuration allows the application to automatically switch to the secondary pipeline if it fails to reach your data through the primary pipeline.
463432

464433
```javascript
465434
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;

0 commit comments

Comments
 (0)