Skip to content

CBG-5463: complete migration when a pending db drops out of cluster#8373

Merged
bbrks merged 5 commits into
mainfrom
CBG-5463
Jul 1, 2026
Merged

CBG-5463: complete migration when a pending db drops out of cluster#8373
bbrks merged 5 commits into
mainfrom
CBG-5463

Conversation

@gregns1

@gregns1 gregns1 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

CBG-5463

When a bucket is in pending state due to a db being not migrated yet, we should poll to ensure that this is still the correct state to be in. Meaning if you delete a non migrated db from the bucket it should not hold up bootstrap level migration.

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

Copilot AI review requested due to automatic review settings June 17, 2026 10:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 ensures bucket-level bootstrap metadata migration doesn’t remain stuck in a pending state when the last non-migrated database is removed from a bucket, by re-checking pending migrations during the bootstrap config polling loop.

Changes:

  • Add a periodic recheck in the bootstrap config polling loop to attempt completion of bucket-level metadata migration when conditions change (e.g., DB deletion).
  • Extend the base.BootstrapConnection interface with an IsMigrationComplete fast-path helper and implement it for Couchbase/Rosmar backends.
  • Add a regression test covering deletion of a non-migrated DB unblocking bucket bootstrap migration completion.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
rest/server_context.go Adds periodic recheck logic to complete pending bucket-level metadata migrations during config polling.
rest/metadatamigrationtest/metadata_migration_test.go Adds a test verifying DB deletion unblocks bootstrap migration completion.
base/rosmar_cluster.go Implements IsMigrationComplete for Rosmar bootstrap connection.
base/bootstrap.go Adds IsMigrationComplete to the bootstrap connection interface and implements it for Couchbase.

Comment thread rest/server_context.go Outdated
Comment thread rest/server_context.go Outdated
Comment thread base/bootstrap.go Outdated
assert.Contains(t, resp.Body.String(), `"name":"bob"`, "dbnamed must remain readable after dbdefault's later migration")
}

func TestDeleteNonMigratedDbUnblocksBootstrapMigration(t *testing.T) {
bbrks
bbrks previously approved these changes Jun 17, 2026

@bbrks bbrks left a comment

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.

A few comments - let me know if you disagree and we can discuss. Some of this is undefined behaviour (e.g. do we 'migrate' a bootstrap bucket if there are no databases - I think yes, but I could see an argument for no)

Comment thread rest/server_context.go Outdated
Comment thread rest/server_context.go
Comment thread rest/server_context.go Outdated
Comment thread rest/server_context.go Outdated
@bbrks bbrks assigned gregns1 and unassigned bbrks Jun 30, 2026
@gregns1 gregns1 assigned bbrks and unassigned gregns1 Jul 1, 2026
@bbrks bbrks merged commit 92662ab into main Jul 1, 2026
52 checks passed
@bbrks bbrks deleted the CBG-5463 branch July 1, 2026 11:36
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