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: Azure Device Behavior for Non-Existent Files #1066

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

priyanjgupta
Copy link

@priyanjgupta priyanjgupta commented Mar 4, 2025

Issue Description:
The current recovery logic uses a double buffering scan for commits, causing the page the device is searching for to spill into the next segment, which may not exist. In such cases, the device repeatedly retries to find the non-existent file, resulting in a 90-second hang and eventually a "blob not found" error. This causes all subsequent read/write requests to be canceled under the current implementation. In contrast, the local device creates the file when it encounters a non-existent file. This PR aims to align the behavior between both device implementations.

Steps to reproduce the bug:
Start garnet server with following flags

"--cluster",
"--aof",
"--use-azure-storage",
"true",
"--storage-string",
"UseDevelopmentStorage=true",
"--recover",
"true",
"--aof-commit-freq",
"0",

After the blob not found error, subsequent writes should fail to commit.

Screenshots

image

Expected Behavior
image

@priyanjgupta priyanjgupta marked this pull request as ready for review March 5, 2025 04:38
@TalZaccai TalZaccai self-requested a review March 6, 2025 19:19
Copy link
Contributor

@TalZaccai TalZaccai left a comment

Choose a reason for hiding this comment

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

Couple of nits :)

TryReadAsync(blobEntry, (long)sourceAddress, (long)destinationAddress, readLength, id);
}

void TryReadAsync(BlobEntry blobEntry, long sourceAddress, long destinationAddress, uint readLength, long id)
Copy link
Contributor

Choose a reason for hiding this comment

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

naming: This is not an async method (same goes for ReadFromBlobAsync)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The convention in AzureStorageDevice currently is that methods that perform work asynchronously end in Async, even if they are not strictly within the async-await paradigm. So I would leave it as is for this PR.

{
// If pageBlob is null, it means the blob has not been created yet. We should wait for it to be created.
if (blobEntry.PageBlob.Default == null
&& blobEntry.TryQueueAction(() => ReadFromBlobAsync(blobEntry, sourceAddress, destinationAddress, readLength, id)))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indent

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