-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix: removed redundant data from service_instance_details table #1109
Conversation
…ils table. Storing this data in the service_instance_details table is redundant, since this information is also stored the terraform_deployment table. If these two sources of truth became inconsistent, there is a possiblity that a service details could be deleted incorrectly following a failed deletion. Having a single source of truth prevents this incorrect behaviour. [#TPCF-26508](https://vmw-jira.broadcom.com/browse/TPCF-26508)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. There are a few minor cosmetic improvements, but it's a good improvement that leave the code tidier - and fixes a bad bug.
brokerapi/broker/deprovision.go
Outdated
@@ -94,6 +94,8 @@ func (broker *ServiceBroker) Deprovision(ctx context.Context, instanceID string, | |||
return domain.DeprovisionServiceSpec{}, err | |||
} | |||
|
|||
fmt.Println("serviceProvider Deprovsion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
@@ -31,12 +31,11 @@ func (broker *ServiceBroker) LastOperation(ctx context.Context, instanceID strin | |||
|
|||
_, serviceProvider, err := broker.getDefinitionAndProvider(instance.ServiceGUID) | |||
if err != nil { | |||
broker.Logger.Info("XXXX getDefinitionAndProvider", correlation.ID(ctx), lager.Data{"err": err}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this meant to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
@@ -128,6 +128,14 @@ func RunMigrations(db *gorm.DB) error { | |||
return autoMigrateTables(db, &models.BindRequestDetailsV1{}) | |||
} | |||
|
|||
migrations[16] = func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is doable in a single migration:
migrations[16] = func() error {
if err := db.Migrator().DropColumn(&models.ServiceInstanceDetailsV3{}, "operation_type"); err != nil {
return err
}
return db.Migrator().DropColumn(&models.ServiceInstanceDetailsV3{}, "operation_id")
}
But I'm not such which approach is best. Given I can't find an argument that a single migration is "better" then maybe leave it as it is.
pkg/providers/tf/deprovision.go
Outdated
@@ -12,6 +13,8 @@ import ( | |||
|
|||
// Deprovision performs a terraform destroy on the instance. | |||
func (provider *TerraformProvider) Deprovision(ctx context.Context, instanceGUID string, vc *varcontext.VarContext) (*string, error) { | |||
fmt.Println("XXXXX YO") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
pkg/providers/tf/deprovision.go
Outdated
@@ -22,6 +25,7 @@ func (provider *TerraformProvider) Deprovision(ctx context.Context, instanceGUID | |||
return nil, err | |||
} | |||
|
|||
fmt.Println("provider.destror") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
removed OperationID and OperationType from service_instance_details table.
Storing this data in the service_instance_details table is redundant, since this information is also stored the terraform_deployment table. If these two sources of truth became inconsistent, there is a possiblity that a service details could be deleted incorrectly following a failed deletion. Having a single source of truth prevents this incorrect behaviour.
#TPCF-26508
Checklist: