[3.1.9 backport] Avoid timeout on creating indexes asynchronously

Description

When creating a Sync Gateway database with a large number of collections, waiting for the indexes could time out becoming available. The timeout is 15 minutes per collection, which seemed pretty generous at the time. In https://couchbasecloud.atlassian.net/browse/AV-77598, this was after 486 collections. The behavior was as follows:

  1. Create /db/ will offline:true

  2. wait for some period of time, long enough for the index creation to time out

  3. PUT /db/_config offline: false, this call now becomes synchronous and acquires ServerContext.lock. This will take ~15 minutes if the indexes are still unable, so other calls are blocking.

We can avoid this problem by having an indefinite retry for waiting for collections when starting asynchronously https://github.com/couchbase/sync_gateway/blob/d106b462d66d2fea6891691a2b73a744530546fc/base/collection_n1ql_common.go#L549. We also want to make this goroutine exit if the context is cancelled https://github.com/couchbase/sync_gateway/blob/d106b462d66d2fea6891691a2b73a744530546fc/rest/database_init_manager.go#L237

Activity

Show:

Adam Fraser 
July 23, 2024 at 3:51 PM

Preparing tickets for release notes.

CB Robot 
July 8, 2024 at 2:00 PM

Build sync_gateway-3.1.9-6 contains sync_gateway commit cd8adf6 with commit message:
https://couchbasecloud.atlassian.net/browse/CBG-3953#icft=CBG-3953: [3.1.9 backport] Avoid timeout on creating indexes asynchronously (#6934)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Sprint

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created May 29, 2024 at 3:41 PM
Updated July 23, 2024 at 3:53 PM
Resolved July 23, 2024 at 3:53 PM
Instabug