Display priority=0 members on agent list in PBM Status output
Description
Environment
AFFECTED CS IDs
Smart Checklist
Activity

Jira Bot May 3, 2021 at 11:56 AM
To:
CC:
Hi, I'm jira-bot, Percona's Jira automation tool. I've detected that someone from
Percona has made an edit to the Summary field of an issue that you reported.
I'm not sentient (yet) so I'm not sure whether the person fixed a typo, changed
a few words, or completely rewrote the text. In any case, it is Percona Engineering's
intention to make the Summary and Description of an issue as accurate as possible
so that we're fixing the actual problem you're encountering, and to avoid
misunderstandings about symptoms and causes.
If the current Summary does not accurately reflect the problem you are reporting,
or if you feel the change was otherwise inappropriate in some way, please add a
new comment explaining things and we'll address it as soon as we can.
This message will be added only once per issue, regardless of how many times
the Summary is edited.
message-code:summary-edited

andrew.pogrebnoi March 30, 2021 at 5:07 PM
Hidden nodes also disappear from `admin.shards` collection. So such nodes no shard won't be displayed in `pbm status` as well. Need fix.

Akira Kurogane February 25, 2021 at 9:24 PM
This was reproduced using a non-sharded replica set. (Thank you Rafa for your help.)
In the configsvr node or non-sharded replica set case only the "hosts" array in db.isMaster() response of the leader is used (https://github.com/percona/percona-backup-mongodb/blob/c4ea5d4e9b86da09f3c27b5f0bc897aa8e4508c2/pbm/pbm.go#L778).
Per https://docs.mongodb.com/manual/reference/command/isMaster/#isMaster.hosts the "hosts" array doesn't include "passive" priority:0 nodes. (I can't believe I failed to notice and memorize this edge case earlier.)
So the fix might seem to be: Join the "passives" array, if it is present, to the the "hosts" array in clusterStatus().
But we'll have to go one step further I'm afraid. By design the isMaster response doesn't include information about hidden nodes in the replica set. If you make a direct connection to a hidden node it will self-report that with a {"hidden": true} member, but that's as far as isMaster covers it.
GetNodeInfo() will have to be changed to get the replica set member info from replSetGetConf or replSetGetStatus so it will include hidden nodes too. This is only for the configsvr replica set or a non-sharded replica set because from your test yesterday it seems the config.shards collection includes all hosts in the "hosts" field of those documents.

Akira Kurogane February 24, 2021 at 6:57 AM
This is planned to fixed in the next release (v1.5.0), currently under way.

Akira Kurogane February 22, 2021 at 7:02 AM
It should be valid to use a hidden node with pbm-agent, and also ones that aren't hidden but nonetheless are configured with priority 0. (Like "127.0.0.1:40004" was in this example test.)
I expect given that the direct option is used when the pbm-agent makes the first connection to it's local mongod in Node.Connect() it will connect without prejudice to whether the mongod is hidden or not, if it is primary or secondary or other status, or what the priority or voting values of the node are.
So I haven't figured out why it's not showing in pbm status, but my guess at the moment is using reading the "hosts" value in the config.shards collection (see GetShards()) is serving only the priority > 0 members. Which would be a mongodb behaviour.
a) Setting a member with priority=0
b) Taking the PBM status
c) setting the priority 1 to the member
d) re-checking the PBM status
At this point I couldn't see problems with the backup and I suppose it is an informational intent only. However, I am not sure if a 0 priority member should be considered a "hidden" one by the pbm status.