azure-contrib / AzureDirectory

A Lucene Directory Provider for Azure Blob Storage
Microsoft Public License
77 stars 57 forks source link

always return true/false from Obtain() #29

Closed richorama closed 4 years ago

richorama commented 6 years ago

in response to issue #28

richorama commented 6 years ago

@ManfredLange does this PR address the issue you raised in #28?

ManfredLange commented 6 years ago

I had a look. I think HandleException() needs to consider error code 412 which means the StorageException is for not being able to obtain the lease on the lock file.

So, without having run the code including the PR it doesn't appear to address the issue I raised. I think the PR could be easily amended, though, to handle 412's as well.

richorama commented 6 years ago

@ManfredLange as far as I understand it (I didn't write this code!) the HandleWebException method works out if the given exception is due to a missing container or blob (404 or 409), in which case it creates both and tries again.

A status code of 412 shows that the blob is leased by another process, so (I think) the correct behaviour should be for Obtain() to return false - it was not possible to acquire the lease.

Please correct me if I've misunderstood something.