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 2022/08/30 08:37:09 UTC

[GitHub] [servicecomb-service-center] tianxiaoliang commented on a diff in pull request #1337: [fix]sync config without history

tianxiaoliang commented on code in PR #1337:
URL: https://github.com/apache/servicecomb-service-center/pull/1337#discussion_r958181316


##########
syncer/service/replicator/resource/config.go:
##########
@@ -122,8 +122,26 @@ type docResource interface {
 }
 
 func (c *kvConfig) Create(ctx context.Context, doc *kiemodel.KVDoc) error {
-	_, err := kiedb.GetBroker().GetKVDao().Create(ctx, doc)
-	return err
+	revision, err := kiedb.GetBroker().GetRevisionDao().ApplyRevision(ctx, doc.Domain)
+	if err != nil {
+		return fmt.Errorf("apply kv revision failed, %s", err.Error())
+	}
+	completeKV(doc, revision)
+	doc, err = kiedb.GetBroker().GetKVDao().Create(ctx, doc)
+	if err != nil {
+		return fmt.Errorf("create kv failed, %s", err.Error())
+	}
+	err = kiedb.GetBroker().GetHistoryDao().AddHistory(ctx, doc)
+	if err != nil {
+		log.Error(fmt.Sprintf("can not updateKeyValue version for [%s] [%s] in [%s]",

Review Comment:
   如果这里不返回,那就是warn日志



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