locked
Question about "RA-GRS" and "PrimaryThenSecondary" RRS feed

  • Question

  • i have question about "RA-GRS" and "PrimaryThenSecondary".

    Is there a way to get to which one is connected?

    for example, after call below
    blob.FetchAttributes()

    if primary is down, i want to know this blob connect to the primary or secondary, programatically.
    is there any property or method?

    Friday, September 14, 2018 3:10 AM

Answers

  • Retrieving property and metadata values for a storage resource is a two-step process. Before you can read these values, you must explicitly fetch them by calling the FetchAttributes or FetchAttributesAsync method. The exception is if you are calling the Exists or ExistsAsync method on a resource. When you call one of these methods, Azure Storage calls the appropriate FetchAttributes method under the covers as part of the call to the Exists method.

    Note:If you find that property or metadata values for a storage resource have not been populated, then check that your code calls the FetchAttributes or FetchAttributesAsync method.

    Metadata name/value pairs may contain only ASCII characters. Metadata name/value pairs are valid HTTP headers, and so must adhere to all restrictions governing HTTP headers. It's recommended that you use URL encoding or Base64 encoding for names and values containing non-ASCII characters.


    Sample Example:

    [Microsoft.WindowsAzure.Storage.DoesServiceRequest]
    public virtual void FetchAttributes (Microsoft.WindowsAzure.Storage.AccessCondition accessCondition = null, 
    Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options = null,
    Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);

    For more information, suggest you to CloudBlob.FetchAttributes.

    -----------------------------------------------------------------------------------------------

    If this answer was helpful, click “Mark as Answer” or “Up-Vote”. To provide additional feedback on your forum experience, click here

    • Proposed as answer by VeeraGiri Babu Friday, September 14, 2018 6:04 AM
    • Marked as answer by take_one_k Friday, September 14, 2018 7:20 AM
    Friday, September 14, 2018 6:03 AM

All replies

  • Retrieving property and metadata values for a storage resource is a two-step process. Before you can read these values, you must explicitly fetch them by calling the FetchAttributes or FetchAttributesAsync method. The exception is if you are calling the Exists or ExistsAsync method on a resource. When you call one of these methods, Azure Storage calls the appropriate FetchAttributes method under the covers as part of the call to the Exists method.

    Note:If you find that property or metadata values for a storage resource have not been populated, then check that your code calls the FetchAttributes or FetchAttributesAsync method.

    Metadata name/value pairs may contain only ASCII characters. Metadata name/value pairs are valid HTTP headers, and so must adhere to all restrictions governing HTTP headers. It's recommended that you use URL encoding or Base64 encoding for names and values containing non-ASCII characters.


    Sample Example:

    [Microsoft.WindowsAzure.Storage.DoesServiceRequest]
    public virtual void FetchAttributes (Microsoft.WindowsAzure.Storage.AccessCondition accessCondition = null, 
    Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options = null,
    Microsoft.WindowsAzure.Storage.OperationContext operationContext = null);

    For more information, suggest you to CloudBlob.FetchAttributes.

    -----------------------------------------------------------------------------------------------

    If this answer was helpful, click “Mark as Answer” or “Up-Vote”. To provide additional feedback on your forum experience, click here

    • Proposed as answer by VeeraGiri Babu Friday, September 14, 2018 6:04 AM
    • Marked as answer by take_one_k Friday, September 14, 2018 7:20 AM
    Friday, September 14, 2018 6:03 AM

  • Thank you!
    I got the results I wanted.
    Dim context As OperationContext = New OperationContext()
    Dim container As CloudBlobContainer = blob.GetContainerReference("container_name")
    
    container.FetchAttributes(Nothing, Nothing, context)
    
    Dim result As RequestResult = context.LastResult
    
    If result.TargetLocation = StorageLocation.Primary Then
        Return ServerRole.Primary
    Else
        Return ServerRole.Secondary
    End If
    

    Friday, September 14, 2018 7:27 AM
  • We are glad to hear that your query is clarified.

    Friday, September 14, 2018 10:26 AM