System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation

Oct 8, 2015 at 8:57 PM
I have done some tests to understand how it works. Now I started to import some information from my relational database Raptordb.
Importing about one hundred thousand entities have a problem of rebuilding the index.

This is the log:

RaptorDB starting...

2015-10-08 22:43:41|DEBUG|10|RaptorDB.RaptorDB|| RaptorDB data folder = C:\Studi\Raptordb\DocsMarshal\bin\Debug\data\
2015-10-08 22:43:41|DEBUG|10|RaptorDB.KeyStore1|| Current Count = 119.179
2015-10-08 22:43:41|DEBUG|10|RaptorDB.KeyStore
1|| Checking Index state...
2015-10-08 22:43:41|DEBUG|10|RaptorDB.KeyStore1|| Rebuilding index...
2015-10-08 22:43:41|DEBUG|10|RaptorDB.KeyStore
1|| last index count = 70
2015-10-08 22:43:41|DEBUG|10|RaptorDB.KeyStore1|| data items count = 119179
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore
1|| 100,000 items re-indexed
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore1|| Rebuild index done.
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore
1|| Starting save timer
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore1|| Current Count = 0
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore
1|| Checking Index state...
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore1|| Starting save timer
2015-10-08 22:43:47|DEBUG|10|RaptorDB.Views.TaskQueue|| TaskQueue starting
2015-10-08 22:43:47|DEBUG|10|RaptorDB.Hoot|| Starting hOOt....
2015-10-08 22:43:47|DEBUG|10|RaptorDB.Hoot|| Storage Folder = C:\Studi\Raptordb\DocsMarshal\bin\Debug\data\Data\Fulltext\
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore
1|| Current Count = 0
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore1|| Checking Index state...
2015-10-08 22:43:47|DEBUG|10|RaptorDB.KeyStore
1|| Starting save timer
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Hoot|| Word Count = 10
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Views.ViewHandler|| Last shutdown failed, rebuilding view : List Of Profiles
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Views.ViewHandler|| RaptorDB view engine upgrade, rebuilding view : List Of Profiles
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Views.ViewHandler|| Deleting old view data folder = List Of Profiles
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Hoot|| Starting hOOt....
2015-10-08 22:43:48|DEBUG|10|RaptorDB.Hoot|| Storage Folder = C:\Studi\Raptordb\DocsMarshal\bin\Debug\data\Views\List Of Profiles\
2015-10-08 22:43:48|DEBUG|3|RaptorDB.Views.ViewHandler|| Rebuilding view from scratch...
2015-10-08 22:43:48|DEBUG|3|RaptorDB.Views.ViewHandler|| View = List Of Profiles
2015-10-08 22:43:48|ERROR|3|RaptorDB.Views.ViewHandler|| Rebuilding View failed : List Of Profiles
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at RaptorDB.Views.ViewHandler.IndexRow(Guid docid, Object[] row, Int32 rownum)
at RaptorDB.Views.ViewHandler.InsertRowsWithIndexUpdate(Guid guid, List1 rows)
at RaptorDB.Views.ViewHandler.SaveAndIndex(Dictionary
2 rows)
at RaptorDB.Views.ViewHandler.Insert[T](Guid guid, T doc)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at RaptorDB.Views.ViewHandler.RebuildFromScratch(IDocStorage`1 docs)
2015-10-08 22:44:00|DEBUG|14|RaptorDB.RaptorDB|| byte[] is null
2015-10-08 22:44:00|DEBUG|14|RaptorDB.RaptorDB|| curr rec = 119179
2015-10-08 22:44:00|DEBUG|14|RaptorDB.RaptorDB|| last rec = 119179
Oct 8, 2015 at 9:26 PM
I think I understand the reason for the failure.
Before importing the new objects have changed the schema of view by adding a new string field. (I did not think there were problems in that it increased the number of the version of View)
Now I tried to take the field again and RaptorDb regenerated correctly View.
I then tried to reAdd the field in view and boom ....

I hope which this report will help you to find the bug.

Oct 8, 2015 at 9:33 PM
Forgive me, the fault is mine ..
I had forgotten to add the new field to the call Api.Emit in the function Mapper in the View.

(I suggest to handle this type of error with a clearer message to the user?)