Skip to content

Read an Actively Updating Append Blob

xiaonlimsft edited this page Jan 15, 2019 · 1 revision

Description

If you use BlobURL.download() to download an append blob which is being actively appended, you may geta 412 HTTP error, just like this issue: https://github.com/Azure/azure-storage-js/issues/51

Solutions

Recommend solution is to snapshot the append blob, and read from the snapshot blob.

Reason

blobURL.download() will try to download a blob with a HTTP Get request into a stream. When stream unexpected ends due to such as network broken, a retry will resume the stream read from the broken point with a new HTTP Get request.

The second HTTP request will use conditional header IfMatch with the blob's ETag returned in first request to make sure the blob doesn't change when the 2nd retry happens. Otherwise, a 412 conditional header doesn't match error will be returned.

This strict strategy is used to avoid data integrity issues, such as the blob maybe totally over written by someone others. However, this strategy seems avoiding reading from reading a constantly updated log file when a retry happens.