Locks not honoured with shared AzureDirectory instance


If an AzureDirectory instance is shared between two IndexWriters, then both writers will think they have a write lock, and you can get a corrupt index.

The MakeLock() method on AzureDirectory returns the existing lock if there is one,
and AzureLock:Obtain() will return true if _leaseId has already been set.

So it seems to me that AzureDirectory shouldn't be shared among many writers. We were doing because of the overhead of creating a new AzureDirectory every time we want to index something.

We have now implemented our own in memory locking mechanism to prevent this from happening.