In my app sometimes when a document with attachment is pulled I get next warning:
19:06:15.987‖ WARNING: CBL_Puller[
http://localhost:5984/a] failed to write {my_doc_id #4-a0716cf34b240d1dec1ef7ada408063e}: status=491
As result the pull replication is stopped. Moreover it is impossible to start pull replication even it use start or restart methods.
Next steps show how reproduce it in 'CBL iOS Test App' (sha commit: 9aa3bce43341d42df014595fdfbdb3bdc9f29e61)
- Configure the app with syncpoint
- Launch the application and create a document with attachment (see 'createDocument With Attachment' below). The document is pushed to the server.
- Stop application
- Change document many times in the server (more than one time)
- Start the app
When the app start it can't pull revision from remote server.
Sample code for create document with attachment (I call it from viewWillAppear):
- (void)createDocumentWithAttachment
{
NSString *docId = @"my_doc_id";
CBLDatabase *db = self.database;
CBLDocument *doc = [db documentWithID:docId];
CBLSavedRevision *rev = [doc putProperties:@{@"key":@"value"} error:nil];
NSLog(@"rev = %@", rev.revisionID);
NSString* str = @"teststring";
NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];
NSString *contentType = @"text/plain";
CBLSavedRevision *currentRevision = rev;
CBLUnsavedRevision *unsavedRevision = [currentRevision createRevision];
[unsavedRevision setAttachmentNamed:@"my_attachment" withContentType:contentType content:data];
currentRevision = [unsavedRevision save:nil];
NSLog(@"%@", currentRevision.revisionID);
}
Second time launch application file log is in attachment (use CBLDatabase, ChangeTracker, RemoteRequest, Sync log chanels)
It occurs when I use SQLite and ForestDB data storage.