Sync Gateway resync not working

I have a Problem bringing my database online after I added a collection to my config.

Couchbase Version: 7.2.4
Sync-Gateway Version: 3.1.6

Issue not resolved: Issue-CBG-3405

Config:

{
    "bucket": "myBucket",
    "import_docs": false,
    "enable_shared_bucket_access": true,
    "num_index_replicas": 0,
    "revs_limit": 250,
    "cache": {
        "channel_cache": {
            "max_wait_pending": 3000,
            "max_num_pending": 500,
            "max_wait_skipped": 300000,
            "enable_star_channel": false,
            "max_length": 250,
            "min_length": 10,
            "expiry_seconds": 300
        },
        "rev_cache": {
            "size": 1000
        }
    },
    "scopes": {
        "_default": {
            "collections": {
                "_default": {
                    "sync": "function (doc, oldDoc) { if(doc._deleted) { return; } channel(doc.channels); }"
                },
                "myCollection": {
                    "sync": "function (doc, oldDoc) { if(doc._deleted) { return; } channel(doc.channels); }"
                }
            }
        }
    }
}

I tried the following steps by following the documentation via the Admin REST Api:

  1. Bring the database offline
  2. Update the config
  3. Resync and wait until it is completed
  4. Bring the database online

Request POST: myHost/myBucket/_resync?regenerate_sequences=true
Request body:

{
  "scopes": {
    "_default": ["_default"]
  },
  "regenerate_sequences": true
}

The resync works fine but I can´t bring the database online because the following error is displayed:

2024-06-04T07:20:47.200Z [ERR] Database has collections that require regenerate_sequences resync before it can go online: [_default._default] -- rest.(*ServerContext).TakeDbOnline() at server_context.go:1290
{
    "db_name": "myBucket",
    "instance_start_time": 1717485687050336,
    "compact_running": false,
    "purge_seq": 0,
    "disk_format_version": 0,
    "state": "Offline",
    "server_uuid": "92ccab065000ea1d315d9e8521ec4035",
    "require_resync": [
        "_default._default"
    ]
}

Related Post: sync-gateway-database-cant-go-online/36313

I would expect this to work, can provide the log files?

There is nothing written in the Debug/Info/Warning log files related to this error. Unfortunately the error is a one liner in the error log file. :hugs:

2024-06-04T07:20:47.200Z [ERR] Database has collections that require regenerate_sequences resync before it can go online: [_default._default] -- rest.(*ServerContext).TakeDbOnline() at server_context.go:1290

I meant the log files from the resync operation.

I can´t put all log message here because they may contain sensetive data.

If I remove the _default collection from the sync-gw db config, then there is no problem to bring the db online.

A possible workaround could be if I move all docs out of the _default collection into another collection.

2024-06-07T06:41:47.855Z [DBG] DCP+: c:#947 db:myDatabase Stream (vb:803) closed, all items streamed
2024-06-07T06:41:47.855Z [DBG] gocb+: DCP agent closing
2024-06-07T06:41:47.855Z [DBG] gocb+: KV Mux closing
2024-06-07T06:41:47.855Z [DBG] gocb+: KV Mux closed
2024-06-07T06:41:47.855Z [DBG] gocb+: Stopping poller controller
2024-06-07T06:41:47.855Z [DBG] gocb+: CCCP Looper stopping
2024-06-07T06:41:47.855Z [DBG] gocb+: CCCP Looper stopped
2024-06-07T06:41:47.855Z [DBG] gocb+: Config seen but CCCP poller exited, restarting CCCP poller.
2024-06-07T06:41:47.855Z [DBG] gocb+: Starting poller controller loop
2024-06-07T06:41:47.855Z [DBG] gocb+: Poller controller stopped, exiting
2024-06-07T06:41:47.855Z [DBG] gocb+: DCP agent close complete
2024-06-07T06:41:47.894Z [INF] c:#947 db:myDatabase [Resync: 2d3247e5-e96b-4a3c-b71b-b14ee5edd2e6] Finished running sync function. 1097/1110 docs changed
2024-06-07T06:41:47.894Z [INF] DCP: c:#947 db:myDatabase DCP Client close called - client is already closing
2024-06-07T06:41:48.323Z [DBG] Config+: Fetching configs from buckets in cluster for group "default"
2024-06-07T06:41:48.349Z [DBG] Config+: b:myDatabase Checking for database config (attempt 1/5)
2024-06-07T06:41:48.390Z [DBG] Config+: b:myDatabase Got config for group "default" with cas 1717679896911806464
2024-06-07T06:41:48.395Z [DBG] Config+: Database "myDatabase" bucket "myDatabase" config has not changed since last update
2024-06-07T06:41:48.687Z [INF] Query: c:#947 db:myDatabase N1QL Query("principals") took 793.168065ms
2024-06-07T06:41:48.688Z [INF] c:#947 db:myDatabase Invalidating channel caches of users/roles...
2024-06-07T06:41:49.311Z [DBG] CRUD+: db:myDatabase Released unused sequences #654785-#654791
2024-06-07T06:41:49.311Z [INF] Cache: db:myDatabase Received #654785-#654791 (unused sequence range)
2024-06-07T06:41:49.311Z [DBG] Changes+: db:myDatabase Notifying that "myDatabase" changed (keys="{0.<ud>_unusedSeqKey</ud>}") count=9