Skip to content

Retry conflict when updating RC in DC controller faster#10507

Merged
openshift-bot merged 2 commits intoopenshift:masterfrom
mfojtik:retry-dc-cancel
Aug 24, 2016
Merged

Retry conflict when updating RC in DC controller faster#10507
openshift-bot merged 2 commits intoopenshift:masterfrom
mfojtik:retry-dc-cancel

Conversation

@mfojtik
Copy link
Copy Markdown
Contributor

@mfojtik mfojtik commented Aug 18, 2016

No description provided.

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

@Kargakis PTAL

var updatedDeployment *kapi.ReplicationController
if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {
var err error
updatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh? Doesn't this just ensure that you fail 5 times? If copied's resourceVersion doesn't change, you'll just conflict over and over.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct - @mfojtik you need to pull and apply the annotations on top

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hups, correct

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deads2k will need Get() func in cache to re-get the rc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deads2k will need Get() func in cache to re-get the rc

Listers already have a get function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not RC listers...

On Thu, Aug 18, 2016 at 5:15 PM, David Eads notifications@github.com
wrote:

In pkg/deploy/controller/deploymentconfig/controller.go
#10507 (comment):

@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
copied.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists

  •           updatedDeployment, err := c.rn.ReplicationControllers(copied.Namespace).Update(copied)
    
  •           if err != nil {
    
  •           // Retry faster on conflicts
    
  •           var updatedDeployment *kapi.ReplicationController
    
  •           if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {
    
  •               var err error
    
  •               updatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied)
    

@deads2k https://github.com/deads2k will need Get() func in cache to
re-get the rc

Listers already have a get function.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/10507/files/095b81adcf1aeb4f3f928f95f9e5fc1ebf91588f#r75327857,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACsaONbQSMzSUok8fR-5utg6oF7wixiks5qhHb-gaJpZM4JnlAW
.


Michal Fojtik <mi@mifo.sk mfojtik@mifo.sk>
Red Hat OpenShift, Engineering

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upstream pull that adds it to all the upstream listers plz:)

On Thu, Aug 18, 2016 at 5:15 PM, Michal Fojtik notifications@github.com
wrote:

In pkg/deploy/controller/deploymentconfig/controller.go
#10507 (comment):

@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig)
copied.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists

  •           updatedDeployment, err := c.rn.ReplicationControllers(copied.Namespace).Update(copied)
    
  •           if err != nil {
    
  •           // Retry faster on conflicts
    
  •           var updatedDeployment *kapi.ReplicationController
    
  •           if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {
    
  •               var err error
    
  •               updatedDeployment, err = c.rn.ReplicationControllers(copied.Namespace).Update(copied)
    

not RC listers...
… <#m_-8974691536388745868_>
On Thu, Aug 18, 2016 at 5:15 PM, David Eads _@_.***> wrote: In
pkg/deploy/controller/deploymentconfig/controller.go <#10507 (comment)
https://github.com/openshift/origin/pull/10507#discussion_r75327857>: >
@@ -118,8 +119,13 @@ func (c *DeploymentConfigController) Handle(config
*deployapi.DeploymentConfig) > copied.Annotations[deployapi.DeploymentCancelledAnnotation]
= deployapi.DeploymentCancelledAnnotationValue >
copied.Annotations[deployapi.DeploymentStatusReasonAnnotation] =
deployapi.DeploymentCancelledNewerDeploymentExists > > -
updatedDeployment, err := c.rn.ReplicationControllers(
copied.Namespace).Update(copied) > - if err != nil { > + // Retry faster
on conflicts > + var updatedDeployment *kapi.ReplicationController > + if
err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error { > +
var err error > + updatedDeployment, err = c.rn.ReplicationControllers(
copied.Namespace).Update(copied) @deads2k https://github.com/deads2k <
https://github.com/deads2k> will need Get() func in cache to re-get the
rc Listers already have a get function. — You are receiving this because
you were mentioned. Reply to this email directly, view it on GitHub <
https://github.com/openshift/origin/pull/10507/files/
095b81a#r75327857>, or mute the thread <
https://github.com/notifications/unsubscribe-auth/AACsaONbQSMzSUok8fR-
5utg6oF7wixiks5qhHb-gaJpZM4JnlAW> .
-- ----------------------------------------------- Michal Fojtik <
mi@mifo.sk mfojtik@mifo.sk> Red Hat OpenShift, Engineering


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/openshift/origin/pull/10507/files/095b81adcf1aeb4f3f928f95f9e5fc1ebf91588f#r75328007,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuFf2kSJbvmQmB94THvfmDwvUjb2l4eks5qhHcngaJpZM4JnlAW
.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not RC listers...

Figures. Let's do it with an upstream patch. We'll want it upstream too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kargakis 🙉

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

@Kargakis re-check before I go add Get() upstream

@0xmichalis
Copy link
Copy Markdown
Contributor

@Kargakis re-check before I go add Get() upstream

It's fine but while you are here, add it in all the listers.

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

[test]

@Kargakis upstream PR opened. I added Get() into all listers that have namespace which are only three atm.

@0xmichalis
Copy link
Copy Markdown
Contributor

Fine with me for now

On Thu, Aug 18, 2016 at 6:22 PM, Michal Fojtik notifications@github.com
wrote:

[test]

@Kargakis https://github.com/kargakis upstream PR opened. I added Get()
into all listers that have namespace which are only three atm.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10507 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADuFf8-xw7Sv6OphFiNBjvlEzzXjkFt0ks5qhIa9gaJpZM4JnlAW
.

@eparis
Copy link
Copy Markdown
Member

eparis commented Aug 18, 2016

what is the upstream PR?

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

@Kargakis that failure is interesting :-/

@mfojtik mfojtik force-pushed the retry-dc-cancel branch 2 times, most recently from d63d688 to 7dceeed Compare August 18, 2016 18:57
@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 18, 2016

[test]

Michal Fojtik

On 18 August 2016 at 22:13:23, OpenShift Bot (notifications@github.com)
wrote:

Evaluated for origin test up to 7dceeed
7dceeed


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10507 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACsaDEfnbOF3cOfunU11A8gBBaRFfsAks5qhLzjgaJpZM4JnlAW
.

// replace the current deployment with the updated copy so that a future update has a chance at working
existingDeployments[i] = *updatedDeployment
c.recorder.Eventf(config, kapi.EventTypeNormal, "DeploymentCancelled", "Cancelled deployment %q superceded by version %d", deployment.Name, config.Status.LatestVersion)
if updatedDeployment != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any case this will be nil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, RC was deleted between retry.

@0xmichalis
Copy link
Copy Markdown
Contributor

@Kargakis that failure is interesting :-/

Welcome into the world of updating deployment controller tests

if err != nil {
return err
}
if kapierrors.IsNotFound(err) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you missed this! :-) this should upper.

@mfojtik mfojtik force-pushed the retry-dc-cancel branch 2 times, most recently from e2df1a2 to 8ad6eef Compare August 23, 2016 09:53
@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 23, 2016

@Kargakis we are green!

I will squash this for merge if you're ready.

delete(deployment.Annotations, deployapi.DesiredReplicasAnnotation)
}
deployment.Spec.Replicas = d.replicas
deployment.Namespace = "test"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this since you have it in the util

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@mfojtik mfojtik force-pushed the retry-dc-cancel branch 2 times, most recently from 127f61a to 9f26be4 Compare August 23, 2016 11:50
@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 23, 2016

@Kargakis sneaked one more commit here which should fix the ugly event in web console and in the describe output:

  1h        1h      1   {deploymentconfig-controller }          Warning     DeploymentScaleFailed   Failed to scale deployment "ruby-ex-4" from 0 to 0: Operation cannot be fulfilled on replicationcontrollers "ruby-ex-4": the object has been modified; please apply your changes to the latest version and try again

We fast-retry on conflict using the shared cache so we can also scale faster.

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 23, 2016

[test]

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 23, 2016

@Kargakis ptal, we are green

Michal Fojtik

On 23 August 2016 at 21:03:10, OpenShift Bot (notifications@github.com)
wrote:

continuous-integration/openshift-jenkins/test SUCCESS (
https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8370/)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10507 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACsaBnujKnnN2eRt0Xu8TWelzSMrda6ks5qi0PugaJpZM4JnlAW
.

if err != nil {
// Retry faster on conflicts
var updatedDeployment *kapi.ReplicationController
if err := kclient.RetryOnConflict(wait.Backoff{Steps: 5}, func() error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kclient.DefaultBackoff

@0xmichalis
Copy link
Copy Markdown
Contributor

Two more comments, LGTM otherwise

@mfojtik
Copy link
Copy Markdown
Contributor Author

mfojtik commented Aug 24, 2016

@Kargakis fixed, thanks!

[merge]

@openshift-bot
Copy link
Copy Markdown
Contributor

Evaluated for origin test up to f550e74

@openshift-bot
Copy link
Copy Markdown
Contributor

openshift-bot commented Aug 24, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8388/) (Image: devenv-rhel7_4917)

@openshift-bot
Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to f550e74

@openshift-bot openshift-bot merged commit 22bd662 into openshift:master Aug 24, 2016
@openshift-bot
Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8387/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants