-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add BlockBlobDatabase as TES database option #194
base: main
Are you sure you want to change the base?
Conversation
var task2 = blobClient2.UploadAsync(BinaryData.FromString(json), overwrite: true); | ||
|
||
// Retry to reduce likelihood of one blob succeeding and the other failing | ||
await Policy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I think this retry policy could lead to data loss. Two requests roughly at the same time hit this method, the first fails and the second succeeds (we want the second one to win), the first request will go in retry loop that could overwrite the latest data.
As an alternative you can consider an optimistic concurrency approach for the update, where you check if an item has changed since you last read it - storage supports this via headers, and etags. And for the create scenario, you turn overwrite off, to avoid any race condition.
This implementation can be used to store TesTasks in Azure Storage instead of PostgreSQL, and reduces Azure resource count and cost (#226 ).
Features
Implementation notes
List Blobs operation
:Current limitations
ListTasks by name_prefix
since this would require downloading every single blob to get the name, or, an alternative implementation (one idea would be to store a separate blob that has all name+id tuples (which could result in contention issues for create/update/delete since a lease would need to be held), OR, to store 2 blobs for every TesTask - one for the existing TesTask, and another that's empty but has a blob name that is the TES task name with special characters encoded and the ID as the suffix, which would enable fast query byList Blobs operation
, then extract the IDs from the name and then download by ID as the current LIST implementation does)