...

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

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

     1description: "New primary with greater setVersion"
     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                electionId: {"$oid": "000000000000000000000001"},
    18                minWireVersion: 0,
    19                maxWireVersion: 6
    20            }]
    21        ],
    22
    23        outcome: {
    24            servers: {
    25                "a:27017": {
    26                    type: "RSPrimary",
    27                    setName: "rs",
    28                    setVersion: 1,
    29                    electionId: {"$oid": "000000000000000000000001"}
    30                },
    31                "b:27017": {
    32                    type: "Unknown",
    33                    setName: ,
    34                    electionId:
    35                }
    36            },
    37            topologyType: "ReplicaSetWithPrimary",
    38            logicalSessionTimeoutMinutes: null,
    39            setName: "rs",
    40            maxSetVersion: 1,
    41            maxElectionId: {"$oid": "000000000000000000000001"},
    42        }
    43    },
    44
    45    # RS is reconfigured and B is elected.
    46    {
    47        responses: [
    48            ["b:27017", {
    49                ok: 1,
    50                helloOk: true,
    51                isWritablePrimary: true,
    52                hosts: ["a:27017", "b:27017"],
    53                setName: "rs",
    54                setVersion: 2,
    55                electionId: {"$oid": "000000000000000000000001"},
    56                minWireVersion: 0,
    57                maxWireVersion: 6
    58            }]
    59        ],
    60
    61        outcome: {
    62            servers: {
    63                "a:27017": {
    64                    type: "Unknown",
    65                    setName: ,
    66                    electionId:
    67                },
    68                "b:27017": {
    69                    type: "RSPrimary",
    70                    setName: "rs",
    71                    setVersion: 2,
    72                    electionId: {"$oid": "000000000000000000000001"}
    73                }
    74            },
    75            topologyType: "ReplicaSetWithPrimary",
    76            logicalSessionTimeoutMinutes: null,
    77            setName: "rs",
    78            maxSetVersion: 2,
    79            maxElectionId: {"$oid": "000000000000000000000001"},
    80        }
    81    },
    82
    83    # A still claims to be primary but it's ignored.
    84    {
    85        responses: [
    86            ["a:27017", {
    87                ok: 1,
    88                helloOk: true,
    89                isWritablePrimary: true,
    90                hosts: ["a:27017", "b:27017"],
    91                setName: "rs",
    92                setVersion: 1,
    93                electionId: {"$oid": "000000000000000000000001"},
    94                minWireVersion: 0,
    95                maxWireVersion: 6
    96            }]
    97        ],
    98        outcome: {
    99            servers: {
   100                "a:27017": {
   101                    type: "Unknown",
   102                    setName: ,
   103                    electionId:
   104                },
   105                "b:27017": {
   106                    type: "RSPrimary",
   107                    setName: "rs",
   108                    setVersion: 2,
   109                    electionId: {"$oid": "000000000000000000000001"}
   110                }
   111            },
   112            topologyType: "ReplicaSetWithPrimary",
   113            logicalSessionTimeoutMinutes: null,
   114            setName: "rs",
   115            maxSetVersion: 2,
   116            maxElectionId: {"$oid": "000000000000000000000001"},
   117        }
   118    }
   119]

View as plain text