pre-built database retaining deleted documents

41 views
Skip to first unread message

Gavin Fowler

unread,
Mar 5, 2015, 7:31:39 PM3/5/15
to mobile-c...@googlegroups.com
I recently got a pre-built database bundled in with my app and loading on first run with help from the couchbase forum.  


I posed this question over there at the bottom of my post, but haven't gotten a response.  For some reason, only when using the pre-built database, deleting our documents from sync_gateway does not propagate to my app.  We want to bundle a few documents and their attachments with our application, but for various reasons we may need to remove one or more of the items that we bundle in.  If we don't use the pre-built database, our pull replication performs as I would expect, and the documents are removed.  Are there any general things to look for here?  

Jens Alfke

unread,
Mar 5, 2015, 7:39:06 PM3/5/15
to mobile-c...@googlegroups.com
This is a CBL/.NET issue, so I’m not the best person to diagnose it, but the best way to start would probably be to turn on logging. Not sure how you do that, but hopefully there are docs about that?

—Jens

Gavin Fowler

unread,
Mar 13, 2015, 3:01:01 PM3/13/15
to mobile-c...@googlegroups.com
I've added some arguments to our script that launches sync_gateway.  It now looks like this...

nohup /opt/couchbase-sync-gateway/bin/sync_gateway -verbose=true -log="SYNCVERBOSE,SYNC" gateway.conf.json > /tmp/sync.log &

...and we get HTTP and HTTP+ messages in the log, but nothing that indicates a sync error.  I tried with camel case Sync, and SyncVerbose, but didn't see a difference in the logs.  The only thing that did make a differense was the -verbose=true flag, which added the HTTP+ log messages with response times.  

We are also monitoring our pull and push replicators on the client, and don't see a whole lot of meaningful messages there either, but I'm going to make another attempt at reproducing and watch the logs on both sides.  Any other potential suggestions?

Jens Alfke

unread,
Mar 13, 2015, 3:42:30 PM3/13/15
to mobile-c...@googlegroups.com

On Mar 13, 2015, at 12:01 PM, Gavin Fowler <gavin....@zyamusic.com> wrote:

I've added some arguments to our script that launches sync_gateway.  It now looks like this...

I was suggesting turning on logging on the client side.

I tried with camel case Sync, and SyncVerbose, but didn't see a difference in the logs. 

Those aren’t logging keywords known to Sync Gateway. iOS uses them, and maybe .NET too.

—Jens

Gavin Fowler

unread,
Mar 13, 2015, 6:37:07 PM3/13/15
to mobile-c...@googlegroups.com
I added some logging to our database Changed notification.  It looks like we are getting a DocumentChange notification for the deleted documents, IsCurrentRevision is false.  I'm guessing I need to resolve that somehow.   

Gavin Fowler

unread,
Mar 13, 2015, 8:21:16 PM3/13/15
to mobile-c...@googlegroups.com
Added the following to my database.Changed handler, and documents are deleting correctly now.

database.Changed += (sender, e) => {
                foreach (DocumentChange change in e.Changes) 
                {  

                    if(change.IsCurrentRevision == false)
                    {
                        var changedoc = database.GetExistingDocument(change.DocumentId);
                        changedoc.CurrentRevision.DeleteDocument();
                    }
                }
            };
  
Reply all
Reply to author
Forward
0 new messages