You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2017/12/28 03:34:11 UTC

[incubator-servicecomb-service-center] branch master updated: SCB-129 Do not defrag the backend database after compacted. (#233)

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 dec81c0  SCB-129 Do not defrag the backend database after compacted. (#233)
dec81c0 is described below

commit dec81c0872de6471b78b9af8c5b90319c3195072
Author: little-cui <su...@qq.com>
AuthorDate: Thu Dec 28 11:34:09 2017 +0800

    SCB-129 Do not defrag the backend database after compacted. (#233)
---
 server/plugin/infra/registry/etcd/etcd.go | 11 +++++++----
 server/server.go                          |  2 +-
 server/service/instances.go               |  2 ++
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/server/plugin/infra/registry/etcd/etcd.go b/server/plugin/infra/registry/etcd/etcd.go
index c6f7b57..e0b7935 100644
--- a/server/plugin/infra/registry/etcd/etcd.go
+++ b/server/plugin/infra/registry/etcd/etcd.go
@@ -76,22 +76,25 @@ func (c *EtcdClient) Compact(ctx context.Context, reserve int64) error {
 		return nil
 	}
 
+	t := time.Now()
 	_, err := c.Client.Compact(ctx, revToCompact, clientv3.WithCompactPhysical())
 	if err != nil {
 		util.Logger().Errorf(err, "Compact %s failed, revision is %d(current: %d, reserve %d)",
 			eps, revToCompact, curRev, reserve)
 		return err
 	}
-	util.Logger().Infof("Compacted %s, revision is %d(current: %d, reserve %d)", eps, revToCompact, curRev, reserve)
+	util.LogInfoOrWarnf(t, "Compacted %s, revision is %d(current: %d, reserve %d)", eps, revToCompact, curRev, reserve)
 
-	for _, ep := range eps {
+	// TODO can not defrag! because backend will always be unavailable when space in used is too large.
+	/*for _, ep := range eps {
+		t = time.Now()
 		_, err := c.Client.Defragment(ctx, ep)
 		if err != nil {
 			util.Logger().Errorf(err, "Defrag %s failed", ep)
 			continue
 		}
-		util.Logger().Infof("Defraged %s", ep)
-	}
+		util.LogInfoOrWarnf(t, "Defraged %s", ep)
+	}*/
 
 	return nil
 }
diff --git a/server/server.go b/server/server.go
index 7f814fc..c71a98c 100644
--- a/server/server.go
+++ b/server/server.go
@@ -120,7 +120,7 @@ func (s *ServiceCenterServer) autoCompactBackend() {
 		interval = 12 * time.Hour
 	}
 	util.Go(func(stopCh <-chan struct{}) {
-		util.Logger().Infof("start the automatic compact mechanism, compact once every %s, reserve %d",
+		util.Logger().Infof("enabled the automatic compact mechanism, compact once every %s, reserve %d",
 			core.ServerInfo.Config.CompactInterval, delta)
 		for {
 			select {
diff --git a/server/service/instances.go b/server/service/instances.go
index 3a22549..e850bc4 100644
--- a/server/service/instances.go
+++ b/server/service/instances.go
@@ -574,10 +574,12 @@ func (s *InstanceService) Find(ctx context.Context, in *pb.FindInstancesRequest)
 	if apt.IsShared(provider) {
 		// it means the shared micro-services must be the same env with SC.
 		provider.Environment = apt.Service.Environment
+		findFlag += "(shared services in " + provider.Environment + " environment)"
 	} else {
 		// only allow shared micro-service instances found in different domains.
 		targetDomainProject = domainProject
 		provider.Tenant = domainProject
+		findFlag += "(" + provider.Environment + " services of the same domain)"
 	}
 
 	// 版本规则

-- 
To stop receiving notification emails like this one, please contact
['"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>'].