tianxiaoliang commented on a change in pull request #155:
URL: https://github.com/apache/servicecomb-kie/pull/155#discussion_r477126504
##########
File path: server/service/mongo/session/session.go
##########
@@ -191,23 +198,19 @@ func GetColInfo(ctx context.Context, name string)
(*CollectionInfo, error) {
return nil, ErrGetPipeline
}
-//InitMongodb get collection info
-func InitMongodb() {
+//InitDB build mongo db schema
+func InitDB() {
session, err := mgo.Dial(config.GetDB().URI)
if err != nil {
- panic(err)
+ openlogging.Fatal("can not dial db:" + err.Error())
}
defer session.Close()
session.SetMode(mgo.Monotonic, true)
- //counter
- c := session.DB(DBName).C(CollectionCounter)
- docs := map[string]interface{}{"name": "revision_counter", "count": 1,
"domain": "default"}
- err = c.Insert(docs)
Review comment:
这个老代码进程重启会每次都插入新进路,没做unique id的索引,会导致系统修订版计数错误
----------------------------------------------------------------
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:
[email protected]