Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-4216 #24

Merged
merged 4 commits into from Dec 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions modules/ROOT/pages/data-routing.adoc
Expand Up @@ -50,6 +50,32 @@ Creating a xref:sync-function-api.adoc[sync function] is a more flexible way to
A sync function is a JavaScript function that takes a document body as input and, based on the document content, decides what channels to assign the document to.
The sync function cannot reference any external state and must return the same results every time it's called on the same input.

== Channel Count

Every time a document is assigned to a new channel, the channel name is appended to that document's sync metadata.

Therefore, a document's set of channels is bound by the allowed sync metadata size described in the following table.

|===
|`enable_shared_bucket_access: false`|`enable_shared_bucket_access: true`
2+a|*Sync metadata size limit*

|20 MB per document
|1 MB per document
|===

Sync Gateway will assign a document to a new channel as long as the sync metadata remains under the allowed limit.

*What to do when your channel count exceeds the usable space for sync metadata?*

In order to lower the sync metadata size per document, you can do one of the following:

* Lower the number of channels per document.
* Shorten the channel names.
A shorter channel name will occupy less space ("customer==0030169303" vs "cs==0030169303").
* Lower the xref:config-properties.adoc#databases-foo_db-revs_limit[revs_limit] value.
Indeed, a copy of channel metadata is retained for each revision of a document.

=== Replicating channels to Couchbase Lite

If Couchbase Lite doesn't specify any channels to replicate, it gets all the channels to which its user account has access.
Expand Down