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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]