-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Replicate member_entity_ids and policies in identity/group across nodes identically #16088
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VioletHynes
approved these changes
Jun 21, 2022
ccapurso
approved these changes
Jun 22, 2022
This was referenced Jun 28, 2022
hghaf099
added a commit
that referenced
this pull request
Jun 29, 2022
…es identically (#16088) * Replicate values of group member_entity_ids and policies across nodes identically * Adding CL * fixing tests
hghaf099
added a commit
that referenced
this pull request
Jun 29, 2022
…es identically (#16088) * Replicate values of group member_entity_ids and policies across nodes identically * Adding CL * fixing tests
hghaf099
added a commit
that referenced
this pull request
Jun 29, 2022
…es identically (#16088) * Replicate values of group member_entity_ids and policies across nodes identically * Adding CL * fixing tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses https://hashicorp.atlassian.net/browse/VAULT-2282
Example of reading an identity/group from a standby node:
{ "request_id": "4015c4c6-ee28-eec9-a42d-a0be91970dbc", "lease_id": "", "lease_duration": 0, "renewable": false, "data": { "alias": {}, "creation_time": "2022-06-21T05:56:12.378602Z", "id": "6a769520-f4b5-59a1-d7d7-21a650c91343", "last_update_time": "2022-06-21T05:56:12.378602Z", "member_entity_ids": null, "member_group_ids": [ "66bcfa57-8aab-04c8-d9ed-263bb5d2e6b0", "b7919faf-0a16-6acd-9e4d-82ac6db946bc" ], "metadata": null, "modify_index": 1, "name": "testgroup3", "namespace_id": "root", "parent_group_ids": null, "policies": [ "default" ], "type": "internal" }, "warnings": [ "Endpoint ignored these unrecognized parameters: [-format]" ] }
A group is marshalled and persisted in the leader node and then replicated to standby nodes. In standby node, memDB is populated after unmarshalling the group entry. However, member_entity_ids is an initialized empty slice when marshalled, but become a nil entry upon unmarshalling. This creates an inconsistency on the way active/standby nodes return the results.
To fix that, it was noticed that
member_entity_ids
field is nil, then passed intostrutil.RemoveDuplicates
function so that the duplicated entries be removed. That function returns an initialized empty slice regardless of thenil
argument. The fix simply checks if themember_entity_ids
field is not nil before passing it to that function. A test is going to be added to the ENT repo. Further details can be found in the ticket.