When I edit an index in the studio, the save succeeds, but the index is not correctly created. I *think* that I encountered this even when executing an index from client code, but here's how I can reliably reproduce this issue:
Index Name: Orders/ByCompany
Document Id
Timestamp: 0001-01-01T00:00:00.0000000Z
Action: Index with etag 59 is in-memory implementation of a faulty index
System.UnauthorizedAccessException: Access to the path 'C:\databases\Databases\northwind-test-andrej\Indexes\ReplacementOf_Orders_ByCompany\compression.0000000000.buffers' is denied.
at System.IO.Win32FileSystem.DeleteFile(String fullPath)
at Voron.StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions.DeleteAllTempBuffers() in C:\Builds\RavenDB-4.0-Beta\src\Voron\StorageEnvironmentOptions.cs:line 559
at Voron.StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions..ctor(VoronPathSetting basePath, VoronPathSetting tempPath, VoronPathSetting journalPath, IoChangesNotifications ioChangesNotifications, CatastrophicFailureNotification catastrophicFailureNotification) in C:\Builds\RavenDB-4.0-Beta\src\Voron\StorageEnvironmentOptions.cs:line 276
at Voron.StorageEnvironmentOptions.ForPath(String path, String tempPath, String journalPath, IoChangesNotifications ioChangesNotifications, CatastrophicFailureNotification catastrophicFailureNotification) in C:\Builds\RavenDB-4.0-Beta\src\Voron\StorageEnvironmentOptions.cs:line 230
at Raven.Server.Documents.Indexes.Index.Initialize(DocumentDatabase documentDatabase, IndexingConfiguration configuration, PerformanceHintsConfiguration performanceHints) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\Index.cs:line 299
at Raven.Server.Documents.Indexes.MapReduce.Static.MapReduceIndex.CreateNew(IndexDefinition definition, DocumentDatabase documentDatabase) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\MapReduce\Static\MapReduceIndex.cs:line 73
at Raven.Server.Documents.Indexes.IndexStore.HandleStaticIndexChange(String name, IndexDefinition definition) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\IndexStore.cs:line 296
at Raven.Server.Documents.Indexes.IndexStore.HandleChangesForStaticIndexes(DatabaseRecord record, Int64 etag) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\IndexStore.cs:line 208
The index is shown twice in the index list - one time under Orders, one time as faulty under Other.
The index cannot be queried:
Error querying index
Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Raven.Server.Documents.Indexes.Index.GetIndexEtag() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\Index.cs:line 2170
at Raven.Server.Documents.Queries.QueryRunner.<ExecuteQuery>d__3.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Queries\QueryRunner.cs:line 59
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Server.Documents.Handlers.QueriesHandler.<Query>d__3.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Handlers\QueriesHandler.cs:line 142
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Server.Documents.Handlers.QueriesHandler.<Get>d__1.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Handlers\QueriesHandler.cs:line 99
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Raven.Server.Routing.RequestRouter.<HandlePath>d__5.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Routing\RequestRouter.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
at Raven.Server.RavenServerStartup.<RequestHandler>d__12.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\RavenServerStartup.cs:line 154
The index cannot be edited:
Could not find Orders/ByCompany index
The index cannot be reset:
Failed to reset index: Orders/ByCompany
Definition of a faulty 'Orders/ByCompany' index does not support that
System.NotSupportedException: Definition of a faulty 'Orders/ByCompany' index does not support that
at Raven.Server.Documents.Indexes.Errors.FaultyIndexDefinition.GetOrCreateIndexDefinitionInternal() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\Errors\FaultyIndexDefinition.cs:line 22
at Raven.Server.Documents.Indexes.IndexDefinitionBase.ConvertToIndexDefinition(Index index) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\IndexDefinitionBase.cs:line 239
at Raven.Server.Documents.Indexes.IndexStore.ResetIndexInternal(Index index) in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Indexes\IndexStore.cs:line 816
at Raven.Server.Documents.Handlers.IndexHandler.Reset() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Documents\Handlers\IndexHandler.cs:line 350
at Raven.Server.Routing.RequestRouter.<HandlePath>d__5.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\Routing\RequestRouter.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
at Raven.Server.RavenServerStartup.<RequestHandler>d__12.MoveNext() in C:\Builds\RavenDB-4.0-Beta\src\Raven.Server\RavenServerStartup.cs:line 154
In effect, the index definition cannot be retrieved from the server (can it? how?) and the index doesn't work anymore.