You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2017/12/28 03:34:13 UTC

[GitHub] little-cui closed pull request #233: SCB-129 Do not defrag the backend database after compacted.

little-cui closed pull request #233: SCB-129 Do not defrag the backend database after compacted.
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/233
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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)"
 	}
 
 	// ????


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services