So, if I have one class that creates a new Document store, but two
separate import methods that could use different KeyGenerators, will
the separate sessions use the Conventions configured when the session
is created or do I need separate DocumentStore instances for each
KeyGenerator configuration?
Also, I changed to using Async calls and now I get this error. Worked
fine synchronously. Is there any other consideration besides changing
the session type and save changes method calls? It only occurs a
couple times in the thousand calls to StoreChangesAsync.
System.InvalidOperationException: Collection was modified; enumeration
operation may not execute.
at
System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator.MoveNext()
at Raven.Json.Linq.DictionaryWithParentSnapshot.get_Keys() in c:
\Builds\raven\Raven.Abstractions\Json\Linq\Dictionary
WithParentSnapshot.cs:line 86
at Raven.Json.Linq.DictionaryWithParentSnapshot.get_Count() in c:
\Builds\raven\Raven.Abstractions\Json\Linq\Dictionar
yWithParentSnapshot.cs:line 236
at Raven.Json.Linq.RavenJObject.get_Count() in c:\Builds\raven
\Raven.Abstractions\Json\Linq\RavenJObject.cs:line 30
at Raven.Json.Linq.RavenJToken.DeepEquals(RavenJToken other) in c:
\Builds\raven\Raven.Abstractions\Json\Linq\RavenJTo
ken.cs:line 266
at Raven.Json.Linq.RavenJToken.DeepEquals(RavenJToken t1,
RavenJToken t2) in c:\Builds\raven\Raven.Abstractions\Json\
Linq\RavenJToken.cs:line 220
at
Raven.Client.Document.InMemoryDocumentSessionOperations.EntityChanged(Object
entity, DocumentMetadata documentMeta
data) in c:\Builds\raven\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:line 904
at
Raven.Client.Document.InMemoryDocumentSessionOperations.<PrepareForEntitiesPuts>b__18(KeyValuePair`2
pair) in c:\B
uilds\raven\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:line 783
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at
Raven.Client.Document.InMemoryDocumentSessionOperations.PrepareForEntitiesPuts(SaveChangesData
result) in c:\Build
s\raven\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:line 783
at
Raven.Client.Document.InMemoryDocumentSessionOperations.PrepareForSaveChanges()
in c:\Builds\raven\
Raven.Client.Li
ghtweight\Document\InMemoryDocumentSessionOperations.cs:line 776
at
Raven.Client.Document.Async.AsyncDocumentSession.SaveChangesAsync() in
c:\Builds\raven\Raven.Client.Lightweight\Do
cument\Async\AsyncDocumentSession.cs:line 207
at Vovici.CMDB.Helpers.MTALogImporter.ImportProcessLog(String path)
in C:\perforce\netops\learning\Vovici.CMDB.Helper
s\Vovici.CMDB.Helpers\MTALogImporter.cs:line 146 SaveChanges exception
caught at record 5120.
On Feb 2, 12:42 pm, "Oren Eini (Ayende Rahien)" <
aye...@ayende.com>
wrote:
> Chris,
> Create your own HiLoGenerator, and explicitly assign the ids, it will work.
>
>
>
>
>
>
>
> On Thu, Feb 2, 2012 at 5:55 PM, Chris Marisic <
ch...@marisic.com> wrote:
> > For doing the bulk insert, is it only possible to edit the document store
> > conventions as opposed to changing things on a specific session?
>
> > It seems reasonable that you would want to be able to check out a big
> > block of keys for doing a bulk load of 10K+ 100K+ things without it
> > impacting every other session.
>
> > On Thursday, February 2, 2012 10:24:41 AM UTC-5, Chris H. wrote:
>
> >> The HiLoKeyGenerator code seems to speed things up a good bit. From
> >> around 61k/min to 100k/min. I actually set it to 10240 since most
> >> operations are on over one hundred-thousand documents at a time. Do
> >> you have any advice on the use/abuse of this method?
>
> >> I've dropped and restarted populating the database from scratch,
> >> taking note of metrics this time around, so I'll report back when I
> >> get back up to around 2 million docs if I see any changes.
>
> >> On Feb 1, 6:31 pm, "Oren Eini (Ayende Rahien)" <
aye...@ayende.com>
> >> wrote:
> >> > Can you reproduce the slow inserts? Is there anything that you can
> >> think
> >> > that would be causing this?
>
> >> > If you care to do a big import job, you might want to do this:
>
> >> > var multiTypeHiLoKeyGenerator = new MultiTypeHiLoKeyGenerator(**store,
> >> 1024);
> >> > store.Conventions.**DocumentKeyGenerator = o =>
> >> > multiTypeHiLoKeyGenerator.**GenerateDocumentKey(store.**Conventions,