...

Text file src/go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/rs/setversion_greaterthan_max_without_electionid.yml

Documentation: go.mongodb.org/mongo-driver/testdata/server-discovery-and-monitoring/rs

     1description: "setVersion that is greater than maxSetVersion is used if there is no electionId"
     2
     3uri: "mongodb://a/?replicaSet=rs"
     4
     5phases: [
     6
     7    # Primary A is discovered and tells us about B.
     8    {
     9        responses: [
    10            ["a:27017", {
    11                ok: 1,
    12                helloOk: true,
    13                isWritablePrimary: true,
    14                hosts: ["a:27017", "b:27017"],
    15                setName: "rs",
    16                setVersion: 1,
    17                minWireVersion: 0,
    18                maxWireVersion: 17
    19            }]
    20        ],
    21
    22        outcome: {
    23            servers: {
    24                "a:27017": {
    25                    type: "RSPrimary",
    26                    setName: "rs",
    27                    setVersion: 1,
    28                    electionId:
    29                },
    30                "b:27017": {
    31                    type: "Unknown",
    32                    setName: ,
    33                    electionId:
    34                }
    35            },
    36            topologyType: "ReplicaSetWithPrimary",
    37            logicalSessionTimeoutMinutes: null,
    38            setName: "rs",
    39            maxSetVersion: 1,
    40        }
    41    },
    42
    43    # B is elected, its setVersion is greater than our current maxSetVersion
    44    # B is primary, A is marked Unknown
    45    {
    46        responses: [
    47            ["b:27017", {
    48                ok: 1,
    49                helloOk: true,
    50                isWritablePrimary: true,
    51                hosts: ["a:27017", "b:27017"],
    52                setName: "rs",
    53                setVersion: 2,
    54                minWireVersion: 0,
    55                maxWireVersion: 17
    56            }]
    57        ],
    58
    59        outcome: {
    60            servers: {
    61                "a:27017": {
    62                    type: "Unknown",
    63                    setName: ,
    64                    electionId:
    65                },
    66                "b:27017": {
    67                    type: "RSPrimary",
    68                    setName: "rs",
    69                    setVersion: 2,
    70                    electionId:
    71                },
    72            },
    73            topologyType: "ReplicaSetWithPrimary",
    74            logicalSessionTimeoutMinutes: null,
    75            setName: "rs",
    76            maxSetVersion: 2,
    77        }
    78    }
    79]

View as plain text