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

Replace gogo/protobuf with google/protobuf #5032

Merged
merged 13 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Next Next commit
Replace gogo/protobuf with google/protobuf
  • Loading branch information
tdeebswihart committed Nov 21, 2023
commit 0e07a14960c0098fcb75755ea77a7da5687d3d6a
14 changes: 12 additions & 2 deletions .github/workflows/features-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ jobs:
version: 1.5.2
version-is-repo-ref: false
docker-image-artifact-name: temporal-server-docker
features-repo-path: "tdeebswihart/temporal-features"
features-repo-ref: "nomo-gogo"

feature-tests-go:
needs: build-docker-image
uses: temporalio/features/.github/workflows/go.yaml@main
with:
version: v1.21.0
version-is-repo-ref: false
version: replace-gogo-protobuf
version-is-repo-ref: true
docker-image-artifact-name: temporal-server-docker
# TODO: remove these after they've hit the main branch
features-repo-path: "tdeebswihart/temporal-features"
features-repo-ref: "nomo-gogo"
go-repo-path: tdeebswihart/temporal-sdk-go

feature-tests-python:
needs: build-docker-image
Expand All @@ -40,6 +46,8 @@ jobs:
version: 0.1b4
version-is-repo-ref: false
docker-image-artifact-name: temporal-server-docker
features-repo-path: "tdeebswihart/temporal-features"
features-repo-ref: "nomo-gogo"

feature-tests-java:
needs: build-docker-image
Expand All @@ -48,3 +56,5 @@ jobs:
version: v1.17.0
version-is-repo-ref: false
docker-image-artifact-name: temporal-server-docker
features-repo-path: "tdeebswihart/temporal-features"
features-repo-ref: "nomo-gogo"
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "proto/api"]
path = proto/api
url = https://github.com/temporalio/api
branch = master
url = https://github.com/tdeebswihart/temporal-api
branch = nomo-gogo
[submodule "develop/docker-compose/grafana/provisioning/temporalio-dashboards"]
path = develop/docker-compose/grafana/provisioning/temporalio-dashboards
url = https://github.com/temporalio/dashboards
58 changes: 30 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bins: temporal-server temporal-cassandra-tool temporal-sql-tool tdbg
all: update-tools clean proto bins check test

# Used by Buildkite.
ci-build-misc: print-go-version bins ci-update-tools shell-check copyright-check proto go-generate gomodtidy ensure-no-changes
ci-build-misc: print-go-version ci-update-tools proto bins shell-check copyright-check go-generate gomodtidy ensure-no-changes

# Delete all build artifacts
clean: clean-bins clean-test-results
Expand All @@ -18,10 +18,10 @@ clean: clean-bins clean-test-results
proto: clean-proto buf-lint api-linter protoc fix-proto-path goimports-proto proto-mocks copyright-proto

# Update proto submodule from remote and recompile proto files.
update-proto: clean-proto update-proto-submodule buf-lint api-linter protoc fix-proto-path update-go-api goimports-proto proto-mocks copyright-proto gomodtidy
update-proto: clean-proto update-proto-submodule buf-lint api-linter protoc update-go-api goimports-proto proto-mocks copyright-proto gomodtidy
########################################################################

.PHONY: proto
.PHONY: proto proto-mocks

##### Arguments ######

Expand All @@ -31,6 +31,7 @@ GOPATH ?= $(shell go env GOPATH)
# Disable cgo by default.
CGO_ENABLED ?= 0

TEST_ARGS ?= -race
PERSISTENCE_TYPE ?= nosql
PERSISTENCE_DRIVER ?= cassandra

Expand All @@ -46,6 +47,12 @@ endif
export TEST_TOTAL_SHARDS ?= $(BUILDKITE_PARALLEL_JOB_COUNT)
export TEST_SHARD_INDEX ?= $(BUILDKITE_PARALLEL_JOB)

SEDOPTION = -i
ifeq ($(shell uname -s),Darwin)
# MacOS uses BSD sed
SEDOPTION = -i ''
endif

##### Variables ######

GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
Expand All @@ -66,8 +73,10 @@ TEST_TIMEOUT := 30m
PROTO_ROOT := proto
PROTO_FILES = $(shell find ./$(PROTO_ROOT)/internal -name "*.proto")
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
PROTO_IMPORTS = -I=$(PROTO_ROOT)/internal -I=$(PROTO_ROOT)/api -I=$(shell go list -modfile build/go.mod -m -f '{{.Dir}}' github.com/temporalio/gogo-protobuf)/protobuf
PROTO_IMPORTS = -I=$(PROTO_ROOT)/internal -I=$(PROTO_ROOT)/api -I=$(PROTO_ROOT)/dependencies
PROTO_OPTS = paths=source_relative:$(PROTO_OUT)
PROTO_OUT := api
PROTO_ENUMS := $(shell grep -R '^enum ' $(PROTO_ROOT) | cut -d ' ' -f2)

ALL_SRC := $(shell find . -name "*.go")
ALL_SRC += go.mod
Expand Down Expand Up @@ -139,8 +148,10 @@ update-gotestsum:

update-proto-plugins:
@printf $(COLOR) "Install/update proto plugins..."
@go install -modfile build/go.mod github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick
@go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Comment on lines +145 to 146
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why we're installing latest as opposed to using the modfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason. I'd be happy to change that if the team cares

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like latest. I would use it everywhere. Yes, build can be broken because of breaking changes in dependencies (and it happened few times already) but I think it is "ok" trade-off for keeping these build dependencies up to date.

@go install -modfile build/go.mod go.temporal.io/api/cmd/enumrewriter
@go install -modfile build/go.mod go.temporal.io/api/cmd/protoc-gen-go-helpers

update-proto-linters:
@printf $(COLOR) "Install/update proto linters..."
Expand Down Expand Up @@ -180,23 +191,14 @@ install-proto-submodule:
git submodule update --init $(PROTO_ROOT)/api

protoc: $(PROTO_OUT)
@printf $(COLOR) "Build proto files..."
@# Run protoc separately for each directory because of different package names.
$(foreach PROTO_DIR,$(PROTO_DIRS),\
@protoc --fatal_warnings $(PROTO_IMPORTS) \
--gogoslick_out=Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,plugins=grpc,paths=source_relative:$(PROTO_OUT) \
$(PROTO_DIR)*.proto \
$(NEWLINE))

fix-proto-path:
@mv -f $(PROTO_OUT)/temporal/server/api/* $(PROTO_OUT) && rm -rf $(PROTO_OUT)/temporal
@./protoc.sh

# All gRPC generated service files pathes relative to PROTO_OUT.
PROTO_GRPC_SERVICES = $(patsubst $(PROTO_OUT)/%,%,$(shell find $(PROTO_OUT) -name "service.pb.go"))
PROTO_GRPC_SERVICES = $(patsubst $(PROTO_OUT)/%,%,$(shell find $(PROTO_OUT) -name "service.pb.go" -o -name "service_grpc.pb.go"))
service_name = $(firstword $(subst /, ,$(1)))
mock_file_name = $(call service_name,$(1))mock/$(subst $(call service_name,$(1))/,,$(1:go=mock.go))

proto-mocks: $(PROTO_OUT)
proto-mocks: protoc
@printf $(COLOR) "Generate proto mocks..."
$(foreach PROTO_GRPC_SERVICE,$(PROTO_GRPC_SERVICES),\
@cd $(PROTO_OUT) && \
Expand Down Expand Up @@ -293,28 +295,28 @@ clean-test-results:

unit-test: clean-test-results
@printf $(COLOR) "Run unit tests..."
@go test $(UNIT_TEST_DIRS) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race | tee -a test.log
@go test $(UNIT_TEST_DIRS) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) 2>&1 | tee -a test.log
@! grep -q "^--- FAIL" test.log

integration-test: clean-test-results
@printf $(COLOR) "Run integration tests..."
@go test $(INTEGRATION_TEST_DIRS) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race | tee -a test.log
@go test $(INTEGRATION_TEST_DIRS) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) 2>&1 | tee -a test.log
@! grep -q "^--- FAIL" test.log

functional-test: clean-test-results
@printf $(COLOR) "Run functional tests..."
@go test $(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
@go test $(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
# Need to run xdc tests with race detector off because of ringpop bug causing data race issue.
@go test $(FUNCTIONAL_TEST_XDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_XDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
@! grep -q "^--- FAIL" test.log

functional-with-fault-injection-test: clean-test-results
@printf $(COLOR) "Run integration tests with fault injection..."
@go test $(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -race -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
@go test $(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) $(TEST_ARGS) -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
# Need to run xdc tests with race detector off because of ringpop bug causing data race issue.
@go test $(FUNCTIONAL_TEST_XDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) | tee -a test.log
@go test $(FUNCTIONAL_TEST_XDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -PersistenceFaultInjectionRate=0.005 -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) 2>&1 | tee -a test.log
@! grep -q "^--- FAIL" test.log

test: unit-test integration-test functional-test functional-with-fault-injection-test
Expand Down Expand Up @@ -342,7 +344,7 @@ pre-build-functional-test-coverage: prepare-coverage-test
functional-test-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional tests with coverage with $(PERSISTENCE_DRIVER) driver..."
@gotestsum --junitfile $(NEW_REPORT) -- \
$(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) -race $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) $(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)
$(FUNCTIONAL_TEST_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_ARGS) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) $(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)

functional-test-xdc-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional test for cross DC with coverage with $(PERSISTENCE_DRIVER) driver..."
Expand All @@ -352,7 +354,7 @@ functional-test-xdc-coverage: prepare-coverage-test
functional-test-ndc-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional test for NDC with coverage with $(PERSISTENCE_DRIVER) driver..."
@gotestsum --junitfile $(NEW_REPORT) -- \
$(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) -race $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) $(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)
$(FUNCTIONAL_TEST_NDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_ARGS) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) $(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)

.PHONY: $(SUMMARY_COVER_PROFILE)
$(SUMMARY_COVER_PROFILE):
Expand All @@ -364,7 +366,7 @@ $(SUMMARY_COVER_PROFILE):
@echo "mode: atomic" > $(SUMMARY_COVER_PROFILE)
$(foreach COVER_PROFILE,$(wildcard $(TEST_OUTPUT_ROOT)/*.cover.out),\
@printf "Add %s...\n" $(COVER_PROFILE); \
grep -v -e "[Mm]ocks\?.go" -e "^mode: \w\+" $(COVER_PROFILE) >> $(SUMMARY_COVER_PROFILE) || true \
@grep -v -e "[Mm]ocks\?.go" -e "^mode: \w\+" $(COVER_PROFILE) >> $(SUMMARY_COVER_PROFILE) || true \
$(NEWLINE))

coverage-report: $(SUMMARY_COVER_PROFILE)
Expand Down
12 changes: 10 additions & 2 deletions build/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ module build

go 1.18

replace go.temporal.io/api => github.com/tdeebswihart/temporal-api-go v0.0.0-20231020155344-f1f14322de41

require (
go.temporal.io/api v0.0.0-00010101000000-000000000000
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
)

require (
github.com/temporalio/gogo-protobuf v1.22.1
)
github.com/iancoleman/strcase v0.3.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
19 changes: 14 additions & 5 deletions build/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/temporalio/gogo-protobuf v1.22.1 h1:K5ja5MqmCQKo4tlX7u3g+ZJqbvRr0589ss2cZQx2dSM=
github.com/temporalio/gogo-protobuf v1.22.1/go.mod h1:tCaEv+fB8tsyLgoaqKr78K/JOhdRe684yyo0z30SHyA=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/tdeebswihart/temporal-api-go v0.0.0-20231020155344-f1f14322de41 h1:KJ16xqw6rSSUeZ9Vo3l2XbYvAKGdw8WO4TmW6QjhdGs=
github.com/tdeebswihart/temporal-api-go v0.0.0-20231020155344-f1f14322de41/go.mod h1:ZMitJTNmbXZkOJENNfv6wSysT4UenqGL918N5N6SH4I=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
4 changes: 3 additions & 1 deletion build/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
package build

import (
_ "github.com/temporalio/gogo-protobuf/gogoproto" // gogoproto is just a random package name for module.
_ "go.temporal.io/api/cmd/enumrewriter"
_ "go.temporal.io/api/cmd/protoc-gen-go-helpers"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
)
10 changes: 5 additions & 5 deletions client/matching/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *clientImpl) AddActivityTask(
opts ...grpc.CallOption) (*matchingservice.AddActivityTaskResponse, error) {
partition := c.loadBalancer.PickWritePartition(
namespace.ID(request.GetNamespaceId()),
*request.GetTaskQueue(),
request.GetTaskQueue(),
enumspb.TASK_QUEUE_TYPE_ACTIVITY,
request.GetForwardedSource(),
)
Expand All @@ -103,7 +103,7 @@ func (c *clientImpl) AddWorkflowTask(
opts ...grpc.CallOption) (*matchingservice.AddWorkflowTaskResponse, error) {
partition := c.loadBalancer.PickWritePartition(
namespace.ID(request.GetNamespaceId()),
*request.GetTaskQueue(),
request.GetTaskQueue(),
enumspb.TASK_QUEUE_TYPE_WORKFLOW,
request.GetForwardedSource(),
)
Expand All @@ -127,7 +127,7 @@ func (c *clientImpl) PollActivityTaskQueue(
opts ...grpc.CallOption) (*matchingservice.PollActivityTaskQueueResponse, error) {
pollerToken := c.loadBalancer.PickReadPartition(
namespace.ID(request.GetNamespaceId()),
*request.PollRequest.GetTaskQueue(),
request.PollRequest.GetTaskQueue(),
enumspb.TASK_QUEUE_TYPE_ACTIVITY,
request.GetForwardedSource(),
)
Expand All @@ -153,7 +153,7 @@ func (c *clientImpl) PollWorkflowTaskQueue(
opts ...grpc.CallOption) (*matchingservice.PollWorkflowTaskQueueResponse, error) {
pollerToken := c.loadBalancer.PickReadPartition(
namespace.ID(request.GetNamespaceId()),
*request.PollRequest.GetTaskQueue(),
request.PollRequest.GetTaskQueue(),
enumspb.TASK_QUEUE_TYPE_WORKFLOW,
request.GetForwardedSource(),
)
Expand All @@ -176,7 +176,7 @@ func (c *clientImpl) PollWorkflowTaskQueue(
func (c *clientImpl) QueryWorkflow(ctx context.Context, request *matchingservice.QueryWorkflowRequest, opts ...grpc.CallOption) (*matchingservice.QueryWorkflowResponse, error) {
partition := c.loadBalancer.PickWritePartition(
namespace.ID(request.GetNamespaceId()),
*request.GetTaskQueue(),
request.GetTaskQueue(),
enumspb.TASK_QUEUE_TYPE_WORKFLOW,
request.GetForwardedSource(),
)
Expand Down
8 changes: 4 additions & 4 deletions client/matching/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type (
// performed
PickWritePartition(
namespaceID namespace.ID,
taskQueue taskqueuepb.TaskQueue,
taskQueue *taskqueuepb.TaskQueue,
taskQueueType enumspb.TaskQueueType,
forwardedFrom string,
) string
Expand All @@ -59,7 +59,7 @@ type (
// forwardedFrom is non-empty, no load balancing should be done.
PickReadPartition(
namespaceID namespace.ID,
taskQueue taskqueuepb.TaskQueue,
taskQueue *taskqueuepb.TaskQueue,
taskQueueType enumspb.TaskQueueType,
forwardedFrom string,
) *pollToken
Expand Down Expand Up @@ -116,7 +116,7 @@ func NewLoadBalancer(

func (lb *defaultLoadBalancer) PickWritePartition(
namespaceID namespace.ID,
taskQueue taskqueuepb.TaskQueue,
taskQueue *taskqueuepb.TaskQueue,
taskQueueType enumspb.TaskQueueType,
forwardedFrom string,
) string {
Expand Down Expand Up @@ -148,7 +148,7 @@ func (lb *defaultLoadBalancer) PickWritePartition(
// Caller is responsible to call pollToken.Release() after complete the poll.
func (lb *defaultLoadBalancer) PickReadPartition(
namespaceID namespace.ID,
taskQueue taskqueuepb.TaskQueue,
taskQueue *taskqueuepb.TaskQueue,
taskQueueType enumspb.TaskQueueType,
forwardedFrom string,
) *pollToken {
Expand Down
10 changes: 9 additions & 1 deletion common/api/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package api

import (
"reflect"
"regexp"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -35,6 +36,8 @@ import (
"golang.org/x/exp/maps"
)

var publicMethodRgx = regexp.MustCompile("^[A-Z]")

func TestWorkflowServiceMetadata(t *testing.T) {
tp := reflect.TypeOf((*workflowservice.WorkflowServiceServer)(nil)).Elem()
checkService(t, tp, workflowServiceMetadata)
Expand Down Expand Up @@ -109,7 +112,12 @@ func TestGetMethodMetadata(t *testing.T) {
func getMethodNames(tp reflect.Type) []string {
var out []string
for i := 0; i < tp.NumMethod(); i++ {
out = append(out, tp.Method(i).Name)
name := tp.Method(i).Name
// Don't collect unimplemented methods. This weeds out the
// `mustEmbedUnimplementedFooBarBaz` required by the GRPC v2 gateway
if publicMethodRgx.MatchString(name) {
out = append(out, name)
}
}
return out
}
Loading