Import processing and import filters are separate from the resync operation (which only re-applies the Sync Function to already mobile-aware documents).
Sync Gateway uses a DCP feed to import and cache documents. This feed is a stream of mutation events, and is checkpointed per vbucket to avoid reprocessing data we’ve already seen on startup.
One way you could cause a re-import is to delete the DCP checkpoint docs in the bucket, which will cause Sync Gateway to reprocess all data in the bucket, and your new import filter rules will be applied. For documents already imported, these will be skipped.
There’s one rather large caveat with this … a change to the import filter that excludes documents compared to the previous filter won’t have any affect. This will only work for including new documents, given that imported documents are skipped. If you wish to make a change to exclude documents, you’ll have to manually remove the
_sync xattr from the affected documents in Couchbase Server.
To remove Sync Gateway’s DCP checkpoints:
- Stop all Sync Gateway nodes.
- There will be up to 1024 documents that have a key starting:
_sync:dcp_ck:. These are the per-vbucket checkpoints (e.g:
Delete them from the bucket.
- Also remove the
- Start Sync Gateway back up.