Skip to content

[Feature] OptionalReplace Upgrade Mode #1939

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

Merged
merged 1 commit into from
Jul 24, 2025
Merged

Conversation

ajanikow
Copy link
Collaborator

No description provided.

@cla-bot cla-bot bot added the cla-signed label Jul 18, 2025
@ajanikow ajanikow force-pushed the feature/broken_index_upgrade branch 4 times, most recently from 152b45c to 4a37dc6 Compare July 24, 2025 13:24
@ajanikow ajanikow force-pushed the feature/broken_index_upgrade branch from 4a37dc6 to 8ebffad Compare July 24, 2025 13:49
@ajanikow ajanikow requested a review from Copilot July 24, 2025 19:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the OptionalReplace Upgrade Mode feature for ArangoDB deployments. It enables a new upgrade strategy that allows for optional replacement of database servers when upgrade failures occur due to compaction issues.

  • Introduces new ArangoDB exit codes for upgrade failure handling
  • Implements automatic marking of DB servers for removal when specific upgrade failures occur
  • Adds support for optional compaction during member upgrades

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/util/constants/adb_codes.go Defines new exit codes for ArangoDB upgrade failure scenarios
pkg/deployment/resources/pod_inspector.go Adds logic to mark DB servers for removal on specific upgrade failures
pkg/deployment/resources/pod_creator_arangod.go Enables auto-upgrade full compaction for OptionalReplace mode
pkg/deployment/reconcile/plan_builder_utils.go Adds compact parameter to rotation plan creation
pkg/deployment/reconcile/plan_builder_rotate_upgrade.go Implements OptionalReplace upgrade logic and compaction support
pkg/deployment/reconcile/action_compact_member.go Extends compact action to support Single server group
CHANGELOG.md Documents the new feature

if c, ok := kresources.GetAnyContainerStatusByName(pod.Status.InitContainerStatuses, containers[id]); ok {
if t := c.State.Terminated; t != nil && slices.Contains([]int32{
constants.ArangoDBExitCodeUpgradeFailedCompaction,
//constants.ContainerExitCodeSegmentationFault, // Also in case of Segv
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

Remove commented code or implement it. The TODO-style comment suggests this might be needed but is commented out without clear reasoning.

Suggested change
//constants.ContainerExitCodeSegmentationFault, // Also in case of Segv
constants.ContainerExitCodeSegmentationFault, // Also in case of Segv

Copilot uses AI. Check for mistakes.

return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
}
return nil, false
return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

This line appears to be missing proper indentation and logical structure. The condition check for !m.Member.Conditions.IsTrue(api.ConditionTypeMarkedToRemove) was removed but the action is still being executed unconditionally.

Suggested change
return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
if !m.Member.Conditions.IsTrue(api.ConditionTypeMarkedToRemove) {
return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
}

Copilot uses AI. Check for mistakes.

return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
}
return nil, false
return api.Plan{actions.NewAction(api.ActionTypeMarkToRemoveMember, m.Group, m.Member, "Replace by Upgrade")}, false
}
Copy link
Preview

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

This closing brace appears to be orphaned after the removal of the condition check and return statement on the previous lines, which could cause compilation errors.

Suggested change
}
}
default:
r.planLogger.Str("member", m.Member.ID).Str("UpgradeMode", string(um.Get())).Error("Unhandled upgrade mode")
return nil, true

Copilot uses AI. Check for mistakes.

@ajanikow ajanikow merged commit 4c43f85 into master Jul 24, 2025
3 checks passed
@ajanikow ajanikow deleted the feature/broken_index_upgrade branch July 24, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant