Skip to content

CBG-5790: Fix import waits that assume a single Sync Gateway node - #500

Open
torcolvin wants to merge 3 commits into
mainfrom
fix-multi-sgw-import-waits
Open

CBG-5790: Fix import waits that assume a single Sync Gateway node#500
torcolvin wants to merge 3 commits into
mainfrom
fix-multi-sgw-import-waits

Conversation

@torcolvin

@torcolvin torcolvin commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

CBG-5790: Fix import waits that assume a single Sync Gateway node

Fix import waits that assume a single Sync Gateway node

  • wait_for_import_count polled one node's shared_bucket_import expvar. Each import is handled by exactly one node, so on a multi-SGW cluster the polled node's count stays zero while another node does the import., and the test times out on a working system.

  • The wait itself was redundant: wait_for_all_documents already gates on the docs being visible, which implies the import ran.

  • Two tests waited for an async import without polling it. test_remove_dcp_cacert_handling slept a fixed 3s, which fails whenever import is slower than that; test_jwt_simple hand-rolled a 30s loop over _all_docs. Both now use wait_for_documents, which polls the _doc_ids filtered _changes feed via retry_assert.

wait_for_documents does not poll the _all_docs endpoint because _all_docs does not have a backing index. It wouldn't matter for any data sizes used in the integration tests. https://docs.couchbase.com/sync-gateway/3.3/product-notes/release-notes.html#disable-the-public-all-docs-endpoint

- wait_for_import_count polled one node's shared_bucket_import expvar.
  Each import is handled by exactly one node, so on a multi-SGW cluster
  the polled node's count stays zero while another node does the import.,
  and the test times out on a working system.
- The wait itself was redundant: wait_for_all_documents already gates on
  the docs being visible, which implies the import ran.

- Two tests waited for an async import without polling it.
  test_remove_dcp_cacert_handling slept a fixed 3s, which fails whenever
  import is slower than that; test_jwt_simple hand-rolled a 30s loop over
  _all_docs. Both now use wait_for_documents, which polls the _doc_ids
  filtered _changes feed via retry_assert.
Comment thread client/src/cbltest/api/syncgateway.py Outdated

@torcolvin torcolvin left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed comments and merged upstream code that used helper functions for get_changes.

@torcolvin torcolvin changed the title Fix import waits that assume a single Sync Gateway node CBG-5790: Fix import waits that assume a single Sync Gateway node Sep 1, 2026
@torcolvin
torcolvin requested a review from borrrden September 1, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants