benbjohnson / litestream

Streaming replication for SQLite.

Home Page:https://litestream.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Blob Storage Retention Error When Deleting Generation

jdoiro3 opened this issue · comments

Issue Description

When deleting a generation during retention checking, I've encountered a Azure API error. It looks like you're looping over the blob's but not deleting the ones that mimic a directory last, after deleting the files first.

for _, item := range resp.Segment.BlobItems {
internal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, "DELETE").Inc()
blobURL := c.containerURL.NewBlobURL(item.Name)
if _, err := blobURL.Delete(ctx, azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{}); isNotExists(err) {
continue
} else if err != nil {
return err
}

I might be missing something so please let me know if this is a config error on my end.

Relevant Error Logs

time=2024-05-08T23:52:33.957Z level=ERROR msg="retainer error" db=/var/data/some.db replica=abs error="delete generation: -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError, /go/pkg/mod/github.com/!azure/azure-storage-blob-go@v0.15.0/azblob/zc_storage_error.go:42\n===== RESPONSE ERROR (ServiceCode=DirectoryIsNotEmpty)