Sync Gateway config.json `revs_limit` key ignored?

141 views
Skip to first unread message

Chris Fuentes

unread,
Aug 29, 2014, 2:38:01 PM8/29/14
to mobile-c...@googlegroups.com
Hi, 

My config.json looks like this:








{


   "interface":":4980",


   "adminInterface":":4981",


   "log":["CRUD", "REST"],


   "databases":{


      "db_5_29_14":{


         "revs_limit" : 50,


         "server":"http://localhost:8091",


         "bucket":"5_29_14",


         "sync":`function(doc) { channel(doc.channels); }`


      }


   }


}


It has been running with this config for about 2 months, yet I see at least one document that has in excess of 3,000 revs (the doc itself is nearly 16,000 lines long, mostly because of revision metadata). I could be imagining things but there seems to be a slight lag whenever interacting with these docs. 

How is 'revs_limit' supposed to work? I assumed it would retroactively remove excess revisions from the doc's _sync field, but maybe I'm wrong? Is there any way to compress the doc size?  Could not find good documentation on this one outside of the go file itself (which didn't have quite enough info to resolve the problem). 

Thanks,
-Chris

Jens Alfke

unread,
Aug 29, 2014, 5:15:05 PM8/29/14
to mobile-c...@googlegroups.com

On Aug 29, 2014, at 11:38 AM, Chris Fuentes <ch...@crowdcomfort.com> wrote:

It has been running with this config for about 2 months, yet I see at least one document that has in excess of 3,000 revs (the doc itself is nearly 16,000 lines long, mostly because of revision metadata).

How are you verifying that its history has 3000 revs? Looking directly at the document in the Couchbase Server bucket would be the most accurate way.

I could be imagining things but there seems to be a slight lag whenever interacting with these docs. 

It's possible. JSON parsing is not cheap.

How is 'revs_limit' supposed to work?

When a document is saved, revisions that are more than revs_limit steps away from a leaf revision get removed from the history. That is, it limits the depth of the revision tree, not the total number of revisions (although the two will be the same unless there are conflicts.)

(This means that lowering "revs_limit" in the config file will not immediately affect existing documents; not until the next time they're saved.)

—Jens

Chris Fuentes

unread,
Aug 30, 2014, 5:56:15 PM8/30/14
to mobile-c...@googlegroups.com
Hey Jens,

So I am looking at the example document in the Couchbase Server bucket directly, and it is in fact quite long. It gets updated almost daily (this is my personal 'user document' which I modify quite often daily as part of app testing). 

Is there any reason why the old revs wouldn't be removed from the doc when it's updated? The sync_gateway has been restarted several times. 

Best,
-Chris

Jens Alfke

unread,
Aug 30, 2014, 8:44:29 PM8/30/14
to mobile-c...@googlegroups.com

On Aug 30, 2014, at 2:56 PM, Chris Fuentes <ch...@crowdcomfort.com> wrote:

So I am looking at the example document in the Couchbase Server bucket directly, and it is in fact quite long. It gets updated almost daily (this is my personal 'user document' which I modify quite often daily as part of app testing). 

Could you email me a copy of the document? Or tell me what part of the structure is really big? (It's the _json/history object that grows with every revision.)

—Jens

Jeremy Kelley

unread,
Apr 29, 2015, 3:34:49 PM4/29/15
to mobile-c...@googlegroups.com
Just want to followup on this old issue. 

I appear to be running into a similar problem.

Whatever came of this?
Reply all
Reply to author
Forward
0 new messages