Hi Adam,
the bucket “synsystem” has about 21k documents for which the SG import function returns true (not ~1k as I wrote previously, sorry). I deleted the db from SG and created it again, counting the _sync documents in various states. Results as follows:
- just after db create, without any config:
{
"$1": 1,
"$2": "_sync:dbconf"
},
{
"$1": 191,
"$2": "_sync:dcp_ck"
},
{
"$1": 1,
"$2": "_sync:cfgind"
},
{
"$1": 2,
"$2": "_sync:cfgnod"
},
{
"$1": 1,
"$2": "_sync:cfgver"
},
{
"$1": 1619167,
"$2": "_sync:unused"
},
{
"$1": 1,
"$2": "_sync:cfgsgr"
},
{
"$1": 1,
"$2": "_sync:cfgpla"
},
{
"$1": 1,
"$2": "_sync:heartb"
},
{
"$1": 1,
"$2": "_sync:seq"
},
{
"$1": 1,
"$2": "_sync:syncda"
}
- 5 minutes after db create, still without any config:
{
"$1": 1,
"$2": "_sync:cfgver"
},
{
"$1": 1,
"$2": "_sync:seq"
},
{
"$1": 1,
"$2": "_sync:cfgind"
},
{
"$1": 4633580,
"$2": "_sync:unused"
},
{
"$1": 310,
"$2": "_sync:dcp_ck"
},
{
"$1": 1,
"$2": "_sync:heartb"
},
{
"$1": 1,
"$2": "_sync:cfgpla"
},
{
"$1": 1,
"$2": "_sync:dbconf"
},
{
"$1": 2,
"$2": "_sync:cfgnod"
},
{
"$1": 1,
"$2": "_sync:cfgsgr"
},
{
"$1": 1,
"$2": "_sync:syncda"
}
- after setting the following config:
{
"name":"synsystem",
"enable_shared_bucket_access": true,
"import_docs": true,
"delta_sync": {
"enabled": true,
"rev_max_age_seconds": 28800
},
"guest": {
"disabled": true
},
"allow_conflicts": false,
"revs_limit": 20,
"compact_interval_days": 1
}
{
"$1": 1,
"$2": "_sync:cfgpla"
},
{
"$1": 1,
"$2": "_sync:cfgind"
},
{
"$1": 1,
"$2": "_sync:seq"
},
{
"$1": 27,
"$2": "_sync:rev:sy"
},
{
"$1": 1,
"$2": "_sync:dbconf"
},
{
"$1": 1,
"$2": "_sync:cfgver"
},
{
"$1": 1,
"$2": "_sync:rev:e2"
},
{
"$1": 1,
"$2": "_sync:cfgsgr"
},
{
"$1": 1024,
"$2": "_sync:dcp_ck"
},
{
"$1": 937195,
"$2": "_sync:unused"
},
{
"$1": 135,
"$2": "_sync:rev:sc"
},
{
"$1": 1,
"$2": "_sync:rev:au"
},
{
"$1": 1,
"$2": "_sync:heartb"
},
{
"$1": 1,
"$2": "_sync:rev:1e"
},
{
"$1": 1,
"$2": "_sync:syncda"
},
{
"$1": 2,
"$2": "_sync:cfgnod"
}
- after setting the import function:
function(doc) {
if (!doc.form && doc._deleted === true) {
return true;
}
if (!doc.$_meta) return false;
if (doc.$_meta.type === "notification") {
return true;
}
return false
}
{
"$1": 1,
"$2": "_sync:rev:1a"
},
{
"$1": 1,
"$2": "_sync:cfgind"
},
{
"$1": 275,
"$2": "_sync:rev:sc"
},
{
"$1": 4,
"$2": "_sync:rev:51"
},
{
"$1": 1,
"$2": "_sync:cfgver"
},
{
"$1": 1,
"$2": "_sync:cfgsgr"
},
{
"$1": 1,
"$2": "_sync:dbconf"
},
{
"$1": 64,
"$2": "_sync:rev:sy"
},
{
"$1": 1,
"$2": "_sync:seq"
},
{
"$1": 1,
"$2": "_sync:rev:08"
},
{
"$1": 1,
"$2": "_sync:rev:5f"
},
{
"$1": 1,
"$2": "_sync:rev:8c"
},
{
"$1": 3,
"$2": "_sync:rev:1e"
},
{
"$1": 1,
"$2": "_sync:rev:95"
},
{
"$1": 1,
"$2": "_sync:rev:e2"
},
{
"$1": 1024,
"$2": "_sync:dcp_ck"
},
{
"$1": 1,
"$2": "_sync:rev:3a"
},
{
"$1": 1,
"$2": "_sync:cfgpla"
},
{
"$1": 1,
"$2": "_sync:syncda"
},
{
"$1": 3,
"$2": "_sync:rev:au"
},
{
"$1": 1,
"$2": "_sync:rev:49"
},
{
"$1": 2,
"$2": "_sync:cfgnod"
},
{
"$1": 1,
"$2": "_sync:heartb"
},
{
"$1": 1,
"$2": "_sync:rev:b4"
},
{
"$1": 470928,
"$2": "_sync:unused"
}
- focused on rev and unused types, after 2 minutes:
unused: 45324
rev: 397
- focused on rev and unused types, after 4 minutes:
unused: 60
rev: 484
total _sync documents: 1578
total docs imported by SG: 21170
It’s very early in the morning and there is few activity in our applications. Yesterday in the late afternoon I had millions of _sync documents in that bucket before I deleted the db from SG, and that number seemed to be persistent. I will continue monitoring the numbers during the day.
One interesting question is: what are the _sync:unused documents?