diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index d0061918f36..d0407530420 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -1212,11 +1212,22 @@ func (e *historyEngineImpl) queryDirectlyThroughMatching( sw := scope.StartTimer(metrics.DirectQueryDispatchLatency) defer sw.Stop() + // Sticky task list is not very useful in the standby cluster because the decider cache is + // not updated by dispatching tasks to it (it is only updated in the case of query). + // Additionally on the standby side we are not even able to clear sticky. + // Stickiness might be outdated if the customer did a restart of their nodes causing a query + // dispatched on the standby side on sticky to hang. We decided it made sense to simply not attempt + // query on sticky task list at all on the passive side. + de, err := e.shard.GetDomainCache().GetDomainByID(domainID) + if err != nil { + return nil, err + } supportsStickyQuery := e.clientChecker.SupportsStickyQuery(msResp.GetClientImpl(), msResp.GetClientFeatureVersion()) == nil if msResp.GetIsStickyTaskListEnabled() && len(msResp.GetStickyTaskList().GetName()) != 0 && supportsStickyQuery && - e.config.EnableStickyQuery(queryRequest.GetDomain()) { + e.config.EnableStickyQuery(queryRequest.GetDomain()) && + de.IsDomainActive() { stickyMatchingRequest := &m.QueryWorkflowRequest{ DomainUUID: common.StringPtr(domainID),