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

Fix bug in adiminCLI: convert domain name to donmainID using domainCache #812

Merged
merged 1 commit into from
Jun 5, 2018
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
15 changes: 12 additions & 3 deletions service/frontend/adminHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import (
gen "github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/client/history"
"github.com/uber/cadence/common"
"github.com/uber/cadence/common/cache"
"github.com/uber/cadence/common/logging"
"github.com/uber/cadence/common/persistence"
"github.com/uber/cadence/common/service"
)

Expand All @@ -42,16 +44,18 @@ type (
AdminHandler struct {
numberOfHistoryShards int
service.Service
history history.Client
history history.Client
domainCache cache.DomainCache
}
)

// NewAdminHandler creates a thrift handler for the cadence admin service
func NewAdminHandler(
sVice service.Service, numberOfHistoryShards int) *AdminHandler {
sVice service.Service, numberOfHistoryShards int, metadataMgr persistence.MetadataManager) *AdminHandler {
handler := &AdminHandler{
numberOfHistoryShards: numberOfHistoryShards,
Service: sVice,
domainCache: cache.NewDomainCache(metadataMgr, sVice.GetClusterMetadata(), sVice.GetLogger()),
}
return handler
}
Expand Down Expand Up @@ -92,11 +96,16 @@ func (adh *AdminHandler) DescribeWorkflowExecution(ctx context.Context, request
return nil, adh.error(err)
}

domainID, err := adh.domainCache.GetDomainID(request.GetDomain())

historyAddr := historyHost.GetAddress()
resp, err := adh.history.DescribeMutableState(ctx, &hist.DescribeMutableStateRequest{
DomainUUID: request.Domain,
DomainUUID: &domainID,
Execution: request.Execution,
})
if err != nil {
return &admin.DescribeWorkflowExecutionResponse{}, err
}
return &admin.DescribeWorkflowExecutionResponse{
ShardId: common.StringPtr(shardIDForOutput),
HistoryAddr: common.StringPtr(historyAddr),
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (s *Service) Start() {
wfHandler := NewWorkflowHandler(base, s.config, metadata, history, visibility, kafkaProducer)
wfHandler.Start()

adminHandler := NewAdminHandler(base, p.CassandraConfig.NumHistoryShards)
adminHandler := NewAdminHandler(base, p.CassandraConfig.NumHistoryShards, metadata)
adminHandler.Start()

log.Infof("%v started", common.FrontendServiceName)
Expand Down