[jira] [Commented] (SCB-980) The dependency will be broken when commit etcd failed
[ https://issues.apache.org/jira/browse/SCB-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16664739#comment-16664739 ] ASF GitHub Bot commented on SCB-980: little-cui closed pull request #464: SCB-980 The dependency will be broken when commit etcd failed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/464 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/server/service/util/dependency.go b/server/service/util/dependency.go index 752bb546..57b0ef31 100644 --- a/server/service/util/dependency.go +++ b/server/service/util/dependency.go @@ -18,8 +18,6 @@ package util import ( "encoding/json" - "errors" - "github.com/apache/incubator-servicecomb-service-center/pkg/gopool" "github.com/apache/incubator-servicecomb-service-center/pkg/log" apt "github.com/apache/incubator-servicecomb-service-center/server/core" "github.com/apache/incubator-servicecomb-service-center/server/core/backend" @@ -34,27 +32,18 @@ type Dependency struct { Consumer *pb.MicroServiceKey ProvidersRule []*pb.MicroServiceKey // store the parsed rules from Dependency object - removedDependencyRuleList []*pb.MicroServiceKey - newDependencyRuleList []*pb.MicroServiceKey - - err chan error - chanNum int8 -} - -func (dep *Dependency) RemoveConsumerOfProviderRule() { - dep.chanNum++ - gopool.Go(dep.removeConsumerOfProviderRule) + DeleteDependencyRuleList []*pb.MicroServiceKey + CreateDependencyRuleList []*pb.MicroServiceKey } -func (dep *Dependency) removeConsumerOfProviderRule(ctx context.Context) { - opts := make([]registry.PluginOp, 0, len(dep.removedDependencyRuleList)) - for _, providerRule := range dep.removedDependencyRuleList { +func (dep *Dependency) removeConsumerOfProviderRule(ctx context.Context) ([]registry.PluginOp, error) { + opts := make([]registry.PluginOp, 0, len(dep.DeleteDependencyRuleList)) + for _, providerRule := range dep.DeleteDependencyRuleList { proProkey := apt.GenerateProviderDependencyRuleKey(providerRule.Tenant, providerRule) log.Debugf("This proProkey is %s.", proProkey) consumerValue, err := TransferToMicroServiceDependency(ctx, proProkey) if err != nil { - dep.err <- err - return + return nil, err } for key, tmp := range consumerValue.Dependency { if ok := equalServiceDependency(tmp, dep.Consumer); ok { @@ -70,45 +59,30 @@ func (dep *Dependency) removeConsumerOfProviderRule(ctx context.Context) { } data, err := json.Marshal(consumerValue) if err != nil { - log.Errorf(nil, "Marshal tmpValue failed.") - dep.err <- err - return + log.Errorf(err, "Marshal tmpValue failed.") + return nil, err } opts = append(opts, registry.OpPut( registry.WithStrKey(proProkey), registry.WithValue(data))) } - if len(opts) != 0 { - err := backend.BatchCommit(ctx, opts) - if err != nil { - dep.err <- err - return - } - } - dep.err <- nil -} - -func (dep *Dependency) AddConsumerOfProviderRule() { - dep.chanNum++ - gopool.Go(dep.addConsumerOfProviderRule) + return opts, nil } -func (dep *Dependency) addConsumerOfProviderRule(ctx context.Context) { - opts := []registry.PluginOp{} - for _, providerRule := range dep.newDependencyRuleList { +func (dep *Dependency) addConsumerOfProviderRule(ctx context.Context) ([]registry.PluginOp, error) { + opts := make([]registry.PluginOp, 0, len(dep.CreateDependencyRuleList)) + for _, providerRule := range dep.CreateDependencyRuleList { proProkey := apt.GenerateProviderDependencyRuleKey(providerRule.Tenant, providerRule) tmpValue, err := TransferToMicroServiceDependency(ctx, proProkey) if err != nil { - dep.err <- err - return + return nil, err } tmpValue.Dependency = append(tmpValue.Dependency, dep.Consumer) data, errMarshal := json.Marshal(tmpValue) if errMarshal != nil { - log.Errorf(nil, "Marshal tmpValue failed.") -
[jira] [Commented] (SCB-980) The dependency will be broken when commit etcd failed
[ https://issues.apache.org/jira/browse/SCB-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663857#comment-16663857 ] ASF GitHub Bot commented on SCB-980: coveralls edited a comment on issue #464: SCB-980 The dependency will be broken when commit etcd failed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/464#issuecomment-433084838 [![Coverage Status](https://coveralls.io/builds/19720385/badge)](https://coveralls.io/builds/19720385) Coverage increased (+0.1%) to 62.793% when pulling **4c70d05d9df7dbc61b1668c4e7f48f365d4b5d3d on little-cui:master** into **c5473e0d125130abd8e5469566fcf4c24cbab965 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > The dependency will be broken when commit etcd failed > - > > Key: SCB-980 > URL: https://issues.apache.org/jira/browse/SCB-980 > Project: Apache ServiceComb > Issue Type: Bug > Components: Service-Center >Reporter: little-cui >Assignee: little-cui >Priority: Major > Fix For: service-center-1.1.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-980) The dependency will be broken when commit etcd failed
[ https://issues.apache.org/jira/browse/SCB-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663851#comment-16663851 ] ASF GitHub Bot commented on SCB-980: coveralls commented on issue #464: SCB-980 The dependency will be broken when commit etcd failed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/464#issuecomment-433084838 [![Coverage Status](https://coveralls.io/builds/19720275/badge)](https://coveralls.io/builds/19720275) Coverage increased (+0.1%) to 62.813% when pulling **4c70d05d9df7dbc61b1668c4e7f48f365d4b5d3d on little-cui:master** into **c5473e0d125130abd8e5469566fcf4c24cbab965 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > The dependency will be broken when commit etcd failed > - > > Key: SCB-980 > URL: https://issues.apache.org/jira/browse/SCB-980 > Project: Apache ServiceComb > Issue Type: Bug > Components: Service-Center >Reporter: little-cui >Assignee: little-cui >Priority: Major > Fix For: service-center-1.1.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-980) The dependency will be broken when commit etcd failed
[ https://issues.apache.org/jira/browse/SCB-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16663776#comment-16663776 ] ASF GitHub Bot commented on SCB-980: little-cui opened a new pull request #464: SCB-980 The dependency will be broken when commit etcd failed URL: https://github.com/apache/incubator-servicecomb-service-center/pull/464 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > The dependency will be broken when commit etcd failed > - > > Key: SCB-980 > URL: https://issues.apache.org/jira/browse/SCB-980 > Project: Apache ServiceComb > Issue Type: Bug > Components: Service-Center >Reporter: little-cui >Assignee: little-cui >Priority: Major > Fix For: service-center-1.1.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)