Skip to content

CBG-5213 support dropping rosmar buckets#386

Merged
torcolvin merged 4 commits into
mainfrom
CBG-5213
Apr 21, 2026
Merged

CBG-5213 support dropping rosmar buckets#386
torcolvin merged 4 commits into
mainfrom
CBG-5213

Conversation

@torcolvin
Copy link
Copy Markdown
Collaborator

  • Create CouchbaseCloud.drop_bucket function since this might be a Sync Gateway operation or a server operation
  • Change the behavior when creating the database to make sure all databases that are backed by a given bucket are actually gone. If you had multiple databases on the same bucket using different collections, then dropping all of them is necessary to avoid issues creating a database if the new databases targets different collections than the dropped one.
  • Add special rosmar option to sync gateway config support dropping rosmar buckets
  • Make sure to stop sync gateway if it was already running

Testing done:

uv run environment/local/start_local.py --build-testserver 4.0.3
uv run environment/local/run_sync_gateway.py --server rosmar --start
uv run pytest --config environment/local/rosmar_config.json tests/dev_e2e 

And with Couchbase Server:

uv run environment/local/run_sync_gateway.py --server cbs --start
uv run pytest --config environment/local/cbs_config.json tests/dev_e2e 

- Create CouchbaseCloud.drop_bucket function since this might be a Sync
Gateway operation or a server operation
- Change the behavior when creating the database to make sure all
  databases that are backed by a given bucket are actually gone. If you
  had multiple databases on the same bucket using different collections,
  then dropping all of them is necessary to avoid issues creating a
  database if the new databases targets different collections than the
  dropped one.
- Add special rosmar option to sync gateway config support dropping
  rosmar buckets
- Make sure to stop sync gateway if it was already running
Comment thread client/src/cbltest/api/cloud.py Outdated
await self.__sync_gateway.load_dataset(dataset_name, data_filepath)

async def drop_bucket(self, bucket_name: str, *, wait_for_deleted=False):
"""Drop the bucket from the backing cluster. This is an asynchronous operation unless wait_for_deleted is set to True."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it? I don't see anywhere that it is consulted....

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.

This is part of a subsequent PR, and the code was buggy so I removed it.

Copy link
Copy Markdown
Member

@borrrden borrrden left a comment

Choose a reason for hiding this comment

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

wait_for_deleted looks suspicious to me...

Copy link
Copy Markdown
Contributor

@vipbhardwaj vipbhardwaj left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for cleaning up Rosmar-backed buckets/databases during dataset setup, so local and e2e runs can reliably recreate Sync Gateway databases even when prior runs left state behind.

Changes:

  • Added CouchbaseCloud.drop_bucket() to abstract bucket deletion across Couchbase Server vs Rosmar.
  • Updated dataset (re)configuration flow to drop the backing bucket and wait until no databases reference it before recreating.
  • Enabled Rosmar bucket management in the local Sync Gateway config and ensured local run_sync_gateway.py restarts cleanly.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Adds tenacity to the resolved dependency set.
pyproject.toml Adds tenacity==9.1.4 as a direct dependency.
environment/local/sync_gateway_config/basic_sync_gateway_rosmar.json Enables unsupported.rosmar_bucket_management to allow Rosmar bucket deletion.
environment/local/run_sync_gateway.py Stops any existing local Sync Gateway process before starting a new one.
client/src/cbltest/api/syncgateway.py Adds wait_for_no_databases() with retry logic; adjusts logging import/level.
client/src/cbltest/api/cloud.py Introduces drop_bucket() and uses it during dataset reconfiguration on HTTP 412.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/src/cbltest/api/cloud.py
Comment thread client/src/cbltest/api/syncgateway.py Outdated
Comment thread client/src/cbltest/api/syncgateway.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@torcolvin torcolvin requested a review from borrrden April 20, 2026 01:44
Copy link
Copy Markdown
Member

@borrrden borrrden left a comment

Choose a reason for hiding this comment

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

Probably just fix this tiny thing before merging

Comment thread environment/local/run_sync_gateway.py Outdated
@torcolvin torcolvin merged commit 4be8412 into main Apr 21, 2026
5 checks passed
@torcolvin torcolvin deleted the CBG-5213 branch April 21, 2026 00:11
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.

4 participants