This is an automated email from the ASF dual-hosted git repository.
littlecui pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new b4e3984 SCB-181 Unused instance index key is stored in backend. (#243)
b4e3984 is described below
commit b4e3984b6ceb290e6effbd93b04959b59e2af792
Author: little-cui <[email protected]>
AuthorDate: Fri Jan 5 16:23:09 2018 +0800
SCB-181 Unused instance index key is stored in backend. (#243)
* SCB-181 Unused instance index key is stored in backend.
* SCB-181 Unused instance index key is stored in backend.
---
server/core/key_generator.go | 16 ----------------
server/service/instances.go | 3 ---
server/service/util/microservice_util.go | 2 +-
3 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/server/core/key_generator.go b/server/core/key_generator.go
index 73775e8..4161343 100644
--- a/server/core/key_generator.go
+++ b/server/core/key_generator.go
@@ -115,15 +115,6 @@ func GetServiceSchemaRootKey(domainProject string) string {
}, "/")
}
-func GetInstanceIndexRootKey(domainProject string) string {
- return util.StringJoin([]string{
- GetRootKey(),
- REGISTRY_INSTANCE_KEY,
- REGISTRY_INDEX,
- domainProject,
- }, "/")
-}
-
func GetInstanceRootKey(domainProject string) string {
return util.StringJoin([]string{
GetRootKey(),
@@ -234,13 +225,6 @@ func GetServiceSchemaSummaryRootKey(domainProject string)
string {
}, "/")
}
-func GenerateInstanceIndexKey(domainProject string, instanceId string) string {
- return util.StringJoin([]string{
- GetInstanceIndexRootKey(domainProject),
- instanceId,
- }, "/")
-}
-
func GenerateInstanceKey(domainProject string, serviceId string, instanceId
string) string {
return util.StringJoin([]string{
GetInstanceRootKey(domainProject),
diff --git a/server/service/instances.go b/server/service/instances.go
index 6a52625..8fdbd6a 100644
--- a/server/service/instances.go
+++ b/server/service/instances.go
@@ -183,7 +183,6 @@ func (s *InstanceService) Register(ctx context.Context, in
*pb.RegisterInstanceR
}, err
}
- index := apt.GenerateInstanceIndexKey(domainProject, instanceId)
key := apt.GenerateInstanceKey(domainProject, instance.ServiceId,
instanceId)
hbKey := apt.GenerateInstanceLeaseKey(domainProject,
instance.ServiceId, instanceId)
@@ -192,8 +191,6 @@ func (s *InstanceService) Register(ctx context.Context, in
*pb.RegisterInstanceR
opts := []registry.PluginOp{
registry.OpPut(registry.WithStrKey(key),
registry.WithValue(data),
registry.WithLease(leaseID),
registry.WithIgnoreLease()),
- registry.OpPut(registry.WithStrKey(index),
registry.WithStrValue(instance.ServiceId),
- registry.WithLease(leaseID),
registry.WithIgnoreLease()),
}
if leaseID != 0 {
opts = append(opts,
diff --git a/server/service/util/microservice_util.go
b/server/service/util/microservice_util.go
index 8cb7816..433458c 100644
--- a/server/service/util/microservice_util.go
+++ b/server/service/util/microservice_util.go
@@ -268,7 +268,7 @@ func GetOneDomainProjectServiceCount(ctx context.Context,
domainProject string)
}
func GetOneDomainProjectInstanceCount(ctx context.Context, domainProject
string) (int64, error) {
- key := apt.GenerateInstanceIndexKey(domainProject, "")
+ key := apt.GetInstanceRootKey(domainProject) + "/"
opts := append(FromContext(ctx),
registry.WithStrKey(key),
registry.WithCountOnly(),
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].