Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROX-20872: fix fleetshard reconciler race condition #1629

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

ludydoo
Copy link
Collaborator

@ludydoo ludydoo commented Jan 31, 2024

Description

Fixing of the fleetshard cache bug.

How to reproduce:

  1. Reconcile central v1
  2. Reconcile centra v2
  3. Deployment is unhealthy (restarting)
  4. Reconcile central v1
  5. Reconcile central v2 (ignored/skipped)

The reason that the reconcile loop at step 5 is ignored is that the hash is not stored at step 4, even if the central CR was updated. At step 5, the reconciler will be skipped because the hash (v2) matches the last stored hash (step 2).

The effect is that v1 is deployed, but the reconciler thinks it reconciled v2.

The fix is to unset the hash if the reconciler exited early.

As an added precaution, trigger the reconcile loop if central was reconciled more than 15 minutes ago.

Copy link
Member

@SimonBaeumer SimonBaeumer left a comment

Choose a reason for hiding this comment

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

Nice job on the testing site and debugging 🚀

r.lastCentralHash = centralHash
r.lastCentralHashTime = time.Now()
} else {
r.lastCentralHash = [16]byte{}
Copy link
Member

Choose a reason for hiding this comment

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

When the Central hash should not be updated, delete it? I would have assumed it just doesn't set the last central hash instead of removing it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was the source of the bug, because when the deployment is not ready, the hash is not updated, even though the central CR has been updated.

Copy link
Contributor

openshift-ci bot commented Feb 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ludydoo, SimonBaeumer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [SimonBaeumer,ludydoo]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot removed the lgtm label Feb 5, 2024
Copy link
Contributor

openshift-ci bot commented Feb 5, 2024

New changes are detected. LGTM label has been removed.

@ludydoo ludydoo merged commit c48e249 into main Feb 6, 2024
9 checks passed
@ludydoo ludydoo deleted the ROX-20872-fleetshard-race-condition branch February 6, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants