You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/06/09 07:53:44 UTC

[GitHub] [servicecomb-service-center] DFSOrange opened a new pull request #1047: fix cache bugs

DFSOrange opened a new pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047


   【issue】: #1046 
   【特性/模块名称】:cache问题修复
   【修改内容】:
   service,inst,dep增加新旧值更新判断
   watch到的值如果unmashal为空报错
   metrics支持关闭
   【自测情况】:ut全部通过
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] DFSOrange commented on a change in pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
DFSOrange commented on a change in pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#discussion_r652289446



##########
File path: datasource/mongo/sd/instancec_test.go
##########
@@ -83,3 +84,72 @@ func TestInstCacheBasicFunc(t *testing.T) {
 		assert.Len(t, instanceCache.cache.GetValue("svcid"), 0)
 	})
 }
+
+func TestInstValueUpdate(t *testing.T) {
+	inst1 := model.Instance{
+		Domain:      "d1",
+		Project:     "p1",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst2 := model.Instance{
+		Domain:      "d1",
+		Project:     "p1",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst3 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst4 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.1",
+		},
+	}
+	inst5 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Now(),
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.1",
+		},
+	}
+	var InstTests = []struct {
+		in       []interface{}
+		expected bool
+	}{
+		{in: []interface{}{inst1, inst2},

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] DFSOrange closed pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
DFSOrange closed pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#discussion_r651704722



##########
File path: datasource/mongo/sd/instancec_test.go
##########
@@ -83,3 +84,72 @@ func TestInstCacheBasicFunc(t *testing.T) {
 		assert.Len(t, instanceCache.cache.GetValue("svcid"), 0)
 	})
 }
+
+func TestInstValueUpdate(t *testing.T) {
+	inst1 := model.Instance{
+		Domain:      "d1",
+		Project:     "p1",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst2 := model.Instance{
+		Domain:      "d1",
+		Project:     "p1",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst3 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.0",
+		},
+	}
+	inst4 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Time{},
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.1",
+		},
+	}
+	inst5 := model.Instance{
+		Domain:      "d2",
+		Project:     "p2",
+		RefreshTime: time.Now(),
+		Instance: &discovery.MicroServiceInstance{
+			InstanceId: "123",
+			Version:    "1.1",
+		},
+	}
+	var InstTests = []struct {
+		in       []interface{}
+		expected bool
+	}{
+		{in: []interface{}{inst1, inst2},

Review comment:
       可能gotests工具版本和别人不同?没有test case 名字




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] robotLJW merged pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
robotLJW merged pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] tianxiaoliang edited a comment on pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
tianxiaoliang edited a comment on pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#issuecomment-857537445


   描述
   - 问题现象
   - 修复方法
   - 补充UT基线化该特性


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] DFSOrange commented on a change in pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
DFSOrange commented on a change in pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#discussion_r651396056



##########
File path: server/handler/metrics/metrics.go
##########
@@ -44,5 +46,7 @@ func (h *Handler) Handle(i *chain.Invocation) {
 }
 
 func RegisterHandlers() {
-	chain.RegisterHandler(rest.ServerChainName, &Handler{})
+	if config.GetBool("metrics.enable", true) {

Review comment:
       > 默认关闭
   
   done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] xiangyanggong commented on pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
xiangyanggong commented on pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#issuecomment-1060088515


   请问下,存在两个服务,A为调用者,B为提供者,当B版本升级(新增接口)后。A本地执行如下逻辑:1.A收到B新实例上线的通知事件;2.A从SC拉取B服务的实例信息,但SC返回的却是304,进而导致A无法调用B服务新的接口。
   以上这种场景是不是由这个bug引起的呢?我们的环境中SC使用的是1.3.0,发现偶尔会出现这种问题,但重启SC之后即可解决


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-service-center] tianxiaoliang commented on a change in pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#discussion_r649625295



##########
File path: server/handler/metrics/metrics.go
##########
@@ -44,5 +46,7 @@ func (h *Handler) Handle(i *chain.Invocation) {
 }
 
 func RegisterHandlers() {
-	chain.RegisterHandler(rest.ServerChainName, &Handler{})
+	if config.GetBool("metrics.enable", true) {

Review comment:
       默认关闭




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] tianxiaoliang edited a comment on pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
tianxiaoliang edited a comment on pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#issuecomment-857537445


   描述
   - 问题现象
   - 修复方法
   - 补充UT基线化该行为


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [servicecomb-service-center] tianxiaoliang commented on pull request #1047: fix cache bugs

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on pull request #1047:
URL: https://github.com/apache/servicecomb-service-center/pull/1047#issuecomment-857537445


   描述
   - 问题现象
   - 修复方法


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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