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 2020/03/21 09:12:42 UTC

[GitHub] [servicecomb-kie] zhulijian1 opened a new pull request #121: kv history support rotate

zhulijian1 opened a new pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121
 
 
   1. kv history对每个key保存100条历史记录
   2. 删除key时删除key对应的所有历史记录
   
   Fixes #120

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang merged pull request #121: kv history support rotate

Posted by GitBox <gi...@apache.org>.
tianxiaoliang merged pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121
 
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] zhulijian1 commented on a change in pull request #121: kv history support rotate

Posted by GitBox <gi...@apache.org>.
zhulijian1 commented on a change in pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121#discussion_r396187441
 
 

 ##########
 File path: server/service/mongo/kv/kv_dao.go
 ##########
 @@ -183,6 +183,10 @@ func deleteKV(ctx context.Context, kvID, project, domain string) error {
 	} else {
 		openlogging.Info(fmt.Sprintf("delete success,kvID=%s", kvID))
 	}
+	err = history.DeleteHistories(ctx, kvID, project, domain)
 
 Review comment:
   因为我觉得是残留数据,这个时候不删掉,就永远没办法删掉了,没有删除history的接口
   或者搞个老化机制,key删除多长时间之后清除history?

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #121: kv history support rotate

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121#discussion_r396249414
 
 

 ##########
 File path: server/service/mongo/history/dao.go
 ##########
 @@ -72,5 +80,77 @@ func AddHistory(ctx context.Context, kv *model.KVDoc) error {
 		openlogging.Error(err.Error())
 		return err
 	}
+	err = historyRotate(ctx, kv.ID, kv.Project, kv.Domain)
+	if err != nil {
+		openlogging.Error("history rotate err: " + err.Error())
+		return err
+	}
+	return nil
+}
+
+//AddDeleteTime add delete time to all revisions of the kv,
+//thus these revisions will be automatically deleted by TTL index.
+func AddDeleteTime(ctx context.Context, kvID, project, domain string) error {
 
 Review comment:
   按照update time进行老化就可以了

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #121: kv history support rotate

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121#discussion_r396249414
 
 

 ##########
 File path: server/service/mongo/history/dao.go
 ##########
 @@ -72,5 +80,77 @@ func AddHistory(ctx context.Context, kv *model.KVDoc) error {
 		openlogging.Error(err.Error())
 		return err
 	}
+	err = historyRotate(ctx, kv.ID, kv.Project, kv.Domain)
+	if err != nil {
+		openlogging.Error("history rotate err: " + err.Error())
+		return err
+	}
+	return nil
+}
+
+//AddDeleteTime add delete time to all revisions of the kv,
+//thus these revisions will be automatically deleted by TTL index.
+func AddDeleteTime(ctx context.Context, kvID, project, domain string) error {
 
 Review comment:
   按照update time进行老化就可以了

----------------------------------------------------------------
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


With regards,
Apache Git Services

[GitHub] [servicecomb-kie] tianxiaoliang commented on a change in pull request #121: kv history support rotate

Posted by GitBox <gi...@apache.org>.
tianxiaoliang commented on a change in pull request #121: kv history support rotate
URL: https://github.com/apache/servicecomb-kie/pull/121#discussion_r396185802
 
 

 ##########
 File path: server/service/mongo/kv/kv_dao.go
 ##########
 @@ -183,6 +183,10 @@ func deleteKV(ctx context.Context, kvID, project, domain string) error {
 	} else {
 		openlogging.Info(fmt.Sprintf("delete success,kvID=%s", kvID))
 	}
+	err = history.DeleteHistories(ctx, kvID, project, domain)
 
 Review comment:
   不可删除history,这部分你如何考虑的
   
   因为存在误删,所以后台应当留底

----------------------------------------------------------------
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


With regards,
Apache Git Services