Skip to content

Added Share Soft Delete#11260

Merged
seanmcc-msft merged 2 commits intoAzure:feature/storage/stg73basefrom
seanmcc-msft:feature/storage/shareSoftDelete
Apr 15, 2020
Merged

Added Share Soft Delete#11260
seanmcc-msft merged 2 commits intoAzure:feature/storage/stg73basefrom
seanmcc-msft:feature/storage/shareSoftDelete

Conversation

@seanmcc-msft
Copy link
Copy Markdown
Member

No description provided.

// It takes some time for the Share to be deleted.
if (Mode != RecordedTestMode.Playback)
{
await Task.Delay(30000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to wait on/poll (with exponential retry) some API for delete condition instead of hard-coded wait time. Might give more stability in live mode.

Copy link
Copy Markdown
Member

@tg-msft tg-msft Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just keep calling Delete periodically until we stop getting ShareBeingDeleted or whatever the error code is? If you do keep this as-is, we've got a handy https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs#L338 that encapsulates the mode check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling delete multiple tests doesn't work, delete doesn't return an error code if a share is being deleted. I'll switch to using the Delay method.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can change this before merging to master to calling Restore() in a loop and waiting for no error, for stability in the live tests.


// Act
await TestHelper.AssertExpectedExceptionAsync<RequestFailedException>(
share.RestoreAsync(GetNewShareName(), "01D60F8BB59A4652"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can you introduce descriptive constant or variable for that string?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@seanmcc-msft
Copy link
Copy Markdown
Member Author

@tg-msft, could you look at this PR next? It's relatively small.

Copy link
Copy Markdown
Member

@tg-msft tg-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only major question I have is about the name (also in ApiView). We called this Undelete for Blobs and we're using Restore here. Any reason we don't want Undelete for both?

/// Gets a tenant to use for any tests related to blob or container soft delete.
/// </summary>
public static TenantConfiguration DefaultTargetSoftDeleteTenant =>
GetTenant("TargetBlobAndContainerSoftDeleteTenant", s_configurations.Value.TargetSoftDeleteTenantName);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Soft Delete an account level setting that applies regardless of whether you're using Blobs/Files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is Container Soft Delete and Blob Soft Delete for the Blobs service, and Share Soft Delete for Files. I'd like to just make 1 new test account with all soft delete features enabled.

The reason I want a separate account is that 1. it takes time to enable/disable these features on an account, and 2. if you list with the "Deleted" option, and soft delete has been enabled for weeks, the resulting list could be huge.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - I'm on board with the separate account. Just wonder if we should call the tenant name "TargetBlobsAndFilesSoftDeleteTenant" or just "TargetSoftDeleteTenant" since you need to enable it for both services? I don't feel very strongly here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add additional documentation around what settings this tenant requres.

ClientDiagnostics,
Pipeline,
Uri,
Version.ToVersionString(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the operation just fail if you call this with an older service version? I can't imagine this causing any problems, but want to double check we don't need a version guard here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it will fail, with a message from the service saying the version is incorrect. Peter decided we weren't doing version guarding in the SDK.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was specifically no guards unless it could lead to data corruption or loss - which is why I like double checking for some of these new operations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing will happen to your share if you call Restore with a service version that doesn't support it - you will just get a 400 class error.

// It takes some time for the Share to be deleted.
if (Mode != RecordedTestMode.Playback)
{
await Task.Delay(30000);
Copy link
Copy Markdown
Member

@tg-msft tg-msft Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just keep calling Delete periodically until we stop getting ShareBeingDeleted or whatever the error code is? If you do keep this as-is, we've got a handy https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs#L338 that encapsulates the mode check.

@seanmcc-msft
Copy link
Copy Markdown
Member Author

The only major question I have is about the name (also in ApiView). We called this Undelete for Blobs and we're using Restore here. Any reason we don't want Undelete for both?

If we want to keep the APIs consistent, I'd prefer "Restore" over "Undelete". For the original naming of the APIs, I just copied the service.

@seanmcc-msft
Copy link
Copy Markdown
Member Author

Could we just keep calling Delete periodically until we stop getting ShareBeingDeleted or whatever the error code is? If you do keep this as-is, we've got a handy https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs#L338 that encapsulates the mode check.

I'll attempt to call Delete in a loop until the error code changes and see what happens.

@tg-msft
Copy link
Copy Markdown
Member

tg-msft commented Apr 15, 2020

If we want to keep the APIs consistent, I'd prefer "Restore" over "Undelete". For the original naming of the APIs, I just copied the service.

Should we rename Undelete in Blobs to Restore (with the old method hidden by [EditorBrowsable(Never)] and calling into the new one)? This is maybe worth having a quick chat with the right folks on your team to make a call here. It's going to be a little weird to have ShareClient.Restore and BlobContainerClient.Restore but BlobClient.Undelete. Resolving that question doesn't need to block this PR from getting in.

@seanmcc-msft
Copy link
Copy Markdown
Member Author

If we want to keep the APIs consistent, I'd prefer "Restore" over "Undelete". For the original naming of the APIs, I just copied the service.

Should we rename Undelete in Blobs to Restore (with the old method hidden by [EditorBrowsable(Never)] and calling into the new one)? This is maybe worth having a quick chat with the right folks on your team to make a call here. It's going to be a little weird to have ShareClient.Restore and BlobContainerClient.Restore but BlobClient.Undelete. Resolving that question doesn't need to block this PR from getting in.

Ok, I'll leave the API name as-in for now, and we can circle back around once 73 is closer to the main Arch Board review.

@seanmcc-msft seanmcc-msft merged commit 626abde into Azure:feature/storage/stg73base Apr 15, 2020
@seanmcc-msft seanmcc-msft deleted the feature/storage/shareSoftDelete branch April 15, 2020 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants