RavenDB 4 - Unable to edit index

190 views
Skip to first unread message

Andrej Krivulčík

unread,
Sep 12, 2017, 11:26:31 AM9/12/17
to RavenDB - 2nd generation document database
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:
  1. Create a new database with Northwind data (I created two: http://4.live-test.ravendb.net/studio/index.html#databases/documents?&database=northwind-test-andrej and http://4.live-test.ravendb.net/studio/index.html#databases/documents?&database=northwind-test-andrej2 ).
  2. Edit the index Orders/ByCompany (I changed the Count = 1 to Count = 2 in Map part).
  3. The index is correctly saved and works correctly. It can be queried, the counts are double as expected, and the index is not stale so I assume that it is deployed. The indexing performance screen doesn't show any meaningful data, I'm not sure if this is important.
  4. Edit the index Orders/ByCompany again (I changed the Count = 2 back to Count = 1).
  5. The index seems to be saved correctly (green confirmation message is shown), but it's not.
The following indexing error is created (note the MinValue in Timestamp):
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.

Oren Eini (Ayende Rahien)

unread,
Sep 12, 2017, 2:08:02 PM9/12/17
to ravendb
Yes, this is a known issue that will be fixed when we upgrade live test to the RC release.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Klaus

unread,
Jun 18, 2018, 1:57:59 AM6/18/18
to RavenDB - 2nd generation document database
Had a similar exception on v4.0.5 (see attached call stack)
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
RavenDb4 Access denied error.log

Oren Eini (Ayende Rahien)

unread,
Jun 18, 2018, 6:19:45 AM6/18/18
to ravendb
Something locked the file? Do you have two dbs with the same path?
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Victor Potatis Maximus

unread,
Jul 12, 2018, 4:10:45 PM7/12/18
to RavenDB - 2nd generation document database
Would the current setup cause this issue?
Server\RavenData\Databases\db1
Server\RavenData\Databases\db2
Server\RavenData\Databases\db3

I'm currently experiencing this issue on 4.0.3.
Thanks

Oren Eini (Ayende Rahien)

unread,
Jul 13, 2018, 4:25:59 AM7/13/18
to ravendb
Did you define any custom temp paths? 
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages