Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBG-2977 allow DELETE on a broken DB config #6260

Merged
merged 11 commits into from
May 30, 2023
Merged

CBG-2977 allow DELETE on a broken DB config #6260

merged 11 commits into from
May 30, 2023

Conversation

torcolvin
Copy link
Collaborator

@torcolvin torcolvin commented May 23, 2023

CBG-2977

  • This only works with a bootstrap connection, because otherwise you'd just modify the file on disk. This means that this only has test coverage where we use persistent config enabled. Also, persistent config isn't enabled for walrus.
  • Added some boilerplate to allow LeakyBucket and TestBucket to support DropDataStore and CreateDataStore on the assumption this test would work with walrus. It does not though, because it relies on the bootstrap connection.
  • Trying to delete a config without a bootstrap connection will result in a 404 since you wouldn't be able start up sync gateway with a bad config.
  • the only non test changes are in rest/config.go and rest/handler.go.

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

Integration Tests

rest/utilities_testing.go Outdated Show resolved Hide resolved
rest/handler.go Outdated Show resolved Hide resolved
@torcolvin torcolvin changed the title CBG-2977 allow DELETE or PUT to modify a broken DB config CBG-2977 allow DELETE on a broken DB config May 24, 2023
Copy link
Collaborator

@adamcfraser adamcfraser left a comment

Choose a reason for hiding this comment

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

I don't think the current approach works with admin auth enabled, added some suggestions about how we might address.

rest/handler.go Show resolved Hide resolved
rest/handler.go Outdated Show resolved Hide resolved
rest/upgradetest/remove_collection_test.go Outdated Show resolved Hide resolved
rest/handler.go Outdated
return err
if h.allowMetadataDBOnly {
// look for db in config registry
_, ok := h.server.bucketNameFromDbName(keyspaceDb)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's some redundant work here - GetInactiveDatabase would have just done a fetchDatabase in the case where it didn't find the loaded db, and only returns 'not found' when the associated applyConfig fails, so we don't need another scan over all the buckets looking for the db config. Seems like we could modify GetInactiveDatabase to return another flag for 'dbConfigExists' that we could check here instead.

rest/handler.go Outdated Show resolved Hide resolved
rest/server_context.go Outdated Show resolved Hide resolved
@adamcfraser adamcfraser assigned torcolvin and unassigned adamcfraser May 25, 2023
Copy link
Collaborator

@adamcfraser adamcfraser left a comment

Choose a reason for hiding this comment

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

One request on how we use options, otherwise looks good.

rest/server_context.go Show resolved Hide resolved
@torcolvin torcolvin enabled auto-merge (squash) May 30, 2023 22:33
@torcolvin torcolvin merged commit c471697 into master May 30, 2023
@torcolvin torcolvin deleted the CBG-2977 branch May 30, 2023 22:57
bbrks pushed a commit that referenced this pull request Mar 28, 2024
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.

2 participants