Skip to content

chore: Adds plan-modify logic for replication specs#3223

Closed
EspenAlbert wants to merge 27 commits intoCLOUDP-308782_copy_unknowns_and_block_removalfrom
CLOUDP-308783_plan_modify_replication_specs
Closed

chore: Adds plan-modify logic for replication specs#3223
EspenAlbert wants to merge 27 commits intoCLOUDP-308782_copy_unknowns_and_block_removalfrom
CLOUDP-308783_plan_modify_replication_specs

Conversation

@EspenAlbert
Copy link
Collaborator

@EspenAlbert EspenAlbert commented Mar 28, 2025

Description

Link to any related issue(s): CLOUDP-308783

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@@ -167,13 +173,34 @@ func ensureSpecRespectChanges(ctx context.Context, spec *TFSpecsModel, req *cust
}

func replicationSpecsKeepUnknownWhenChanged(ctx context.Context, state attr.Value, req *customplanmodifier.UnknownReplacementRequest[PlanModifyResourceInfo]) []string {
Copy link
Member

Choose a reason for hiding this comment

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

q: how is the process of calling replicationSpecsKeepUnknownWhenChanged and the other funcs e.g. for electable_specs and read_only_specs, etc.?
to have a better understading of all the rules/logic we're applying to unkown values

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Added extra docs in efed2ea

keepUnknowns = append(keepUnknowns, "id") // When using new sharding config, the legacy id must never be copied
}
// for isShardingConfigUpgrade, it will be empty in the plan, so we need to keep it unknown
// for listLenChanges, it might be an insertion in the middle of replication spec leading to wrong value from state copied
Copy link
Member

Choose a reason for hiding this comment

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

Would note that API does support sending the ids as they are stored in the state, even when adding a replication spec in the middle. Not sure if this can help plan modifier or reduce some complexity (thinking more long term).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I understand correctly.
This handles the case of not using a state value for the legacy id field used by the old API when the new sharding config is used.

Copy link
Member

Choose a reason for hiding this comment

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

Yes sorry, I was referring to the logic of not sending external_id if req.Changes.ListLenChanged(rootPath)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh ok. I think it is safer to not send these when a replication_spec is added/removed. But no strong opinion

@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2025

This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@github-actions github-actions bot added stale and removed stale labels Apr 8, 2025
@github-actions
Copy link
Contributor

This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@github-actions github-actions bot added the stale label Apr 15, 2025
@EspenAlbert EspenAlbert added the not_stale Not stale issue or PR label Apr 15, 2025
@EspenAlbert
Copy link
Collaborator Author

Due to high effort and no demand this will be closed, possibly used if plan verbosity requests comes.

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

Labels

not_stale Not stale issue or PR stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants