Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
Security Level: Public
-
None
-
CBG Sprint 152
-
2
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:
- Create /db/ will offline:true
- wait for some period of time, long enough for the index creation to time out
- 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