0

我创建了一个数据迁移工具,它从旧版 SQL 数据库中读取数据,将其转换为更合理的数据,然后将其存储在 RavenDB 中。

当我尝试在单个 Raven 会话中写入 22500 个 1KB 对象时,我收到以下错误:

System.InvalidOperationException: Could not replicate POST operation to secondary node, failover behavior is: AllowReadsFromSecondaries

该消息表明 Master Raven 实例遇到致命错误,迁移工具故障转移到 Slave Slave Raven 实例并尝试对其进行写入。我不知道是为什么。

背景资料:

  • .NET 4.0
  • RavenDB #2025-Unstable(由于依赖 Json.NET,无法使用稳定版本)
  • 使用 RavenDB 复制包(复制配置正确)
  • 写入操作包含在 TransactionScope 中(迁移工具的其他地方使用单独的 Raven 会话进行写入)
  • Windows 事件日志中没有错误

登录 Master Raven 实例包含以下错误:

System.Threading.ThreadAbortException: Thread was being aborted.
   at Microsoft.Isam.Esent.Interop.Implementation.NativeMethods.JetSeek(IntPtr sesid, IntPtr tableid, UInt32 grbit)
   at Microsoft.Isam.Esent.Interop.Implementation.JetApi.JetSeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\JetApi.cs:line 3172
   at Microsoft.Isam.Esent.Interop.Api.TrySeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\MoveHelpers.cs:line 127
   at Raven.Storage.Esent.StorageActions.DocumentStorageActions.EnsureDocumentIsNotCreatedInAnotherTransaction(String key, Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Util.cs:line 77
   at Raven.Storage.Esent.StorageActions.DocumentStorageActions.AddDocument(String key, Nullable`1 etag, RavenJObject data, RavenJObject metadata) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Documents.cs:line 296
   at Raven.Database.DocumentDatabase.<>c__DisplayClass37.<Put>b__30(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 480
   at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 328
   at Raven.Database.DocumentDatabase.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 468
   at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__64(DocumentInTransactionData doc) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 654
   at Raven.Storage.Esent.StorageActions.DocumentStorageActions.CompleteTransaction(Guid txId, Action`1 perDocumentModified) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\General.cs:line 272
   at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__63(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 658
   at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 374
   at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 334
   at Raven.Database.DocumentDatabase.Commit(Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 668
   at Raven.Database.Server.Responders.TransactionCommit.Respond(IHttpContext context) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\Responders\TransactionCommit.cs:line 28
   at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 582
   at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 347

使用带有复制的事务时,每个会话的写入次数是否有上限?
这可能是使用不稳定构建的结果吗?

编辑:在 RavenDB 谷歌群组上交叉发布:https ://groups.google.com/forum/?fromgroups#!starred/ravendb/FZZ_Q1y59qI

4

1 回答 1

0

看起来这可能是一个错误。提供了一个repro,所以希望开发团队的人会调查它。

有关更多信息,请参阅 RavenDB Google 群组线程https://groups.google.com/forum/?fromgroups#!starred/ravendb/FZZ_Q1y59qI

随着更多信息的可用,将更新此答案。

更新:不支持在单个 DTC 会话中写入这么多对象:https ://groups.google.com/d/msg/ravendb/FZZ_Q1y59qI/fimWkX8NZm0J

于 2012-07-11T22:43:02.117 回答