tianxiaoliang commented on a change in pull request #1040:
URL: 
https://github.com/apache/servicecomb-service-center/pull/1040#discussion_r647888287



##########
File path: datasource/etcd/version.go
##########
@@ -50,43 +48,8 @@ func (ds *DataSource) LoadServerVersion(ctx context.Context) 
error {
        return nil
 }
 
-func (ds *DataSource) UpgradeServerVersion(ctx context.Context) error {
-       bytes, err := json.Marshal(config.Server)
-       if err != nil {
-               return err
-       }
-       _, err = client.Instance().Do(ctx,
-               client.PUT, client.WithStrKey(path.GetServerInfoKey()), 
client.WithValue(bytes))
-       if err != nil {
-               return err
-       }
-       return nil
-}
-
-func (ds *DataSource) UpgradeVersion(ctx context.Context) error {
-       lock, err := mux.Lock(mux.GlobalLock)
-
-       if err != nil {
-               log.Errorf(err, "wait for server ready failed")
-               return err
-       }
-       if ds.needUpgrade(ctx) {
-               config.Server.Version = version.Ver().Version
-
-               if err := ds.UpgradeServerVersion(ctx); err != nil {
-                       log.Errorf(err, "upgrade server version failed")
-                       os.Exit(1)
-               }
-       }
-       err = lock.Unlock()
-       if err != nil {
-               log.Error("", err)
-       }
-       return err
-}
-
-func (ds *DataSource) needUpgrade(ctx context.Context) bool {
-       err := ds.LoadServerVersion(ctx)
+func needUpgrade(ctx context.Context) bool {
+       err := loadServerVersion(ctx)

Review comment:
       没有删掉逻辑,而是这个ds指针放在这里没有任何意义




-- 
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:
us...@infra.apache.org


Reply via email to