Skip to content

Commit e95e082

Browse files
authored
Fix namespace interceptor to allow search attributes operations (#3899)
1 parent d43e112 commit e95e082

File tree

4 files changed

+188
-87
lines changed

4 files changed

+188
-87
lines changed

api/adminservice/v1/request_response.pb.go

+85-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/rpc/interceptor/namespace_validator.go

+14
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ import (
2828
"context"
2929

3030
enumspb "go.temporal.io/api/enums/v1"
31+
"go.temporal.io/api/operatorservice/v1"
3132
"go.temporal.io/api/serviceerror"
3233
"go.temporal.io/api/workflowservice/v1"
3334
"google.golang.org/grpc"
3435

36+
"go.temporal.io/server/api/adminservice/v1"
3537
"go.temporal.io/server/common"
3638
"go.temporal.io/server/common/dynamicconfig"
3739
"go.temporal.io/server/common/namespace"
@@ -178,6 +180,18 @@ func (ni *NamespaceValidatorInterceptor) extractNamespaceFromRequest(req interfa
178180
return nil, errNamespaceNotSet
179181
}
180182
return nil, nil
183+
case *adminservice.AddSearchAttributesRequest,
184+
*adminservice.RemoveSearchAttributesRequest,
185+
*adminservice.GetSearchAttributesRequest,
186+
*operatorservice.AddSearchAttributesRequest,
187+
*operatorservice.RemoveSearchAttributesRequest,
188+
*operatorservice.ListSearchAttributesRequest:
189+
// Namespace is optional for search attributes operations.
190+
// It's required when using SQL DB for visibility, but not when using Elasticsearch.
191+
if !namespaceName.IsEmpty() {
192+
return ni.namespaceRegistry.GetNamespace(namespaceName)
193+
}
194+
return nil, nil
181195
default:
182196
// All other APIs.
183197
if namespaceName.IsEmpty() {

0 commit comments

Comments
 (0)