CBlite replication - Channels removed from document aresyncing

Hello,

We are running tests on limiting the data being synced to the mobile and are facing an issue with documents being synced even after the channel has been removed from the document.

CBLite version: 2.8
SyncGateway Version: 2.0.0

Sync Function for setting the channel:

if (doc.removeChannel) {
  channel('sync_remove');
} else {
  channel(['sync1', 'sync23']);
}

The created document looks like this,

[
  {
    "certrax": {
      "_sync": {
        "cas": "",
        "channels": {
          "sync1": null,
          "sync23": null
        },
        "history": {
          "channels": [
            [
              "sync1",
              "sync23"
            ]
          ],
          "parents": [
            -1
          ],
          "revs": [
            "1-f9fc4a537c66fa41a899ef758a021118"
          ]
        },
        "recent_sequences": [
          406419
        ],
        "rev": "1-f9fc4a537c66fa41a899ef758a021118",
        "sequence": 406419,
        "time_saved": "2022-06-10T08:53:36.728361525Z"
      },
      "date": "2022-06-10",
      "type": "_fh_dummy_data_channel_doc"
    }
  }
]

And then update the document to remove from the syncing channel. Now the document sync data looks like below

  {
    "certrax": {
      "_sync": {
        "cas": "",
        "channels": {
          "sync1": {
            "rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
            "seq": 406420
          },
          "sync23": {
            "rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
            "seq": 406420
          },
          "sync_remove": null
        },
        "history": {
          "channels": [
            [
              "sync1",
              "sync23"
            ],
            [
              "sync_remove"
            ]
          ],
          "parents": [
            -1,
            0
          ],
          "revs": [
            "1-f9fc4a537c66fa41a899ef758a021118",
            "2-1c82d431ceaa1b95f0cfb083f3e71597"
          ]
        },
        "recent_sequences": [
          406419,
          406420
        ],
        "rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
        "sequence": 406420,
        "time_saved": "2022-06-10T08:55:54.584117658Z"
      },
      "date": "2022-06-10",
      "removeChannel": true,
      "type": "_fh_dummy_data_channel_doc"
    }
  }
]

When we start the “fresh” replication by uninstalling and re-installing the application and trying to replicate the “sync1” channel, the above document is being synced.

We are assuming that if a channel is removed from the document or replaced with a new channel name, then the initial sync should not replicate that document.

Are you setting the channels in the replication when starting the replication from Couchbase Lite?

@jayahari.vavachan Yes, we only have specific channels set to sync. And in the above example, ‘sync_remove’ was never part of the replicator configuration.

Hi @pmaganti,

Sync Gateway 2.0.0 reached it’s end of life in April 2022.

Would you be able to see if this issue happens on Sync Gateway 2.8.3 or later?

Thanks

We did tested the same scenario on 2.8.2 and has no issues.

We understand that the SG 2.0 has end of support. But our current production is running on 2.0 and trying to understand if this is a known issue or we are doing something wrong on our end.