During replication from a 3.5 server to a 5 server, one of the documents somehow got corrupted in the target database. Any attempt to open it or to do anything with it results in the following:
System.IO.InvalidDataException: Properties offset not valid
at Sparrow.Json.BlittableJsonReaderObject.ThrowInvalidPropertiesOffest() in C:\Builds\RavenDB-Stable-5.0\50017\src\Sparrow\Json\BlittableJsonReaderObject.cs:line 1332
at Sparrow.Json.BlittableJsonReaderObject..ctor(Byte* mem, Int32 size, JsonOperationContext context) in C:\Builds\RavenDB-Stable-5.0\50017\src\Sparrow\Json\BlittableJsonReaderObject.cs:line 90
at Raven.Server.Documents.DocumentsStorage.Get(DocumentsOperationContext context, Slice lowerId, DocumentFields fields, Boolean throwOnConflict, Boolean skipValidationInDebug) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\DocumentsStorage.cs:line 1043
at Raven.Server.Documents.DocumentsStorage.Get(DocumentsOperationContext context, String id, DocumentFields fields, Boolean throwOnConflict) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\DocumentsStorage.cs:line 1039
at Raven.Server.Documents.Handlers.DocumentHandler.GetDocumentsByIdAsync(DocumentsOperationContext context, StringValues ids, Boolean metadataOnly) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\Handlers\DocumentHandler.cs:line 230
at Raven.Server.Documents.Handlers.DocumentHandler.Get() in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\Handlers\DocumentHandler.cs:line 122
at Raven.Server.Routing.RequestRouter.HandlePath(RequestHandlerContext reqCtx) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Routing\RequestRouter.cs:line 196
at Raven.Server.RavenServerStartup.RequestHandler(HttpContext context) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\RavenServerStartup.cs:line 243
It can't be opened, it can't be deleted, new document with its id can't be created (to replace it), it breaks replication within the cluster.
When trying to delete the whole collection:
var operation =
await session.Advanced.DocumentStore.Operations.SendAsync(
new DeleteByQueryOperation(new IndexQuery {Query = "from 'Cache`1'"}));
await operation.WaitForCompletionAsync(TimeSpan.FromMinutes(1));
I get a different error:
Specified argument was out of the range of valid values. (Parameter 'System.ArgumentOutOfRangeException: Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. (Parameter 'ticks')
at System.DateTime..ctor(Int64 ticks)
at Raven.Server.Documents.DocumentsStorage.ParseDocumentPartial(JsonOperationContext context, TableValueReader& tvr, DocumentFields fields) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\DocumentsStorage.cs:line 1393
at Raven.Server.Documents.DocumentsStorage.GetDocumentsFrom(DocumentsOperationContext context, String collection, Int64 etag, Int64 start, Int64 take, DocumentFields fields)+MoveNext() in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\DocumentsStorage.cs:line 945
at Raven.Server.Documents.CollectionRunner.ExecuteOperation(String collectionName, Int64 start, Int64 take, CollectionOperationOptions options, DocumentsOperationContext context, Action`1 onProgress, Func`2 action, OperationCancelToken token) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\CollectionRunner.cs:line 86
at Raven.Server.Documents.Queries.QueryRunner.ExecuteDeleteQuery(IndexQueryServerSide query, QueryOperationOptions options, QueryOperationContext queryContext, Action`1 onProgress, OperationCancelToken token) in C:\Builds\RavenDB-Stable-5.0\50017\src\Raven.Server\Documents\Queries\QueryRunner.cs:line 265
The server at https://b.fs.ravendb.community responded with status code: InternalServerError.')
The document is a cached document and is not very important to us. Even the whole collection can be deleted if possible. It's just cache in this case.
Is there a way to delete the document directly from Voron storage, without the need to deserialize it?
I'll try to reproduce this behavior later but now we want to move forward with the migration as soon as possible so just getting rid of the document from the storage should be sufficient solution.
I already did several attempts to reproduce, but without success:
- When I take the source document from the 3.5 database and create it manually in a 5 database, it works okay.
- When I take the source document, create it manually in an empty 3.5 database and set up replication to a 5 database, it works okay.