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

Add persistence domain config validation check #2286

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions service/frontend/domainAttrValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ func newDomainAttrValidator(
}
}

func (d *domainAttrValidatorImpl) validateDomainConfig(
config *persistence.DomainConfig,
) error {
func (d *domainAttrValidatorImpl) validateDomainConfig(config *persistence.DomainConfig) error {
if config.Retention < int32(d.minRetentionDays) {
return errInvalidRetentionPeriod
}
if config.HistoryArchivalStatus == shared.ArchivalStatusEnabled && len(config.HistoryArchivalURI) == 0 {
return errInvalidArchivalConfig
}
if config.VisibilityArchivalStatus == shared.ArchivalStatusEnabled && len(config.VisibilityArchivalURI) == 0 {
return errInvalidArchivalConfig
}
return nil
}

Expand Down
1 change: 1 addition & 0 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var (
errInvalidTaskStartToCloseTimeoutSeconds = &gen.BadRequestError{Message: "A valid TaskStartToCloseTimeoutSeconds is not set on request."}
errClientVersionNotSet = &gen.BadRequestError{Message: "Client version is not set on request."}
errInvalidRetentionPeriod = &gen.BadRequestError{Message: "A valid retention period is not set on request."}
errInvalidArchivalConfig = &gen.BadRequestError{Message: "Invalid to enable archival without specifying a uri."}

// err for archival
errHistoryHasPassedRetentionPeriod = &gen.BadRequestError{Message: "Requested workflow history has passed retention period."}
Expand Down