我正在使用大容量插入将具有“ session / 1 / 0000000000000000020-A”之类的ID的文档“复制”到具有新ID的数据库:
try
{
//Insert new items.
using (var bulkInsert = DocumentStoreHolder.Store.BulkInsert())
{
foreach (var sessionItem in storedItems)
{
var attDoc = (AttributeDoc) sessionItem;
if (attDoc.Value == "00000032")
{
var x = 0; //dummy code to set a breakpoint.
}
sessionItem.StorageId = null; //Id is NULLED here.
bulkInsert.Store(sessionItem);
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
我的文档中的“值”从“ 00000000”到“ 00000050”。复制文档直到达到“ Value = 00000032”的文档。此时
bulkInsert.Store(sessionItem)
似乎永远不会回来。我没有例外。 在Studio中,我看到以下内容:
仅供参考:“我的RavenDB Id”字段已映射到StorageId。
store.Conventions.FindIdentityProperty = memberInfo => memberInfo.Name == nameof(BaseDoc.StorageId);
我仍在尝试通过一个小例子来重现这一点...
版本:4.1.4-patch-41008
对此有何想法?
更新: 如果我杀死了我的应用程序,我会在Raven-Studio的日志中看到以下异常:
failed to process bulk insert Inserted 32 documents in 11 batches. Last document id: 'AttributeDocs/160-A'
System.InvalidOperationException: Failed to process bulk insert Inserted 32 documents in 11 batches. Last document id: 'AttributeDocs/160-A' ---> Microsoft.AspNetCore.Connections.ConnectionResetException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen ---> System.Net.Sockets.SocketException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitable.GetResult()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives()
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive()
--- End of inner exception stack trace ---
at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1MessageBody.PumpAsync()
at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken)
at Raven.Client.Extensions.TaskExtensions.<>c__3`1.<WithCancellation>b__3_0(Task`1 t) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Client\Extensions\TaskExtensions.cs:line 36
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at Raven.Server.Documents.Handlers.BatchRequestParser.RefillParserBuffer(Stream stream, ManagedPinnedBuffer buffer, UnmanagedJsonParser parser, CancellationToken token) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Documents\Handlers\BatchRequestParser.cs:line 965
at Raven.Server.Documents.Handlers.BatchRequestParser.ReadMany.MoveNextUnlikely(JsonOperationContext ctx) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Documents\Handlers\BatchRequestParser.cs:line 314
at Raven.Server.Documents.Handlers.BulkInsertHandler.DoBulkInsert(Action`1 onProgress, CancellationToken token) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Documents\Handlers\BulkInsertHandler.cs:line 96
--- End of inner exception stack trace ---
at Raven.Server.Documents.Handlers.BulkInsertHandler.DoBulkInsert(Action`1 onProgress, CancellationToken token) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Documents\Handlers\BulkInsertHandler.cs:line 141
at Raven.Server.Documents.Handlers.BulkInsertHandler.BulkInsert() in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Documents\Handlers\BulkInsertHandler.cs:line 28
at Raven.Server.Routing.RequestRouter.HandlePath(RequestHandlerContext reqCtx) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\Routing\RequestRouter.cs:line 124
at Raven.Server.RavenServerStartup.RequestHandler(HttpContext context) in C:\Builds\RavenDB-4.1-Patch\41008\src\Raven.Server\RavenServerStartup.cs:line 173
更新2:
如果我不不将StorageId设置为空
sessionItem.StorageId = null; //Id is NULLED here.
BulkInsert有效。但是,那当然是毫无意义的。
Update3 :
我猜想,客户端无法绘制新的HiLo数字。如果我使用“ someId /”,则每个文档都存储良好。
更新4:
mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)
mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)
mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task)
Raven.Client.dll!Raven.Client.Util.AsyncHelpers.RunSync<string>(System.Func<System.Threading.Tasks.Task<string>> task) Line 133
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Util\AsyncHelpers.cs(133)
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation..ctor.AnonymousMethod__1(object entity) Line 214
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(214)
Raven.Client.dll!Raven.Client.Documents.Identity.GenerateEntityIdOnTheClient.GetOrGenerateDocumentId(object entity) Line 58
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\Identity\GenerateEntityIdOnTheClient.cs(58)
Raven.Client.dll!Raven.Client.Documents.Identity.GenerateEntityIdOnTheClient.GenerateDocumentIdForStorage(object entity) Line 83
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\Identity\GenerateEntityIdOnTheClient.cs(83)
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation.GetId(object entity) Line 490
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(490)
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation.StoreAsync(object entity, Raven.Client.Documents.Session.IMetadataDictionary metadata) Line 256
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(256)
GrpcAkka.Server.exe!GrpcAkka.Server.Impl.SessionsImpl.SaveSession(SaveSessionRequest request, Grpc.Core.ServerCallContext context) Line 175
at C:\Users\KingKnecht\Documents\Visual Studio 2017\Projects\GrpcAkka\GrpcAkka.Server\Impl\SessionsImpl.cs(175)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()
mscorlib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<string>.SetResult(string result)
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation.StoreAsync(object entity, Raven.Client.Documents.Session.IMetadataDictionary metadata) Line 262
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(262)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation.StoreAsync(object entity, string id, Raven.Client.Documents.Session.IMetadataDictionary metadata) Line 380
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(380)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult> completedTask)
Raven.Client.dll!Raven.Client.Documents.BulkInsert.BulkInsertOperation.WaitForId() Line 242
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\BulkInsert\BulkInsertOperation.cs(242)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.VoidTaskResult result)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()
Raven.Client.dll!Raven.Client.Http.RequestExecutor.ExecuteAsync<long>(Raven.Client.Http.ServerNode chosenNode, int? nodeIndex, Sparrow.Json.JsonOperationContext context, Raven.Client.Http.RavenCommand<long> command, bool shouldRetry, Raven.Client.Documents.Session.SessionInfo sessionInfo, System.Threading.CancellationToken token) Line 823
at C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Http\RequestExecutor.cs(823)
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.ExecuteWorkItemHelper()
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Async Call Stack]
[Async] Grpc.Core.dll!Grpc.Core.Internal.UnaryServerCallHandler<SaveSessionRequest, SaveSessionReply>.HandleCall(Grpc.Core.Internal.ServerRpcNew newRpc, Grpc.Core.Internal.CompletionQueueSafeHandle cq)
[Async] Grpc.Core.dll!Grpc.Core.Server.HandleCallAsync(Grpc.Core.Internal.ServerRpcNew newRpc, Grpc.Core.Internal.CompletionQueueSafeHandle cq, System.Action continuation)
UPDATE5: Fiddler Session