-
Notifications
You must be signed in to change notification settings - Fork 8
Bug #15294: stop declaring mongod as a shard server #3722
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
Open
Regzox
wants to merge
14
commits into
develop
Choose a base branch
from
bug_15294
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4ee9043
Bug #15294: stop declaring mongod as a shard server
Regzox 6bff11b
Bug #15294: restart mongod one replica set member at a time
Regzox c36cbe0
Bug #15294: fail early on a leftover shardIdentity document
Regzox 5b4547b
Bug #15294: harden the logical session diagnosis script
Regzox 641b453
Bug #15294: stop calling the replica set name cosmetic
Regzox df8c81e
Bug #15294: name the CAS MongoDB client on the recette profile too
Regzox c14e0cc
Bug #15294: document the logical session diagnosis script
Regzox d11b3f2
Bug #15294: make the diagnosis script survive a denied command
Regzox c242a65
Bug #15294: stop skipping the shardIdentity check on a node holding data
Regzox 5765a65
Bug #15294: reach a single member with directConnection=true
Regzox 9283c2d
Bug #15294: never report an unreadable value as a measured one
Regzox 965afd4
Bug #15294: sequence the mongod restarts with a loop, not with throttle
Regzox bf1dc3b
Bug #15294: apply update_mongodb_configuration to the included restar…
Regzox 74b87aa
Bug #15294: harden the rolling restart and the session diagnosis
Regzox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
|
|
||
| # One member of the replica set, included once per member from main.yml. The | ||
| # loop is what makes the sequence sequential, and it has to be: "throttle: 1" | ||
| # on a block only serialises each task across the hosts, so every member would | ||
| # be restarted before the first wait had even started. Measured on Ansible | ||
| # 2.9.27, three hosts, a block of restart then sleep 3: with throttle the three | ||
| # sequences all ran between t and t+9.8s, with this loop they ran back to back. | ||
|
|
||
| # The include loops over every member of hosts_vitamui_mongod, including the | ||
| # ones the current play does not cover: a run under --limit, or a member that | ||
| # errored out earlier, leaves no mongod_restart_required fact behind. Defaulting | ||
| # that to "nothing to do" is the only safe choice here, but it must not pass | ||
| # unnoticed: such a member keeps running the configuration it had, which is the | ||
| # very one this fix exists to replace. | ||
| - name: "Report that the restart state of {{ mongod_member }} is unknown" | ||
| debug: | ||
| msg: >- | ||
| WARNING: {{ mongod_member }} is not part of this run, so whether it needs a | ||
| restart could not be determined and it is left untouched. It may still be | ||
| running with the previous mongod configuration, sharding.clusterRole | ||
| included. Run the mongo role against it before considering the replica set | ||
| up to date. | ||
| when: hostvars[mongod_member]['mongod_restart_required'] is not defined | ||
|
|
||
| - name: "Restart vitamui-mongod on {{ mongod_member }}" | ||
| # Restarting the primary needs no explicit rs.stepDown(): a clean SIGTERM | ||
| # makes mongod hand the primary role over before exiting. | ||
| systemd: | ||
| name: vitamui-mongod | ||
| state: restarted | ||
| daemon_reload: yes | ||
| delegate_to: "{{ mongod_member }}" | ||
| when: mongod_member_restart_required | bool | ||
|
|
||
| - name: "Wait for the vitamui-mongod port to be open on {{ mongod_member }}" | ||
| wait_for: | ||
| host: "{{ hostvars[mongod_member]['ip_service'] }}" | ||
| port: "{{ mongodb.mongod_port }}" | ||
| timeout: "{{ vitamui_defaults.services.start_timeout }}" | ||
| delegate_to: "{{ mongod_member }}" | ||
| when: mongod_member_restart_required | bool | ||
|
|
||
| - name: "Wait for {{ mongod_member }} to be back in the replica set" | ||
| # db.hello() is answered before authentication, so this holds whether or not | ||
| # the security block has already been added to mongod.conf. A member with no | ||
| # setName belongs to no replica set yet and has nothing to rejoin, which is | ||
| # the case on a first installation since the set is only initiated further | ||
| # down the role: it answers at once instead of waiting. | ||
| # | ||
| # The state is read here, after the restart, and never before it: a probe run | ||
| # beforehand cannot tell "belongs to no replica set" from "could not be | ||
| # reached", and taking the second for the first would move on to the next | ||
| # member while this one is still recovering - two members down at once on a | ||
| # three member set, which is exactly the quorum loss the rolling restart is | ||
| # there to avoid. Read afterwards, an unreachable member simply keeps the | ||
| # retries going and eventually stops the play on itself. | ||
| command: >- | ||
| mongosh --host {{ hostvars[mongod_member]['ip_service'] }} --port {{ mongodb.mongod_port }} | ||
| --quiet --eval 'const member = db.hello(); | ||
| quit(!member.setName || member.isWritablePrimary || member.secondary || member.arbiterOnly ? 0 : 1)' | ||
| delegate_to: "{{ mongod_member }}" | ||
| register: mongod_member_state | ||
| until: mongod_member_state.rc == 0 | ||
| retries: "{{ vitamui_defaults.services.status_retries_number | default(60) }}" | ||
| delay: "{{ vitamui_defaults.services.status_retries_delay | default(5) }}" | ||
| changed_when: false | ||
| when: mongod_member_restart_required | bool |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.