From e38598113acac14b87bec95d5e4e059b1c5edbe3 Mon Sep 17 00:00:00 2001 From: Jakob Haahr Taankvist Date: Thu, 14 Nov 2024 13:29:28 +0100 Subject: [PATCH] Rename new shardmanager service to shard-distributor --- cmd/server/cadence/server.go | 6 +++--- common/metrics/defs.go | 2 +- common/service/metrics.go | 4 ++-- common/service/name.go | 6 +++--- common/service/name_test.go | 4 ++-- config/development.yaml | 2 +- .../config/config.go | 0 .../{shardmanager => sharddistributor}/service.go | 14 +++++++------- .../service_test.go | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) rename service/{shardmanager => sharddistributor}/config/config.go (100%) rename service/{shardmanager => sharddistributor}/service.go (88%) rename service/{shardmanager => sharddistributor}/service_test.go (99%) diff --git a/cmd/server/cadence/server.go b/cmd/server/cadence/server.go index 1e087f7b04f..07bcc2f76f8 100644 --- a/cmd/server/cadence/server.go +++ b/cmd/server/cadence/server.go @@ -54,7 +54,7 @@ import ( "github.com/uber/cadence/service/frontend" "github.com/uber/cadence/service/history" "github.com/uber/cadence/service/matching" - "github.com/uber/cadence/service/shardmanager" + "github.com/uber/cadence/service/sharddistributor" "github.com/uber/cadence/service/worker" ) @@ -273,8 +273,8 @@ func (s *server) startService() common.Daemon { daemon, err = matching.NewService(¶ms) case service.Worker: daemon, err = worker.NewService(¶ms) - case service.ShardManager: - daemon, err = shardmanager.NewService(¶ms, resource.NewResourceFactory()) + case service.ShardDistributor: + daemon, err = sharddistributor.NewService(¶ms, resource.NewResourceFactory()) } if err != nil { params.Logger.Fatal("Fail to start "+s.name+" service ", tag.Error(err)) diff --git a/common/metrics/defs.go b/common/metrics/defs.go index e83959ba3f5..fbb49da729f 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -67,7 +67,7 @@ const ( History Matching Worker - ShardManager + ShardDistributor NumServices ) diff --git a/common/service/metrics.go b/common/service/metrics.go index cc3baf9283c..b7a934ff6bb 100644 --- a/common/service/metrics.go +++ b/common/service/metrics.go @@ -36,8 +36,8 @@ func GetMetricsServiceIdx(serviceName string, logger log.Logger) metrics.Service return metrics.Matching case Worker: return metrics.Worker - case ShardManager: - return metrics.ShardManager + case ShardDistributor: + return metrics.ShardDistributor default: logger.Fatal("Unknown service name for metrics!") } diff --git a/common/service/name.go b/common/service/name.go index d8054c8ea5e..e41f518f34f 100644 --- a/common/service/name.go +++ b/common/service/name.go @@ -33,15 +33,15 @@ const ( Matching = "cadence-matching" // Worker is the name of the worker service Worker = "cadence-worker" - // ShardManager is the name of the shard manager service - ShardManager = "cadence-shard-manager" + // ShardDistributor is the name of the shard distributor service + ShardDistributor = "cadence-shard-distributor" ) // ListWithRing contains the list of all cadence services that has a hash ring var ListWithRing = []string{Frontend, History, Matching, Worker} // List contains the list of all cadence services -var List = []string{Frontend, History, Matching, Worker, ShardManager} +var List = []string{Frontend, History, Matching, Worker, ShardDistributor} // ShortName returns cadence service name without "cadence-" prefix func ShortName(name string) string { diff --git a/common/service/name_test.go b/common/service/name_test.go index 1f683e7a1a9..f60e1987fa3 100644 --- a/common/service/name_test.go +++ b/common/service/name_test.go @@ -36,6 +36,6 @@ func TestServiceNames(t *testing.T) { assert.Equal(t, fullName, FullName(shortName)) assert.Equal(t, fullName, FullName(fullName)) - assert.Equal(t, []string{"cadence-frontend", "cadence-history", "cadence-matching", "cadence-worker", "cadence-shard-manager"}, List) - assert.Equal(t, []string{"frontend", "history", "matching", "worker", "shard-manager"}, ShortNames(List)) + assert.Equal(t, []string{"cadence-frontend", "cadence-history", "cadence-matching", "cadence-worker", "cadence-shard-distributor"}, List) + assert.Equal(t, []string{"frontend", "history", "matching", "worker", "shard-distributor"}, ShortNames(List)) } diff --git a/config/development.yaml b/config/development.yaml index be5ad669747..50a8c85b9fd 100644 --- a/config/development.yaml +++ b/config/development.yaml @@ -75,7 +75,7 @@ services: pprof: port: ${WORKER_PORT_PPROF:7940} - shard-manager: + shard-distributor: rpc: port: 7941 bindOnLocalHost: true diff --git a/service/shardmanager/config/config.go b/service/sharddistributor/config/config.go similarity index 100% rename from service/shardmanager/config/config.go rename to service/sharddistributor/config/config.go diff --git a/service/shardmanager/service.go b/service/sharddistributor/service.go similarity index 88% rename from service/shardmanager/service.go rename to service/sharddistributor/service.go index 24fe6e6dfac..8c83aa537ef 100644 --- a/service/shardmanager/service.go +++ b/service/sharddistributor/service.go @@ -18,7 +18,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -package shardmanager +package sharddistributor import ( "sync/atomic" @@ -27,10 +27,10 @@ import ( "github.com/uber/cadence/common/dynamicconfig" "github.com/uber/cadence/common/resource" "github.com/uber/cadence/common/service" - "github.com/uber/cadence/service/shardmanager/config" + "github.com/uber/cadence/service/sharddistributor/config" ) -// Service represents the shard manager service +// Service represents the shard distributor service type Service struct { resource.Resource @@ -57,13 +57,13 @@ func NewService( serviceResource, err := factory.NewResource( params, - service.ShardManager, + service.ShardDistributor, &service.Config{ PersistenceMaxQPS: serviceConfig.PersistenceMaxQPS, PersistenceGlobalMaxQPS: serviceConfig.PersistenceGlobalMaxQPS, ThrottledLoggerMaxRPS: serviceConfig.ThrottledLogRPS, IsErrorRetryableFunction: common.IsServiceTransientError, - // shard manager doesn't need visibility config as it never read or write visibility + // shard distributor doesn't need visibility config as it never read or write visibility }, ) if err != nil { @@ -85,7 +85,7 @@ func (s *Service) Start() { } logger := s.GetLogger() - logger.Info("shard manager starting") + logger.Info("shard distributor starting") // setup the handler @@ -103,5 +103,5 @@ func (s *Service) Stop() { s.Resource.Stop() - s.GetLogger().Info("shard manager stopped") + s.GetLogger().Info("shard distributor stopped") } diff --git a/service/shardmanager/service_test.go b/service/sharddistributor/service_test.go similarity index 99% rename from service/shardmanager/service_test.go rename to service/sharddistributor/service_test.go index dd757fadf16..579e0ec35e3 100644 --- a/service/shardmanager/service_test.go +++ b/service/sharddistributor/service_test.go @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -package shardmanager +package sharddistributor import ( "sync/atomic"