...

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

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

     1description: "Pre 6.0 Record max setVersion, even from primary without electionId"
     2
     3uri: "mongodb://a/?replicaSet=rs"
     4
     5phases: [
     6
     7    # Primary A has setVersion and electionId, 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    # Reconfig the set and elect B, it has a new setVersion but no electionId.
    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                minWireVersion: 0,
    56                maxWireVersion: 6
    57            }]
    58        ],
    59
    60        outcome: {
    61            servers: {
    62                "a:27017": {
    63                    type: "Unknown",
    64                    setName: ,
    65                    electionId:
    66                },
    67                "b:27017": {
    68                    type: "RSPrimary",
    69                    setName: "rs",
    70                    setVersion: 2
    71                }
    72            },
    73            topologyType: "ReplicaSetWithPrimary",
    74            logicalSessionTimeoutMinutes: null,
    75            setName: "rs",
    76            maxSetVersion: 2,
    77            maxElectionId: {"$oid": "000000000000000000000001"},
    78        }
    79    },
    80
    81    # Delayed response from A, reporting its reelection. Its setVersion shows
    82    # the election preceded B's so we ignore it.
    83    {
    84        responses: [
    85            ["a:27017", {
    86                ok: 1,
    87                helloOk: true,
    88                isWritablePrimary: true,
    89                hosts: ["a:27017", "b:27017"],
    90                setName: "rs",
    91                setVersion: 1,
    92                electionId: {"$oid": "000000000000000000000002"},
    93                minWireVersion: 0,
    94                maxWireVersion: 6
    95            }]
    96        ],
    97        outcome: {
    98            servers: {
    99                "a:27017": {
   100                    type: "Unknown",
   101                    setName: ,
   102                    electionId:
   103                },
   104                "b:27017": {
   105                    type: "RSPrimary",
   106                    setName: "rs",
   107                    setVersion: 2
   108                }
   109            },
   110            topologyType: "ReplicaSetWithPrimary",
   111            logicalSessionTimeoutMinutes: null,
   112            setName: "rs",
   113            maxSetVersion: 2,
   114            maxElectionId: {"$oid": "000000000000000000000001"},
   115        }
   116    }
   117]

View as plain text